1KAK(1) BSD General Commands Manual KAK(1)
2
4 kak — a vim-inspired, selection oriented code editor
5
7 kak [-d] [-n] [-ro] [-c session_id | -s session_id] [-ui ui_type]
8 [-e command] [-E command] [+line[:column] | +:] [file ...]
9 kak -f keys [-q] [-i suffix] [file ...]
10 kak -p session_id
11 kak -l
12 kak -clear
13 kak -version
14 kak -help
15
17 Kakoune is a code editor heavily inspired by vim(1) and vi(1). As such,
18 most of its commands are similar to vi(1)'s, sharing its “keystrokes as a
19 text editing language” model.
20
21 Kakoune operates in two modes, normal and insertion. In insertion mode,
22 keys are directly inserted into the current buffer. In normal mode, keys
23 are used to manipulate the current selection and to enter insertion mode.
24
25 Kakoune has a strong focus on interactivity. Most commands provide imme‐
26 diate and incremental results, while still being competitive in keystroke
27 count with vim.
28
29 Kakoune works on selections, which are oriented, inclusive ranges of
30 characters. Selections have an anchor and a cursor. Most commands move
31 both of them except when extending selection, where the anchor character
32 stays fixed and the cursor moves around.
33
34 The options are as follows:
35
36 -help Display a help message and quit.
37
38 -version
39 Display Kakoune version and quit.
40
41 -n Do not load the system's kakrc. (often, /usr/share/kak/kakrc)
42
43 -l List existing sessions.
44
45 -d Run as a headless session (requires -s).
46
47 -e command
48 Execute command after the client initialization phase.
49
50 -E command
51 Execute command after the server initialization phase.
52
53 -f keys
54 Enter in ‘filter mode’: select the whole file, then execute keys.
55
56 -i suffix
57 Backup the files on which a filter is applied, using the given
58 suffix.
59
60 -q When in ‘filter mode’, don't print any errors
61
62 -p session_id
63 Send the commands written on the standard input to session
64 session_id.
65
66 -c session_id
67 Connect to the given session session_id.
68
69 -s session_id
70 Set the current session name to session_id.
71
72 -ui type
73 Select the user interface type, which can be terminal, dummy, or
74 json.
75
76 -clear Remove sessions that were terminated in an incorrect state (e.g.
77 after a crash).
78
79 -ro Begin in readonly mode, all the buffers opened will not be writ‐
80 ten to disk.
81
82 +line[:column] | +:
83 Specify a target line and column for the first file. When the
84 plus sign is followed by only a colon, then the cursor is sent to
85 the last line of the file.
86
87 file ...
88 One or more file(s) to edit.
89
91 KAKOUNE_POSIX_SHELL
92 Overrides the POSIX shell used for %sh{...} expansion, which is
93 /bin/sh (sh(1)) if unset.
94
95 KAKOUNE_CONFIG_DIR
96 Overrides the location of the directory containing Kakoune user
97 configuration. If unset, $XDG_CONFIG_HOME/kak is used.
98
99 XDG_CONFIG_HOME
100 Path to the user's configuration directory. If unset,
101 $HOME/.config is used.
102
103 XDG_RUNTIME_DIR
104 Path to the user's session's sockets. If unset, $TMPDIR/kakoune
105 is used.
106
108 In the paths documented below, <rtdir> refers to the runtime directory,
109 whose value is determined in relation to the path to kak's binary loca‐
110 tion: <rtdir> = <path_to_kak_binary>/../share/kak.
111
112 If not started with the -n switch, kak will first load <rtdir>/kakrc,
113 which will in turn load the following additional files:
114
115 • If the $KAKOUNE_CONFIG_DIR/autoload directory exists, recursively
116 load every *.kak file in it, and its sub-directories.
117
118 • If it does not exist, fall back to the system-wide autoload directory
119 in <rtdir>/autoload, and recursively load all files in a similar way.
120
121 • <rtdir>/kakrc.local, if it exists; this is a user-defined system-wide
122 configuration.
123
124 • $KAKOUNE_CONFIG_DIR/kakrc, if it exists; this is the user configura‐
125 tion.
126
127 Consequently, if the $KAKOUNE_CONFIG_DIR/autoload directory exists, only
128 scripts stored within that directory will be loaded — the built-in *.kak
129 files will not be.
130
131 Users who still want the built-in scripts to be loaded along their own
132 can create a symbolic link to <rtdir>/autoload (or to individual scripts
133 in it) in their user-configuration directory:
134
135 ln -s <rtdir>/autoload ${XDG_CONFIG_HOME:-$HOME/.config}
136 /kak/autoload
137
139 Edit a file:
140 kak /path/to/file
141
142 Edit multiple files (multiple buffers will be created):
143 kak ./file1.txt /path/to/file2.c
144
145 Prepend a modeline that sets the tabstop to multiple files:
146 kak -f "ggO// kak: tabstop=8<esc>" *.c
147
149 For the complete on-line documentation, use the :doc command after start‐
150 ing kak.
151
152 The Kakoune wiki: https://github.com/mawww/kakoune/wiki
153
154 The main Kakoune web site: https://kakoune.org
155
156 vi(1), vim(1), sam(1plan9).
157
159 Maxime Coste <frrrwww@gmail.com> and many others.
160
161BSD June 15, 2021 BSD