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 Run Kakoune in ‘filter mode’, like sed(1). For standard input
55 and each file named on the command line, the whole buffer is se‐
56 lected (as with %) then keys are executed. The filtered version
57 of standard input is written to standard output. Any files men‐
58 tioned on the command line are modified in-place, but if -i is
59 provided then Kakoune makes a backup of the original version.
60
61 -i suffix
62 Backup the files on which a filter is applied, using the given
63 suffix.
64
65 -q When in ‘filter mode’, don't print any errors
66
67 -p session_id
68 Send the commands written on the standard input to session
69 session_id.
70
71 -c session_id
72 Connect to the given session session_id.
73
74 -s session_id
75 Set the current session name to session_id.
76
77 -ui type
78 Select the user interface type, which can be terminal, dummy, or
79 json.
80
81 -clear Remove sessions that were terminated in an incorrect state (e.g.
82 after a crash).
83
84 -ro Begin in readonly mode, all the buffers opened will not be writ‐
85 ten to disk.
86
87 +line[:column] | +:
88 Specify a target line and column for the first file. When the
89 plus sign is followed by only a colon, then the cursor is sent to
90 the last line of the file.
91
92 file ...
93 One or more file(s) to edit.
94
96 KAKOUNE_POSIX_SHELL
97 Overrides the POSIX shell used for %sh{...} expansion, which is
98 /bin/sh (sh(1)) if unset.
99
100 KAKOUNE_CONFIG_DIR
101 Overrides the location of the directory containing Kakoune user
102 configuration. If unset, $XDG_CONFIG_HOME/kak is used.
103
104 XDG_CONFIG_HOME
105 Path to the user's configuration directory. If unset,
106 $HOME/.config is used.
107
108 XDG_RUNTIME_DIR
109 Path to the user's session's sockets. If unset, $TMPDIR/kakoune
110 is used.
111
113 In the paths documented below, <rtdir> refers to the runtime directory,
114 whose value is determined in relation to the path to kak's binary loca‐
115 tion: <rtdir> = <path_to_kak_binary>/../share/kak.
116
117 If not started with the -n switch, kak will first load <rtdir>/kakrc,
118 which will in turn load the following additional files:
119
120 • If the $KAKOUNE_CONFIG_DIR/autoload directory exists, recursively
121 load every *.kak file in it, and its sub-directories.
122
123 • If it does not exist, fall back to the system-wide autoload directory
124 in <rtdir>/autoload, and recursively load all files in a similar way.
125
126 • <rtdir>/kakrc.local, if it exists; this is a user-defined system-wide
127 configuration.
128
129 • $KAKOUNE_CONFIG_DIR/kakrc, if it exists; this is the user configura‐
130 tion.
131
132 Consequently, if the $KAKOUNE_CONFIG_DIR/autoload directory exists, only
133 scripts stored within that directory will be loaded — the built-in *.kak
134 files will not be.
135
136 Users who still want the built-in scripts to be loaded along their own
137 can create a symbolic link to <rtdir>/autoload (or to individual scripts
138 in it) in their user-configuration directory:
139
140 ln -s <rtdir>/autoload ${XDG_CONFIG_HOME:-$HOME/.config}
141 /kak/autoload
142
144 Edit a file:
145 kak /path/to/file
146
147 Edit multiple files (multiple buffers will be created):
148 kak ./file1.txt /path/to/file2.c
149
150 Prepend a modeline that sets the tabstop to multiple files:
151 kak -f "ggO// kak: tabstop=8<esc>" *.c
152
154 For the complete on-line documentation, use the :doc command after start‐
155 ing kak.
156
157 The Kakoune wiki: https://github.com/mawww/kakoune/wiki
158
159 The main Kakoune web site: https://kakoune.org
160
161 vi(1), vim(1), sam(1plan9).
162
164 Maxime Coste <frrrwww@gmail.com> and many others.
165
166BSD June 15, 2021 BSD