kks
Handy Kakoune companion.
Installation
Download release binary
Download the compiled binary for your system from Releases page and put it somewhere in your $PATH
.
Build from source
Requires Go installed on your system.
Clone the repository and run go build
, then copy the compiled binary somewhere in your $PATH
.
If Go is configured to install packages in $PATH
, it's also possible to install without cloning the repository: run go install github.com/kkga/kks@latest
.
How to use
Kakoune configuration
Source kks init
to add kks-connect
command to Kakoune...
eval %sh{ kks init }
... and use your terminal integration to connect provided scripts, for example: kks-connect terminal kks-files
.
Kakoune mappings example
map global normal -docstring 'terminal' <c-t> ': kks-connect terminal<ret>'
map global normal -docstring 'files' <c-f> ': kks-connect popup kks-files<ret>'
map global normal -docstring 'buffers' <c-b> ': kks-connect popup kks-buffers<ret>'
map global normal -docstring 'files by content' <c-g> ': kks-connect popup kks-grep<ret>'
map global normal -docstring 'lines in buffer' <c-l> ': kks-connect popup kks-lines<ret>'
map global normal -docstring 'recent files' <c-r> ': kks-connect popup kks-mru<ret>'
map global normal -docstring 'lf' <c-h> ': kks-connect panel kks-lf<ret>'
map global normal -docstring 'lazygit' <c-v> ': kks-connect popup lazygit<ret>'
For more terminal integrations and for the (quite handy) popup
command, see:
Shell configuration example
export EDITOR=`kks edit`
alias k='kks edit'
alias ks='eval (kks-select)'
alias kcd='cd (kks get %sh{pwd})'
alias ka='kks attach'
alias kl='kks list'
kks configuration
kks
can be configured through environment variables.
At the moment, there is a single configuration option:
KKS_USE_GITDIR_SESSIONS
- when set to any value and
KKS_SESSION
is empty, runningkks edit
will do the following:- if file is inside a git directory,
kks
will search for an existing session based on top-level git directory name and connect to it; - if a session for the directory doesn't exist,
kks
will start a new session and connect to it.
- if file is inside a git directory,
- when set to any value and
Usage
USAGE
kks <command> [-s <session>] [-c <client>] [<args>]
COMMANDS
new, n create new session
edit, e edit file
send, s send command
attach, a attach to session
kill kill session
ls list sessions and clients
get get %{val}, %{opt} and friends
cat print buffer content
env print env
init print Kakoune definitions
ENVIRONMENT VARIABLES
KKS_SESSION Kakoune session
KKS_CLIENT Kakoune client
Use "kks <command> -h" for command usage.
Provided scripts
kks-buffers
-- pick bufferskks-files
-- pick fileskks-grep
-- search for pattern in working directorykks-lf
-- open lf with current buffer selectedkks-lines
-- jump to line in bufferkks-mru
-- pick recently opened filekks-select
-- select Kakoune session and client to set up environment