Giter VIP home page Giter VIP logo

kamp's Introduction

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 .

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}"<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

kamp's People

Contributors

jtrv avatar vbauerster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kamp's Issues

Investigate options for 'Daemonized' sessions

I would like to investigate options for 'daemonizing' kakoune sessions through kampliment in order to improve the startup time of kamp edit.

My current proposal for this functionality would be to add the following in kampliment

  • An option to behave similar to the functionality of the useGitDirSessions implementation in kks, this would also include a boolean environment variable KAMP_USE_GITDIR_SESSIONS that works in the same way.

  • An option to behave similar to the functionality of the defaultSessions implementation in kks, this would also include a boolean environment variable KAMP_DEFAULT_SESSION that works in the same way.

  • Alternatively a kampliment.toml etc might be useful if we intend to add more configuration options to kampliment in the future.

`kamp edit` opens an extra buffer when only one file is provided

When using kamp edit with a single argument, a secondary empty buffer is opened.
i.e. kamp edit tmp/index.html
image
the empty buffer does not seem to appear if I pass in more files
i.e. kamp edit tmp/index.html tmp/index.js
image
If I remove kampliment from my configuration this behavior does not persist so I am assuming this is an issue with kampliment.

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.