this post was submitted on 29 Jan 2024
2 points (100.0% liked)

Kakoune

22 readers
2 users here now

Unofficial community for talking about the kakoune text-editor.

Official website: http://kakoune.org/

Github: https://github.com/mawww/kakoune

The Kakoune logo is designed by p0nce

founded 11 months ago
MODERATORS
 

Very open-ended. Looking into Kakoune and just out of pure curiosity, I was wondering which plugins/setups you have and/or recommend?

top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 9 months ago

Hey :))

Most of my setup is based on this very excellent guide on the subject (https://blog.trinket.icu/articles/writing-your-first-kakrc)

Some key features I'd like to single out:

For looks I have few important parts, but I do have:

add-highlighter global/ number-lines -hlcursor -relative -separator "  " -cursor-separator " |"
add-highlighter global/ show-matching
set-option global ui_options terminal_assistant=none

For function, I have:

  • Cycle trough auto-complete suggestions with tab is such a nice feature
# Cycle autocomplete with tab
hook global InsertCompletionShow .* %{
    try %{
        exec -draft 'h<a-K>\h<ret>'
        map window insert <s-tab> <c-p>
        map window insert <tab> <c-n>
    }
}
hook global InsertCompletionHide .* %{
    unmap window insert <tab> <c-n>
    unmap window insert <s-tab> <c-p>
}
  • Quickly move between open buffers by pressing space + b/n/m
## Buffer navigation
map -docstring "Close current buffer" global user b ": db<ret>"
map -docstring "goto previous buffer" global user n ": bp<ret>"
map -docstring "goto next buffer" global user m ": bn<ret>"
  • Copy to and paste from system clipboard (this might need altering depending on which app you want to use for clipboards. I use xclip)
## Copy to and paste from system clipboard
map -docstring "Copy to system clipboard" global user y "<a-|> xclip -selection clipboard<ret>"
map -docstring "Paste from system clipboard" global user p "<a-!> xclip -o -selection clipboard<ret>"
  • Comment and un-comment lines by pressing
## Comment lines
map global normal <c-v> ":comment-line<ret>"
  • I really like the ability to quickly insert new-lines
## Insert newlines
map -docstring "Insert newline above" global user [ "O<esc>j"
map -docstring "Insert newline below" global user ] "o<esc>k"

I have some other stuff in my kakrc too, but that is for more specific use cases :))