2016-02-03 18:15:35 +01:00
|
|
|
|
KAKOUNE(1)
|
|
|
|
|
==========
|
|
|
|
|
|
|
|
|
|
NAME
|
|
|
|
|
----
|
|
|
|
|
commands - a
|
|
|
|
|
|
|
|
|
|
Primitives
|
|
|
|
|
----------
|
2016-03-12 10:13:49 +01:00
|
|
|
|
|
2016-04-08 18:00:24 +02:00
|
|
|
|
Some commands take an exclamation mark (*!*), which can be used to force
|
2016-03-12 10:13:49 +01:00
|
|
|
|
the execution of the command (i.e. to quit a modified buffer, the
|
|
|
|
|
command *q!* has to be used).
|
|
|
|
|
|
|
|
|
|
*cd* <directory>::
|
|
|
|
|
change the current directory to the one passed
|
|
|
|
|
|
|
|
|
|
*e[dit][!]* <filename> [<line> [<column>]]::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
open buffer on file, go to given line and column. If file is already
|
|
|
|
|
opened, just switch to this file. Use edit! to force reloading
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*w[rite]* [<filename>]::
|
|
|
|
|
write buffer to <filename> or use it's name if filename is not given
|
|
|
|
|
|
|
|
|
|
*w[rite]a[ll]*::
|
|
|
|
|
write all buffers that are associated to a file
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*q[uit][!]*::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
exit Kakoune, use quit! to force quitting even if there is some
|
|
|
|
|
unsaved buffers remaining
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*kill*::
|
|
|
|
|
terminate the current session, all the clients as well as the server
|
|
|
|
|
|
|
|
|
|
*w[a]q[!]*::
|
|
|
|
|
write the current buffer (or all buffers when *waq* is used) and quit
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*b[uffer]* <name>::
|
|
|
|
|
switch to buffer <name>
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*b[uffer]n[ext]*::
|
|
|
|
|
switch to the next buffer
|
|
|
|
|
|
|
|
|
|
*b[uffer]p[rev]*::
|
|
|
|
|
switch to the previous buffer
|
|
|
|
|
|
|
|
|
|
*d[el]b[uf][!]* [<name>]::
|
|
|
|
|
delete the buffer <name>
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*source* <filename>::
|
|
|
|
|
execute commands in <filename>
|
|
|
|
|
|
|
|
|
|
*runtime* <filename>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
execute commands in <filename>, <filename> is relative to kak
|
|
|
|
|
executable path
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*colorscheme* <name>::
|
|
|
|
|
load named colorscheme
|
|
|
|
|
|
|
|
|
|
*nameclient* <name>::
|
|
|
|
|
set current client name
|
|
|
|
|
|
|
|
|
|
*namebuf* <name>::
|
|
|
|
|
set current buffer name
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*echo* [options] <text>::
|
|
|
|
|
show *text* in status line, with the following *options*:
|
|
|
|
|
|
|
|
|
|
*-color* <face>:::
|
|
|
|
|
print the given text with *face*, most commonly *Error* or *Information*
|
|
|
|
|
|
|
|
|
|
*-markup*:::
|
|
|
|
|
expand the markup strings in *text* (c.f. the 'expansions' documentation page)
|
|
|
|
|
|
|
|
|
|
*-debug*:::
|
|
|
|
|
print the given text to the *\*debug** buffer
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*nop*::
|
|
|
|
|
does nothing, but arguments will be evaluated (e.g. shell expansion)
|
|
|
|
|
|
|
|
|
|
*set* <scope> <name> <value>::
|
|
|
|
|
change the value of an option (c.f. the 'options' documentation page)
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*unset* <scope> <name>::
|
|
|
|
|
unset the value of an option (c.f. the 'options' documentation page)
|
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*alias* <scope> <name> <command>::
|
|
|
|
|
define a new alias, within the context of a scope
|
|
|
|
|
|
|
|
|
|
*unalias* <scope> <name> [<command>]::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
remove an alias if its current value is the same as the one passed
|
|
|
|
|
as an optional parameter, remove it unconditionally otherwise
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*decl* [-hidden] <type> <name> [<value>]::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
declare a new option, the -hidden hides the option in completion
|
|
|
|
|
suggestions (c.f. the 'options' documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*face* <name> <facespec>::
|
|
|
|
|
define a face (c.f. the 'faces' documentation page)
|
|
|
|
|
|
|
|
|
|
*exec* [<flags>] <key> ...::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
execute a series of keys, as if they were hit (c.f. the 'execeval'
|
|
|
|
|
documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*eval* [<flags>] <command> ...::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
execute commands, as if they were entered in the command prompt
|
|
|
|
|
(c.f. the 'execeval' documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*def* [<flags>] <name> <command>::
|
|
|
|
|
define a new command (c.f. the 'Declaring new commands' section below)
|
|
|
|
|
|
|
|
|
|
*map* <scope> <mode> <key> <keys>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
bind a combination of keys to another one (c.f. the 'commands'
|
|
|
|
|
documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*hook* [-group <group>] <scope> <hook_name> <filtering_regex> <command>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
execute a command whenever an event is triggered (c.f. the 'hooks'
|
|
|
|
|
documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*rmhooks* <scope> <group>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
remove every hooks in *scope* that are part of the given *group*
|
|
|
|
|
(c.f. the 'hooks' documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*addhl* [<flags>] <highlighter_name> <highlighter_parameters> ...::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
add a highlighter to the current window (c.f. the 'highlighters'
|
|
|
|
|
documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*rmhl* <highlighter_id>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
remove the highlighter whose id is *highlighter_id* (c.f. the
|
|
|
|
|
'highlighters' documentation page)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
Helpers
|
|
|
|
|
-------
|
2016-02-10 22:03:49 +01:00
|
|
|
|
Kakoune provides some helper commands that can be used to define composite
|
|
|
|
|
commands:
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*prompt* <prompt> <register> <command>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
prompt the user for a string, when the user validates, store the
|
|
|
|
|
result in given *register* and run *commmand*. the *-init <str>*
|
|
|
|
|
switch allows setting initial content
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*onkey* <register> <command>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
wait for next key from user, writes it into given <register> and
|
|
|
|
|
execute commands
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*menu* <label1> <commands1> <label2> <commands2> ...::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
display a menu using labels, the selected label’s commands are
|
|
|
|
|
executed. menu can take an *-auto-single* argument, to automatically
|
|
|
|
|
run commands when only one choice is provided, and a *-select-cmds*
|
|
|
|
|
argument, in which case menu takes three argument per item, the
|
|
|
|
|
last one being a command to execute when the item is selected (but
|
|
|
|
|
not validated)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*info* [options] <text>::
|
|
|
|
|
display text in an information box with the following *options*:
|
|
|
|
|
|
|
|
|
|
*-anchor* <line>.<column>:::
|
|
|
|
|
print the text at the given coordinates
|
|
|
|
|
|
|
|
|
|
*-placement* {above,below}:::
|
|
|
|
|
set the placement relative to the anchor
|
|
|
|
|
|
|
|
|
|
*-title* <text>:::
|
|
|
|
|
set the title of the message box
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*try* <commands> catch <on_error_commands>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
prevent an error in *commands* from aborting the whole commands
|
|
|
|
|
execution, execute *on_error_commands* instead. If nothing is to be
|
2016-04-08 18:00:24 +02:00
|
|
|
|
done on error, the catch part can be omitted
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
*reg* <name> <content>::
|
|
|
|
|
set register *name* to *content*
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*select* <anchor_line>.<anchor_column>,<cursor_line>.<cursor_column>:...::
|
|
|
|
|
replace the current selections with the one described in the argument
|
|
|
|
|
|
|
|
|
|
*debug* {info,buffers,options,memory,shared-strings}::
|
|
|
|
|
print some debug information in the *\*debug** buffer
|
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
|
Note that those commands are also available in the interactive mode, but
|
|
|
|
|
are not really useful in that context.
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
Multiple commands
|
|
|
|
|
-----------------
|
2016-02-10 22:03:49 +01:00
|
|
|
|
Commands (c.f. previous sections) can be chained, by being separated either
|
|
|
|
|
by new lines or by semicolons, as such a semicolon must be escaped with a
|
|
|
|
|
backslash (\;) to be considered as a literal semicolon argument
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
Declaring new commands
|
|
|
|
|
----------------------
|
|
|
|
|
New commands can be defined using the *def* command:
|
|
|
|
|
|
|
|
|
|
*def* [flags] <command_name> <commands>::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
*commands* is a string containing the commands to execute, and *flags*
|
|
|
|
|
can be any combination of the following parameters:
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-params* <num>:::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
the command accepts a *num* parameter, which can be either a number,
|
|
|
|
|
or of the form <min>..<max>, with both <min> and <max> omittable
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-file-completion*:::
|
2016-02-03 18:15:35 +01:00
|
|
|
|
try file completion on any parameter passed to this command
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-client-completion*:::
|
2016-02-03 18:15:35 +01:00
|
|
|
|
try client name completion on any parameter passed to this command
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-buffer-completion*:::
|
2016-02-03 18:15:35 +01:00
|
|
|
|
try buffer name completion on any parameter passed to this command
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-shell-completion*:::
|
2016-02-10 22:03:49 +01:00
|
|
|
|
following string is a shell command which takes parameters as
|
|
|
|
|
positional params and output one completion candidate per line
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-allow-override*:::
|
2016-04-08 18:00:24 +02:00
|
|
|
|
allow the new command to replace an existing one with the same name
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-hidden*:::
|
2016-02-03 18:15:35 +01:00
|
|
|
|
do not show the command in command name completions
|
|
|
|
|
|
2016-03-12 10:13:49 +01:00
|
|
|
|
*-docstring*:::
|
2016-02-03 18:15:35 +01:00
|
|
|
|
define the documentation string for the command
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
|
Using shell expansion allows to define complex commands or to access Kakoune
|
|
|
|
|
state:
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
--------------------------------------------------------
|
|
|
|
|
def " print_selection %{ echo %sh{ ${kak_selection} } }"
|
|
|
|
|
--------------------------------------------------------
|