My Kakoune Editor Configuration

A friendly explanation of how Kakoune is configured.

Configuring the Kakoune Editor

$ cat ~/.config/kak/kakrc
hook global InsertCompletionShow .* %{
try %{
execute-keys -draft 'h<a-K>\h<ret>'
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
hook -once -always window InsertCompletionHide .* %{
map window insert <tab> <tab>
map window insert <s-tab> <s-tab>
}
}
}

set global indentwidth 4
set global tabstop 4
# add-highlighter global/ number-lines

How to Discover Functionality in Kakoune

:add-highlighter window/ number-lines
:remove-highlighter window/number-lines

Kakoune Concepts

Scopes

:add-highlighter window/ number-lines
:add-highlighter global/ number-lines

Hooks

:doc hooks
:delete-buffer
:db
hook global WinCreate .*\.java %{ add-highlighter number-lines }
hook <scope> <event> <filter> <command>
%{ add-highlighter number-lines }

Commands

:execute-keys xyo<esc>p

Command Parsing and Expansion

:echo Hello World!!!
:echo date
:echo %sh{date}
:doc expansions
hook global InsertCompletionShow .* %{
try %{
execute-keys -draft 'h<a-K>\h<ret>'
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
hook -once -always window InsertCompletionHide .* %{
map window insert <tab> <tab>
map window insert <s-tab> <s-tab>
}
}
}

InsertCompletionShow Hook Breakdown

hook global InsertCompletionShow .*
execute-keys -draft 'h<a-K>\h<ret>'
map window insert <tab> <c-n>
hook -once -always window InsertCompletionHide .* %{
map window insert <tab> <tab>
map window insert <s-tab> <s-tab>
}

Further Exploration

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store