I'm Siegfried. A developer. Yep.

Kakoune go!

The goal of this post is for me to not forget the following things.


Kakoune is mawww’s experiment for a better code editor.

Think vim with an obssesion about selections. Go to the README to learn more, and to this nice introduction.

I wanted to try a new editor and switched from vim to kakoune !


I am currently programming using Go ! That’s all :)

How to go in Kakoune

Kakoune already supports the go syntax. It also provides some tools.

Read the fine documentation

In the tools file, we can read:

# Provides integration of the following tools:
# - gocode for code completion (github.com/nsf/gocode)
# - goimports for code formatting on save
# - gogetdoc for documentation display and source jump (needs jq) (github.com/zmb3/gogetdoc)
# Needs the following tools in the path:
# - jq for json deserializaton

Check if you have the described tools installed and reachable (in your $PATH).

Also, I had to install screen (not sure if related though).

How to check if things are working ?

That’s all

A nice thing is to add something like this to your kakrc (found here):

hook global WinSetOption filetype=go %{
    set window lintcmd 'gofmt 2>&1 1>/dev/null'
    set global disabled_hooks .*-indent
    hook buffer BufWritePre .* %{
        go-format -use-goimports
    map window user . :go-doc-info<ret> -docstring 'go-doc-info'
    # map window user / :go-jump<ret> -docstring 'go-jump'

The last command is commented because it does not work on my computer and I have not yet checked why.

This will format and update imports on save !