Skip to content
/ kamp Public
forked from vbauerster/kamp

tool to control Kakoune editor from the command line

License

Notifications You must be signed in to change notification settings

erikeah/kamp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kamp

Kamp is a tool to control Kakoune editor from the command line.

Installation

From source

Requires Rust installed on your system.

Clone the repository and run cargo install --path .

Nix

With nix-env:

nix-env -iA kamp

With modern nix command:

nix profile install nixpkgs#kamp

Kakoune integration

Add following definition into your kakrc.

evaluate-commands %sh{
    kamp init -a -e EDITOR='kamp edit'
}

Provided scripts

The scripts need to be added to $PATH in order to use them.

script function
kamp-buffers pick buffers (fzf)
kamp-files pick files (fzf)
kamp-nnn pick files (nnn)
kamp-filetypes set filetype (fzf)
kamp-lines search lines in buffer (fzf)
kamp-sessions attach session and pick a buffer
kamp-grep grep interactively with fzf
kamp-fifo pipe stdin into fifo buffer

Kakoune mappings example

Following mappings use tmux-terminal-popup as popup implementation.

alias global popup tmux-terminal-popup
map global normal -docstring 'files'          <c-f> ':connect popup kamp-files<ret>'
map global normal -docstring 'git ls-files'   <c-l> ':connect popup kamp-files backend=git<ret>'
map global normal -docstring 'buffers'        <c-b> ':connect popup kamp-buffers<ret>'
map global normal -docstring 'grep selection' <c-g> ':connect popup kamp-grep ''query=%val{selection}<a-!>''<ret>'
map global normal -docstring 'grep limit by filetype' <c-y> ':connect popup kamp-grep -t %opt{filetype}<ret>'

Shell integration

You may want to set the EDITOR variable to kamp edit so that connected programs work as intended:

export EDITOR='kamp edit'

Some useful aliases:

alias k='kamp edit'
alias kval='kamp get val'
alias kopt='kamp get opt'
alias kreg='kamp get reg'
alias kcd-pwd='cd "$(kamp get sh pwd)"'
alias kcd-buf='cd "$(dirname $(kamp get val buffile))"'
alias kft='kamp get opt -b \* -s filetype | sort | uniq' # list file types you're working on

Similar projects

About

tool to control Kakoune editor from the command line

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 87.2%
  • Shell 12.8%