Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vbauerster/kamp
tool to control Kakoune editor from the command line
https://github.com/vbauerster/kamp
kakoune plugin
Last synced: about 12 hours ago
JSON representation
tool to control Kakoune editor from the command line
- Host: GitHub
- URL: https://github.com/vbauerster/kamp
- Owner: vbauerster
- License: unlicense
- Created: 2022-03-19T09:01:19.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T12:46:44.000Z (3 months ago)
- Last Synced: 2024-10-24T13:55:26.644Z (3 months ago)
- Topics: kakoune, plugin
- Language: Rust
- Homepage:
- Size: 313 KB
- Stars: 10
- Watchers: 6
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
Awesome Lists containing this project
README
# Kamp
Kamp is a tool to control [Kakoune](https://github.com/mawww/kakoune) editor from the command line.
## Installation
### From source
Requires [Rust](https://www.rust-lang.org) installed on your system.
Clone the repository and run `cargo install --path .`
### Nix
With nix-env:
```shell-script
nix-env -iA kamp
```With modern nix command:
```shell-script
nix profile install nixpkgs#kamp
```## Kakoune integration
Add following definition into your kakrc.
```kak
evaluate-commands %sh{
kamp init -a -e EDITOR='kamp edit'
}
```## Provided scripts
The [scripts](scripts) need to be added to `$PATH` in order to use them.
| script | function |
| ------------------------------------------ | -------------------------------- |
| [`kamp-buffers`](scripts/kamp-buffers) | pick buffers (fzf) |
| [`kamp-files`](scripts/kamp-files) | pick files (fzf) |
| [`kamp-nnn`](scripts/kamp-nnn) | pick files (nnn) |
| [`kamp-filetypes`](scripts/kamp-filetypes) | set filetype (fzf) |
| [`kamp-lines`](scripts/kamp-lines) | search lines in buffer (fzf) |
| [`kamp-sessions`](scripts/kamp-sessions) | attach session and pick a buffer |
| [`kamp-grep`](scripts/kamp-grep) | grep interactively with fzf |
| [`kamp-fifo`](scripts/kamp-fifo) | pipe stdin into fifo buffer |### Kakoune mappings example
Following mappings use [tmux-terminal-popup](https://github.com/alexherbo2/tmux.kak/blob/716d8a49be26b6c2332ad4f3c5342e485e02dff4/docs/manual.md#tmux-terminal-popup) as popup implementation.
```kak
alias global popup tmux-terminal-popup
map global normal -docstring 'files' ':connect popup kamp-files'
map global normal -docstring 'git ls-files' ':connect popup kamp-files -b git'
map global normal -docstring 'buffers' ':connect popup kamp-buffers'
map global normal -docstring 'grep selection' ':connect popup kamp-grep -q ''%val{selection}'''
map global normal -docstring 'grep by filetype' ':connect popup kamp-grep -- -t %opt{filetype}'
```## Shell integration
You may want to set the `EDITOR` variable to `kamp edit` so that connected programs work as intended:
```sh
export EDITOR='kamp edit'
```Some useful aliases:
```sh
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
- [kks](https://github.com/kkga/kks)
- [kakoune.cr](https://github.com/alexherbo2/kakoune.cr)
- [kakoune-remote-control](https://github.com/danr/kakoune-remote-control)