Open a file and enter normal mode, to execute commands

$ kak [path/to/file]

Enter insert mode from normal mode, to write text into the file
$ i

Escape insert mode, to go back to normal mode
$ <Escape>

Replace all instances of "foo" in the current file with "bar"
$ %s[foo]<Enter>c[bar]<Escape>

Unselect all secondary selections, and keep only the main one
$ <Space>

Search for numbers and select the first two
$ /\d+<Enter>N

Insert the contents of a file
$ !cat [path/to/file]<Enter>

Save the current file
$ :w<Enter>


kak -help

kak -version

kak -l

kak -clear

kak -f keys [-q] [-i] file...

kak -p session_id

kak -s session_id -d [-n] [-ro] [-E command] [+line[:column]|+:] file...

kak [-c session_id|-s session_id] [-n] [-ro] [-ui ui_type] [-e command] [-E command] [+line[:column]|+:] file...


Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to Vi's ones, and it shares Vi's "keystrokes as a text editing language" model.

Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode.

Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being competitive (as in keystroke count) with Vim.

Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and a cursor character. Most commands move both of them, except when extending selection where the anchor character stays fixed and the cursor one moves around.

For more information, use the :doc command after starting Kakoune, the Kakoune wiki at or the main Kakoune web site:



display a help message and quit


display kakoune version and quit


do not load resource files on startup (kakrc, autoload, rc etc)


list existing sessions


run as a headless session (requires -s)

-e command

execute command after the client initialization phase

-E command

execute command after the server initialization phase

-f keys

enter in filter mode: select the whole file, then execute keys

-i suffix

backup the files on which a filter is applied using the given suffix


when in filter mode, don't print any errors

-p session_id

send the commands written on the standard input to session session_id

-c session_id

connect to the given session

-s session_id

set the current session name to session_id

-ui type

select the user interface, can be one of ncurses, dummy or json


remove sessions that terminated in an incorrect state (e.g. after a crash)


enter in readonly mode, all the buffers opened will not be written to disk


specify a target line and column for the first file; when the plus sign is followed by only a colon, then the cursor is sent to the last line of the file


one or more files to edit



Overrides the posix shell binary path to use for %sh{...} expansion.


Overrides the location of the directory containing kakoune user configuration, defaults to $XDG_CONFIG_HOME/kak if unset.


Path to the user configuration directory, defaults to $HOME/.config/kak if unset.


Path to the user session sockets, defaults to $TMPDIR/kakoune if unset.


In the paths documented below, <rtdir> refers to the runtime directory, whose value is determined in relation to the path to the kak binary: <rtdir> = <path_to_kak_binary>/../share/kak.

If not started with the -n switch, Kakoune will first load <rtdir>/kakrc, which will in turn load the following additional files:

if the $KAKOUNE_CONFIG_DIR/kak/autoload directory exists, recursively load every
*.kak files in it and its sub-directories
if it does not exist, fall back to the system-wide autoload directory
in <rtdir>/autoload, and recursively load all files in a similar way
<rtdir>/kakrc.local, if it exists; this is a user-defined system-wide
$KAKOUNE_CONFIG_DIR/kak/kakrc, if it exists; this is the user configuration

Consequently, if the $KAKOUNE_CONFIG_DIR/kak/autoload directory exists, only scripts stored within that directory will be loaded - the built-in *.kak files will not be.

Users who still want to have the built-in scripts loaded along their own can create a symbolic link to <rtdir>/autoload (or to individual scripts in it) in their user-configuration directory:

ln -s <rtdir>/autoload "${XDG_CONFIG_HOME:-$HOME/.config}"/kak/autoload


Edit a file:

kak /path/to/file

Edit multiple files (multiple buffers will be created):

kak ./file1.txt /path/to/file2.c

Insert a modeline that sets the tabstop variable at the beginning of several source code files:

kak -f "ggO// kak: tabstop=8<esc>" *.c


vi(1), vim(1), sam(1plan9)

Copied to clipboard