Giter VIP home page Giter VIP logo

kks's Issues

Client and session completion

Hey, what do you think of switching to cobra for argument parsing ?

It would allow to add completions for bash/zsh/fish with minimal effort

Strip leading `-` from session name

My dotfiles repo lives in ~/.dotfiles, so the resulting gitdir session name is -dotfiles. This wreaks havoc with kak-lsp and kakoune itself, the former thinking it is a command-line flag, and the latter thinking it's a switch to the command you pass %val{session} to.

shell stderr: <<<
error: Found argument '-o' which wasn't expected, or isn't valid in this context

USAGE:
    kak-lsp --daemonize --kakoune --session <SESSION>

For more information try --help
>>>

Suggested fix

Strip any non-alphanumeric characters from the front of the session name.

To reproduce

  • Create a Git repo inside a hidden folder (e.g. ".test")
  • Pass KKS_USE_GITDIR_SESSIONS
  • Open kakoune and try to enable kak-lsp with evaluate-commands %sh{ kak-lsp --kakoune -s $kak_session }
  • Check *debug* and you will see kak-lsp complain about an unknown command line flag.

Panic on list command when no session is running

$ kak -l
$ kks list
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/kkga/kks/kak.(*Session).Dir(0xc000077cf0)
	/home/teddy/src/kks/kak/kak.go:33 +0x8e
github.com/kkga/kks/cmd.(*ListCmd).Run(0xc0001b4320)
	/home/teddy/src/kks/cmd/list.go:75 +0x176
github.com/kkga/kks/cmd.Root({0xc0001a8010, 0x0, 0xc000066750})
	/home/teddy/src/kks/cmd/root.go:38 +0x689
main.main()
	/home/teddy/src/kks/main.go:21 +0xe8

Reason: in kak/kak.go

strings.Split(strings.TrimSpace(string(o)), "\n")

Always returns 1 element slice where the only element is empty string when o == "".

Simple fix:

diff --git i/kak/kak.go w/kak/kak.go
index 270ff4..3037f7 100644
--- i/kak/kak.go
+++ w/kak/kak.go
@@ -46,6 +48,9 @@ func (s *Session) Clients() (clients []Client, err error) {
 func Sessions() (sessions []Session, err error) {
 	o, err := exec.Command("kak", "-l").Output()
 	for _, s := range strings.Split(strings.TrimSpace(string(o)), "\n") {
+		if s == "" {
+			continue
+		}
 		sessions = append(sessions, Session{s})
 	}
 	return

kks + kakship

As I was not able to find a forum/chat link to this plugin, I decided to share here, something to add to the docs?

Just sharing the bufline I did using kakship + kks

eburghar/kakship#4 (comment)

The list of buffers on the top

kakbuflist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.