How to reload config without leaving kakoune


When modifying my kakrc files, to reload my kak session with the new config I always have to quit and re-run kakoune.

Is there a way to do so without leaving kakoune?

I tried :source ~/.config/kak/kakrc but it always trigger an error command foo already defined and therefore doesn’t reload the config files. I don’t want to add -override for all my commands.


Kakoune is supposed to start quickly enough that restarting it to load a new configuration shouldn’t be a burden.

Of course, it’s not possible to guarantee that Kakoune will always start quickly (add enough plugins and anything will get slow) but the expectation is that restarts are cheap and Kakoune sessions shouldn’t build up too much state.

1 Like

If you only change a small part, you can select it and run eval %reg{.}.

I always add -override to my commands and use this pattern to only load plugins once

declare-option -hidden bool init_done
evaluate-commands %sh{
    $kak_opt_init_done && exit
    # plugin loading goes here
set-option global init_done true

The rest of my config is idempotent; if I make a change, I just source everything again. I like it a lot. It works well because my plugins seldomly change.


Yes, supposedly. Here are startup times for Kak (freshly installed) vs Vim (with a massive group of vimrc files):

[GNU/Linux user ~]$ time -p kak -e 'quit' ; echo ; time -p vim -c 'quit'
real 1.19
user 0.01
sys 0.11

real 0.02
user 0.02
sys 0.00

What’s going on here that makes kak startup 60x slower than vim? And if the startup time is that much slower, than hot reloading does sound like a good feature.

there must be something wrong with your configuration/installation. I get this when using Kakoune v2022.10.31:

$ time -p HOME=$(mktemp) /bin/kak -e quit
real 0.06
user 0.05
sys 0.03
$ time -p /bin/kak -e quit
real 0.11
user 0.08
sys 0.02

even a build with debug=yes starts in 100ms, not the >1s you’re seeing

I have this to reload .kak files when saving:

# Reload kakrc and .kak when saving.
# Adds -override to definitions (unless they seem to be python defs!)
# Evals provide module directly

def resource -params 1 %{
    eval %sh{
        file=$(dirname "$1")/.reload.kak
        cat "$1" |
            sed 's/^def \([^:]*\)$/def -override \1/'   |
            sed 's/^define-command /def -override /'    |
            sed 's/^addhl /addhl -override/'            |
            sed 's/^add-highlighter /addhl -override /' |
            sed 's/^provide-module \w\+ /eval /'        |
            cat > "$file"
        printf %s "
            source $file
            nop %sh{
                rm $file
    echo Reloaded %arg{1}

rmhooks global reload-kak
hook -group reload-kak global BufWritePost (.*kakrc|.*\.kak) %{
     resource %val{hook_param}

wow, that’s a clever way to reload arbitrary plugins. Has the potential to fail in many ways but probably works fine in practice

I re-did this test inside of tmux and kak starts a hair faster than vim (order doesn’t seem to matter). It’s still slow outside of tmux. Odd, huh?

If I’m the only person seeing this, then it’s fine; I’m only using tmux now. If I switch to another windows manager, like dvtm, I’ll see what happens. Thanks!