Could Someone Give me Advice for Improving My Workflow in Kakoune with Plugins and Key Mappings?

Hello there,

I have been using Kakoune for a few months now and absolutely love the modal editing approach. I have found that it makes me more efficient, but I feel there is still a lot of room for improving my workflow; especially when it comes to integrating plugins and customizing key mappings.

I often work on large projects with many nested files; and while I am familiar with :edit and :cd; I am wondering if there are any plugins or tips to make jumping between files or searching for files even faster and more intuitive.

I would like to streamline writing repetitive code structures. Are there any plugins or built in features that you recommend for handling snippets or smart auto completion; especially for languages like Python and JavaScript? :thinking:

I have customized a few key bindings; but I am curious how others have optimized their key mappings to make editing more efficient. For example; what are some creative mappings for text selection or manipulating selections that you find indispensable? :thinking:

Also, I have gone through this post; https://discuss.kakoune.com/t/how-to-make-a-shortcut-for-a-plugin-command-minitab/ which definitely helped me out a lot.

I have explored a few plugins but would love to hear what the community considers must-haves for speeding up workflows; improving syntax highlighting; or even better file searching.

Thanks in advance for your help and assistance. :innocent:

For searching through the content of all the files in a project, I generally rely on Kakoune’s existing :grep command, configured to use ripgrep rather than the standard grep tool.

For searching through the names of files in a project, I use a snippet I grabbed from mawww’s config file, which is just a thin wrapper around the existing :edit command, but which uses ripgrep to generate the list of possible files, presented through Kakoune’s normal completion menu:

define-command find -menu -params 1 \
    -shell-script-candidates %{ rg --files } \
    %{ edit %arg{1} }

I don’t really use snippets or smart autocompletion, but I do have a custom user-mode that makes some of the more esoteric selection-adjustment commands a bit more accessible:

declare-user-mode anchor

map global anchor a '<esc><a-;>;'     -docstring 'reduce to anchor'
map global anchor c '<esc>;'          -docstring 'reduce to cursor'
map global anchor f '<esc><a-;>'      -docstring 'flip cursor and anchor'
map global anchor h '<esc><a-:><a-;>' -docstring 'ensure anchor after cursor'
map global anchor l '<esc><a-:>'      -docstring 'ensure cursor after anchor'
map global anchor s '<esc><a-S>'      -docstring 'select cursor and anchor'

map global normal ';' ': enter-user-mode anchor<ret>'

I’m pretty sure I got it from @occivink back in the day.

1 Like

Hemlo, I really recommend peneira or fzf for searching files, I also use a lot a plugin I wrote which is called kakoune-recent-buffers, it’s super opinionated but helps me keep track of contexts of 2 to 4 files, peneira really works fast with a good first ripgrep filter and using luajit

1 Like