2017-11-02 05:03:24 +03:00
|
|
|
|
= Commands
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-04-08 19:00:24 +03:00
|
|
|
|
Some commands take an exclamation mark (*!*), which can be used to force
|
2016-03-12 12:13:49 +03:00
|
|
|
|
the execution of the command (i.e. to quit a modified buffer, the
|
2020-05-28 19:37:26 +03:00
|
|
|
|
command *q!* has to be used). Aliases are mentioned below each command.
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2016-12-13 21:11:45 +03:00
|
|
|
|
*doc* <topic>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* help +
|
|
|
|
|
display documentation about a topic. The completion list displays the
|
|
|
|
|
available topics
|
2016-12-13 21:11:45 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Files and Buffers
|
|
|
|
|
|
2018-08-29 20:22:46 +03:00
|
|
|
|
For the following *write* commands, the *-sync* switch forces the synchronization
|
|
|
|
|
of the file onto the filesystem
|
|
|
|
|
|
2020-02-24 11:41:51 +03:00
|
|
|
|
*arrange-buffers* <buffer>...::
|
|
|
|
|
Reorder the buffers in the buffers list.
|
|
|
|
|
The named buffers will be moved to the front of the buffer list, in the order
|
|
|
|
|
given. Buffers that do not appear in the parameters will remain at the
|
|
|
|
|
end of the list, keeping their current order.
|
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
*change-directory* [<directory>]::
|
|
|
|
|
*alias* cd +
|
|
|
|
|
change the current directory to *directory*, or the home directory if
|
|
|
|
|
unspecified
|
|
|
|
|
|
2019-02-15 12:04:27 +03:00
|
|
|
|
*edit[!]* [<switches>] <filename> [<line> [<column>]]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* e +
|
|
|
|
|
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 20:15:35 +03:00
|
|
|
|
|
2019-02-15 12:04:27 +03:00
|
|
|
|
*-debug*:::
|
|
|
|
|
The new buffer (if any) will be created as a debug buffer.
|
|
|
|
|
(See <<buffers#debug-buffers,`:doc buffers debug-buffers`>>)
|
|
|
|
|
|
|
|
|
|
*-existing*:::
|
|
|
|
|
If the named file does not exist, fail instead of creating a new buffer.
|
|
|
|
|
|
|
|
|
|
*-readonly*:::
|
|
|
|
|
The new buffer (if any) will be set read-only.
|
|
|
|
|
|
|
|
|
|
*-fifo* <fifoname>:::
|
|
|
|
|
Creates a new scratch buffer named <filename>, and continually appends
|
|
|
|
|
data from the fifo (named pipe) <fifoname> as it arrives.
|
|
|
|
|
(See <<buffers#fifo-buffers,`:doc buffers fifo-buffers`>>)
|
|
|
|
|
|
|
|
|
|
*-scratch*:::
|
|
|
|
|
Creates a new buffer named <filename>, which doesn't correspond to any
|
2019-11-03 10:53:11 +03:00
|
|
|
|
file on disk. If no filename is given, the buffer name will be
|
|
|
|
|
generated based on format `\*scratch-$ID\*`, where `$ID` is an
|
|
|
|
|
integer automatically incremented for new buffers.
|
2019-02-15 12:04:27 +03:00
|
|
|
|
(See <<buffers#scratch-buffers,`:doc buffers scratch-buffers`>>)
|
|
|
|
|
|
|
|
|
|
*-scroll*:::
|
|
|
|
|
If used with `-fifo`, when new data arrives Kakoune will scroll the
|
|
|
|
|
buffer down to make the new data visible.
|
|
|
|
|
Otherwise, does nothing.
|
|
|
|
|
|
|
|
|
|
|
2019-11-21 15:36:38 +03:00
|
|
|
|
*write[!]* [-sync] [-atomic] [<filename>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* w +
|
|
|
|
|
write buffer to <filename> or use its name if filename is not
|
|
|
|
|
given. If the file is write-protected, its permissions are temporarily
|
|
|
|
|
changed to allow saving the buffer and restored afterwards when
|
|
|
|
|
the write! command is used.
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2019-11-21 15:36:38 +03:00
|
|
|
|
*-sync*:::
|
|
|
|
|
Synchronise the filesystem after the write
|
|
|
|
|
|
2019-11-22 13:51:32 +03:00
|
|
|
|
*-atomic*:::
|
|
|
|
|
Force writing to a temporary file then renaming to the target file
|
2019-11-21 15:36:38 +03:00
|
|
|
|
so that the modification appears automatically.
|
|
|
|
|
|
2018-08-29 20:22:46 +03:00
|
|
|
|
*write-all* [-sync]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* wa +
|
2020-05-28 19:37:26 +03:00
|
|
|
|
write all changed buffers that are associated with a file
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-08-23 19:53:15 +03:00
|
|
|
|
*quit[!]* [<exit status>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* q +
|
|
|
|
|
exit Kakoune, use quit! to force quitting even if there is some
|
2020-05-28 19:37:26 +03:00
|
|
|
|
unsaved buffer remaining. If specified, the client exit status
|
2017-11-02 12:37:39 +03:00
|
|
|
|
will be set to <exit status>
|
2017-08-23 09:22:23 +03:00
|
|
|
|
|
2018-08-29 20:22:46 +03:00
|
|
|
|
*write-quit[!]* [-sync] [<exit status>]::
|
2018-08-23 19:53:15 +03:00
|
|
|
|
*alias* wq +
|
|
|
|
|
write current buffer and quit current client. If specified, the client
|
|
|
|
|
exit status will be set to <exit status>
|
|
|
|
|
|
2018-08-29 20:22:46 +03:00
|
|
|
|
*write-all-quit* [-sync] [<exit status>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* waq +
|
|
|
|
|
write all buffers and quit. If specified, the client exit status
|
|
|
|
|
will be set to <exit status>
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-09-09 14:47:45 +03:00
|
|
|
|
*buffer* <name>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* b +
|
|
|
|
|
switch to buffer <name>
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-09-09 14:47:45 +03:00
|
|
|
|
*buffer-next*::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* bn +
|
2019-02-15 12:04:27 +03:00
|
|
|
|
switch to the next buffer.
|
|
|
|
|
Debug buffers are skipped.
|
|
|
|
|
(See <<buffers#debug-buffers,`:doc buffers debug-buffers`>>)
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2017-09-09 14:47:45 +03:00
|
|
|
|
*buffer-prev*::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* bp +
|
2019-02-15 12:04:27 +03:00
|
|
|
|
switch to the previous buffer.
|
|
|
|
|
Debug buffers are skipped.
|
|
|
|
|
(See <<buffers#debug-buffers,`:doc buffers debug-buffers`>>)
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2017-09-09 14:47:45 +03:00
|
|
|
|
*delete-buffer[!]* [<name>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* db +
|
2018-08-29 20:22:46 +03:00
|
|
|
|
delete current buffer or the buffer <name> if specified
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2019-12-07 07:39:54 +03:00
|
|
|
|
*rename-buffer* [-file|-scratch] <name>::
|
|
|
|
|
set current buffer name, if *-scratch* or *-file* is given, ensure
|
|
|
|
|
the buffer is set to the corresponding type.
|
2017-11-07 10:29:08 +03:00
|
|
|
|
|
2018-05-24 00:22:40 +03:00
|
|
|
|
*source* <filename> <param>...::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
execute commands in <filename>
|
2018-11-09 10:39:00 +03:00
|
|
|
|
parameters are available in the sourced script as `%arg{0}`, `%arg{1}`, …
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Clients and Sessions
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-11-14 03:27:14 +03:00
|
|
|
|
*rename-client* <name>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* nc +
|
|
|
|
|
set current client name
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-11-14 03:27:14 +03:00
|
|
|
|
*rename-session* <name>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
set current session name
|
2016-07-28 02:17:55 +03:00
|
|
|
|
|
2018-08-29 20:22:46 +03:00
|
|
|
|
*kill[!]* [<exit status>]::
|
|
|
|
|
terminate the current session, all the clients as well as the server.
|
|
|
|
|
If specified, the server and clients exit status will be set to <exit status>
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Options
|
2017-10-17 05:02:11 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*declare-option* [<switches>] <type> <name> [<value>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* decl +
|
2018-03-17 17:41:56 +03:00
|
|
|
|
declare a new option, the -hidden switch hides the option in completion
|
2017-11-08 11:32:49 +03:00
|
|
|
|
suggestions (See <<options#declare-option,`:doc options declare-option`>>)
|
2017-05-25 11:02:10 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*set-option* [<switches>] <scope> <name> <value>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* set +
|
2019-01-23 04:34:02 +03:00
|
|
|
|
change the value of an option in *scope*
|
|
|
|
|
(See <<options#set-option,`:doc options set-option`>>
|
|
|
|
|
and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-05-25 11:02:10 +03:00
|
|
|
|
*unset-option* <scope> <name>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* unset +
|
2019-01-23 04:34:02 +03:00
|
|
|
|
unset the value of an option in *scope*, so the value from an outer scope
|
|
|
|
|
is used
|
|
|
|
|
(See <<options#unset-option,`:doc options unset-option`>>
|
|
|
|
|
and <<scopes#,`:doc scopes`>>)
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2017-05-25 11:02:10 +03:00
|
|
|
|
*update-option* <scope> <name>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
update the value of an option if its type supports that operation
|
2019-01-23 04:34:02 +03:00
|
|
|
|
(See <<options#update-option,`:doc options update-option`>>
|
|
|
|
|
and <<scopes#,`:doc scopes`>>)
|
2017-05-25 11:02:10 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Commands and Keys
|
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*define-command* [<switches>] <name> <command>::
|
2017-11-07 10:29:08 +03:00
|
|
|
|
*alias* def +
|
|
|
|
|
define a new command (See <<declaring-new-commands,Declaring new commands>>)
|
|
|
|
|
|
2016-02-03 20:15:35 +03:00
|
|
|
|
*alias* <scope> <name> <command>::
|
2019-01-23 04:34:02 +03:00
|
|
|
|
define a new alias named *name* in *scope*
|
2019-04-20 00:13:23 +03:00
|
|
|
|
(See <<aliases,Using aliases>> and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
|
|
|
|
*unalias* <scope> <name> [<command>]::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
remove an alias if its current value is the same as the one passed
|
|
|
|
|
as an optional parameter, remove it unconditionally otherwise
|
2019-04-20 00:13:23 +03:00
|
|
|
|
(See <<aliases,Using aliases>> and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*evaluate-commands* [<switches>] <command> ...::
|
2017-11-06 12:08:59 +03:00
|
|
|
|
*alias* eval +
|
|
|
|
|
evaluate commands, as if they were entered in the command prompt
|
|
|
|
|
(See <<execeval#,`:doc execeval`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*execute-keys* [<switches>] <key> ...::
|
2017-11-07 10:29:08 +03:00
|
|
|
|
*alias* exec +
|
|
|
|
|
execute a series of keys, as if they were hit (See <<execeval#,`:doc execeval`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*map* [<switches>] <scope> <mode> <key> <keys>::
|
2019-01-23 04:34:02 +03:00
|
|
|
|
bind a list of keys to a combination (See <<mapping#,`:doc mapping`>>
|
|
|
|
|
and <<scopes#,`:doc scopes`>>)
|
2017-03-06 01:47:16 +03:00
|
|
|
|
|
2016-09-19 11:10:41 +03:00
|
|
|
|
*unmap* <scope> <mode> <key> [<expected>]::
|
2019-01-23 04:34:02 +03:00
|
|
|
|
unbind a key combination (See <<mapping#,`:doc mapping`>>
|
|
|
|
|
and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-02 09:45:04 +03:00
|
|
|
|
*declare-user-mode* <name>::
|
|
|
|
|
declare a new user keymap mode
|
2018-01-18 11:57:14 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*enter-user-mode* [<switches>] <name>::
|
2018-01-18 11:57:14 +03:00
|
|
|
|
enable <name> keymap mode for next key
|
|
|
|
|
|
2018-02-25 18:16:25 +03:00
|
|
|
|
*-lock*:::
|
|
|
|
|
stay in mode until `<esc>` is pressed
|
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Hooks
|
|
|
|
|
|
2016-02-03 20:15:35 +03:00
|
|
|
|
*hook* [-group <group>] <scope> <hook_name> <filtering_regex> <command>::
|
2019-01-23 04:34:02 +03:00
|
|
|
|
execute *command* whenever an *hook_name* is triggered in *scope*
|
|
|
|
|
(See <<hooks#,`:doc hooks`>> and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-11-14 03:27:14 +03:00
|
|
|
|
*remove-hooks* <scope> <group>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* rmhooks +
|
|
|
|
|
remove every hooks in *scope* that are part of the given *group*
|
2019-01-23 04:34:02 +03:00
|
|
|
|
(See <<hooks#,`:doc hooks`>> and <<scopes#,`:doc scopes`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2020-07-04 06:48:10 +03:00
|
|
|
|
*trigger-user-hook* <param>::
|
|
|
|
|
trigger the `User` hook with the given *param* as filter string in
|
|
|
|
|
the current context. (See <<hooks#,`:doc hooks`>>)
|
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
== Display
|
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*echo* [<switches>] <text>::
|
|
|
|
|
show *text* in status line, with the following *switches*:
|
2017-11-07 10:29:08 +03:00
|
|
|
|
|
|
|
|
|
*-markup*:::
|
|
|
|
|
expand the markup strings in *text* (See
|
2018-09-25 09:41:53 +03:00
|
|
|
|
<<faces#markup-strings,`:doc faces markup-strings`>>)
|
2017-11-07 10:29:08 +03:00
|
|
|
|
|
|
|
|
|
*-debug*:::
|
|
|
|
|
print the given text to the *\*debug** buffer
|
|
|
|
|
|
2019-04-07 02:31:36 +03:00
|
|
|
|
*-to-file* <filename>:::
|
|
|
|
|
write the given text to the given file on the host
|
|
|
|
|
filesystem.
|
|
|
|
|
|
2019-06-23 02:58:31 +03:00
|
|
|
|
*-quoting* <quoting>:::
|
2020-05-28 19:37:26 +03:00
|
|
|
|
define how arguments are quoted in echo output:
|
2019-06-23 02:58:31 +03:00
|
|
|
|
|
|
|
|
|
- *raw* (default)::::
|
|
|
|
|
just join each argument with a space
|
|
|
|
|
|
|
|
|
|
- *kakoune*::::
|
|
|
|
|
also wrap each argument in single quotes, doubling-up
|
|
|
|
|
embedded quotes.
|
|
|
|
|
|
|
|
|
|
- *shell*::::
|
|
|
|
|
also wrap each arguments in single quotes and escape
|
|
|
|
|
embedded quotes in a shell compatible way.
|
|
|
|
|
|
2018-04-07 08:36:39 +03:00
|
|
|
|
*set-face* <scope> <name> <facespec>::
|
2017-11-07 10:29:08 +03:00
|
|
|
|
*alias* face +
|
2019-01-23 04:34:02 +03:00
|
|
|
|
define a face in *scope*
|
|
|
|
|
(See <<faces#,`:doc faces`>> and <<scopes#,`:doc scopes`>>)
|
2018-04-07 08:36:39 +03:00
|
|
|
|
|
|
|
|
|
*unset-face* <scope> <name>::
|
2019-01-23 04:34:02 +03:00
|
|
|
|
Remove a face definition from *scope*
|
|
|
|
|
(See <<faces#,`:doc faces`>> and <<scopes#,`:doc scopes`>>)
|
2017-11-07 10:29:08 +03:00
|
|
|
|
|
|
|
|
|
*colorscheme* <name>::
|
|
|
|
|
load named colorscheme
|
|
|
|
|
|
2020-03-30 13:03:51 +03:00
|
|
|
|
*add-highlighter* [<switches>] <highlighter_path> <highlighter_parameters> ...::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* addhl +
|
2017-11-06 12:08:59 +03:00
|
|
|
|
add a highlighter to the current window
|
|
|
|
|
(See <<highlighters#,`:doc highlighters`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2020-03-30 13:03:51 +03:00
|
|
|
|
*remove-highlighter* <highlighter_path>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* rmhl +
|
2017-11-06 12:08:59 +03:00
|
|
|
|
remove the highlighter whose id is *highlighter_id*
|
|
|
|
|
(See <<highlighters#,`:doc highlighters`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-11-02 05:03:24 +03:00
|
|
|
|
== Helpers
|
|
|
|
|
|
2016-02-11 00:03:49 +03:00
|
|
|
|
Kakoune provides some helper commands that can be used to define composite
|
2017-11-07 10:29:08 +03:00
|
|
|
|
commands in scripts. They are also available in the interactive mode,
|
|
|
|
|
but not really useful in that context.
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*prompt* [<switches>] <prompt> <command>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
prompt the user for a string, when the user validates, executes the
|
|
|
|
|
command. The entered text is available in the `text` value accessible
|
|
|
|
|
through `$kak_text` in shells or `%val{text}` in commands.
|
2016-11-27 23:57:04 +03:00
|
|
|
|
|
2017-11-02 12:37:39 +03:00
|
|
|
|
The *-init <str>* switch allows setting initial content, the
|
|
|
|
|
*-password* switch hides the entered text and clears the register
|
|
|
|
|
after command execution.
|
2016-11-27 23:57:04 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
The *-on-change* and *-on-abort* switches, followed by a command
|
|
|
|
|
will have this command executed whenever the prompt content changes
|
|
|
|
|
or the prompt is aborted, respectively.
|
2017-02-12 15:51:58 +03:00
|
|
|
|
|
2019-03-24 11:20:29 +03:00
|
|
|
|
Completion support can be controlled with the same switches provided
|
|
|
|
|
by the *define-command* command, see
|
|
|
|
|
<<declaring-new-commands,Declaring new commands>>.
|
|
|
|
|
|
2020-02-07 18:57:09 +03:00
|
|
|
|
For *-shell-script-completion* and *-shell-script-candidates*
|
2019-03-24 11:20:29 +03:00
|
|
|
|
completions, token_to_complete will always be 1, and the full
|
|
|
|
|
prompt content will be passed as a single token. In other words,
|
|
|
|
|
word splitting does not take place.
|
|
|
|
|
|
2018-12-11 06:18:05 +03:00
|
|
|
|
NOTE: The prompt is displayed in and receives input from the
|
|
|
|
|
current client context, so inside a draft context like
|
|
|
|
|
`evaluate-commands -draft`, it is invisible and only responds to
|
|
|
|
|
an `execute-keys` command in the same context.
|
|
|
|
|
|
2016-11-27 23:57:04 +03:00
|
|
|
|
*on-key* <command>::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
wait for next key from user, then execute <command>, the key is
|
|
|
|
|
available through the `key` value, accessible through `$kak_key`
|
|
|
|
|
in shells, or `%val{key}` in commands.
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-12-11 06:18:05 +03:00
|
|
|
|
NOTE: The key press must come from the current client context,
|
|
|
|
|
so inside a draft context like `evaluate-commands -draft`, it only
|
|
|
|
|
responds to an `execute-keys` command in the same context.
|
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*menu* [<switches>] <label1> <commands1> <label2> <commands2> ...::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
display a menu using labels, the selected label’s commands are
|
|
|
|
|
executed. The *menu* command 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 20:15:35 +03:00
|
|
|
|
|
2018-12-11 06:18:05 +03:00
|
|
|
|
NOTE: The menu is displayed in and receives input from the
|
|
|
|
|
current client context, so inside a draft context like
|
|
|
|
|
`evaluate-commands -draft`, it is invisible and only responds to
|
|
|
|
|
an `execute-keys` command in the same context.
|
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*info* [<switches>] <text>::
|
|
|
|
|
display text in an information box with the following *switches*:
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*-anchor* <line>.<column>:::
|
|
|
|
|
print the text at the given coordinates
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2019-04-17 09:31:06 +03:00
|
|
|
|
*-style* <style>:::
|
|
|
|
|
set the style and placement of the message box.
|
2019-04-15 18:22:48 +03:00
|
|
|
|
|
|
|
|
|
*menu*::::
|
|
|
|
|
display the info next to the displayed menu, as documentation
|
|
|
|
|
for the currently selected entry.
|
|
|
|
|
|
|
|
|
|
*above*::::
|
|
|
|
|
display the info above the given anchor
|
|
|
|
|
|
|
|
|
|
*below*::::
|
|
|
|
|
display the info below the given anchor
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2019-04-17 09:31:06 +03:00
|
|
|
|
*modal*::::
|
|
|
|
|
display the info modally, and do not auto-close the
|
|
|
|
|
info or replace it with non modal info boxes. To hide
|
|
|
|
|
a modal info box, use `info -style modal` with no
|
|
|
|
|
arguments.
|
|
|
|
|
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*-title* <text>:::
|
|
|
|
|
set the title of the message box
|
2020-02-24 11:41:51 +03:00
|
|
|
|
|
2019-11-22 13:48:26 +03:00
|
|
|
|
*-markup*:::
|
|
|
|
|
parse markup in both title (if provided) and text. (See
|
|
|
|
|
<<faces#markup-strings,`:doc faces markup-strings`>>)
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-12-11 06:18:05 +03:00
|
|
|
|
NOTE: The info box is displayed in the current client context,
|
|
|
|
|
so inside a draft context like `eval -draft`, it is invisible.
|
|
|
|
|
|
2018-05-19 07:03:32 +03:00
|
|
|
|
*try* <commands> [catch <on_error_commands>]...::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
prevent an error in *commands* from aborting the whole command
|
|
|
|
|
execution, execute *on_error_commands* instead. If nothing is to be
|
2018-05-19 07:03:32 +03:00
|
|
|
|
done on error, the catch part can be omitted. If an error is raised
|
|
|
|
|
in the *on_error_commands*, that error is propagated, except if
|
|
|
|
|
another *catch* and *on_error_commands* parameter follows, in which
|
2019-03-05 12:46:23 +03:00
|
|
|
|
case those commands get executed, and so-on. During error commands,
|
2019-03-05 13:07:49 +03:00
|
|
|
|
the description of the last raised error is available as `$kak_error`
|
2019-03-05 12:46:23 +03:00
|
|
|
|
in the shell, or `%val{error}` in commands.
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-11-07 10:29:08 +03:00
|
|
|
|
*nop*::
|
|
|
|
|
does nothing, but arguments will be evaluated (e.g. shell expansion)
|
|
|
|
|
|
|
|
|
|
*fail* <text>::
|
|
|
|
|
raise an error, uses <text> as its description
|
|
|
|
|
|
2018-06-03 07:16:19 +03:00
|
|
|
|
*set-register* <name> <contents>...::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
*alias* reg +
|
2018-06-03 07:16:19 +03:00
|
|
|
|
set register *name* to *content*, each content parameter is assigned to
|
|
|
|
|
a different string in the register. (See <<registers#,`:doc registers`>>)
|
2016-02-02 22:15:12 +03:00
|
|
|
|
|
2019-11-12 13:20:59 +03:00
|
|
|
|
*select* [<switches>] <anchor_line>.<anchor_column>,<cursor_line>.<cursor_column>...::
|
2018-05-31 14:14:21 +03:00
|
|
|
|
replace the current selections with the ones described in the arguments
|
2020-02-24 11:41:51 +03:00
|
|
|
|
|
2019-11-12 13:20:59 +03:00
|
|
|
|
*-timestamp* <timestamp>:::
|
|
|
|
|
specify which buffer timestamp those coordinates apply to. Uses current
|
|
|
|
|
buffer timestamp if not specified.
|
|
|
|
|
|
|
|
|
|
*-codepoint*::
|
|
|
|
|
provided columns are to be interpreted as codepoint counts, not byte counts.
|
2019-11-12 13:56:45 +03:00
|
|
|
|
|
|
|
|
|
*-display-column*::
|
|
|
|
|
provided columns are to be interpreted as display column counts, not byte counts.
|
|
|
|
|
|
|
|
|
|
both *-codepoint* and *-display-column* are only valid if *-timestamp*
|
|
|
|
|
matches the current buffer timestamp (or is not specified).
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2017-10-04 00:00:08 +03:00
|
|
|
|
*debug* {info,buffers,options,memory,shared-strings,profile-hash-maps,faces,mappings}::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
print some debug information in the *\*debug** buffer
|
2016-03-12 12:13:49 +03:00
|
|
|
|
|
2019-03-15 21:52:33 +03:00
|
|
|
|
== Module commands
|
|
|
|
|
|
|
|
|
|
*provide-module* [<switches>] <name> <commands>::
|
2019-03-16 11:09:42 +03:00
|
|
|
|
declares a module *name* that is defined by *commands*. *commands* will be
|
|
|
|
|
evaluated as if by source the first time *require-module <name>* is run.
|
|
|
|
|
|
|
|
|
|
*-override*:::
|
2019-04-15 22:53:45 +03:00
|
|
|
|
allow the module to replace an existing one with the same name. Fails if
|
|
|
|
|
the module has already been evaluated.
|
2019-03-15 21:52:33 +03:00
|
|
|
|
|
|
|
|
|
*require-module* <name>::
|
2019-03-16 11:09:42 +03:00
|
|
|
|
guarantees the commands associated with *name* have been evaluated before
|
|
|
|
|
continuing command execution. Fails if *name* has not been defined by a
|
|
|
|
|
*provide-module* command. Does nothing if the associated commands have
|
|
|
|
|
already been evaluated.
|
2019-03-15 21:52:33 +03:00
|
|
|
|
|
2017-11-02 05:03:24 +03:00
|
|
|
|
== Multiple commands
|
|
|
|
|
|
2016-02-11 00:03:49 +03: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
|
2019-10-29 00:18:55 +03:00
|
|
|
|
backslash (\;) to be considered as a literal semicolon argument.
|
|
|
|
|
|
|
|
|
|
To avoid trouble while writing `map` or `execute-keys` commands in scripts,
|
|
|
|
|
the alternative key namings `<semicolon>` and `<a-semicolon>` can be used.
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-11-02 05:03:24 +03:00
|
|
|
|
== Declaring new commands
|
|
|
|
|
|
2016-11-14 03:27:14 +03:00
|
|
|
|
New commands can be defined using the *define-command* command:
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2018-03-17 17:41:56 +03:00
|
|
|
|
*define-command* [<switches>] <command_name> <commands>::
|
|
|
|
|
*commands* is a string containing the commands to execute, and *switches*
|
2017-11-02 12:37:39 +03:00
|
|
|
|
can be any combination of the following parameters:
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-params* <num>:::
|
2017-11-02 12:37:39 +03: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 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-file-completion*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
try file completion on any parameter passed to this command
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-client-completion*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
try client name completion on any parameter passed to this command
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-buffer-completion*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
try buffer name completion on any parameter passed to this command
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2017-09-28 16:16:46 +03:00
|
|
|
|
*-command-completion*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
try command completion on any parameter passed to this command
|
2017-09-28 16:16:46 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-shell-completion*:::
|
2018-09-27 00:42:01 +03:00
|
|
|
|
try shell command completion on any parameter passed to this command
|
|
|
|
|
|
|
|
|
|
*-shell-script-completion*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
following string is a shell command which takes parameters as
|
2020-05-28 19:37:26 +03:00
|
|
|
|
positional params and outputs one completion candidate per line.
|
2017-11-02 12:37:39 +03:00
|
|
|
|
The provided shell command will run after each keypress
|
2017-09-28 16:16:46 +03:00
|
|
|
|
|
2020-05-28 19:37:26 +03:00
|
|
|
|
during the execution of the shell command, the following env vars are
|
2018-02-22 14:46:35 +03:00
|
|
|
|
available:
|
|
|
|
|
|
|
|
|
|
- *kak_token_to_complete*::::
|
|
|
|
|
Index of the token being completed in the command line.
|
|
|
|
|
|
|
|
|
|
- *kak_pos_in_token*::::
|
|
|
|
|
Position of the cursor inside the token being completed, in bytes
|
|
|
|
|
from token start.
|
|
|
|
|
|
2018-09-27 00:42:01 +03:00
|
|
|
|
*-shell-script-candidates*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
following string is a shell command which takes parameters as
|
2020-05-28 19:37:26 +03:00
|
|
|
|
positional params and outputs one completion candidate per line.
|
2017-11-02 12:37:39 +03:00
|
|
|
|
The provided shell command will run once at the beginning of each
|
|
|
|
|
completion session, candidates are cached and then used by kakoune
|
|
|
|
|
internal fuzzy engine
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2020-05-28 19:37:26 +03:00
|
|
|
|
during the execution of the shell command, the following env vars are
|
2018-02-22 14:46:35 +03:00
|
|
|
|
available:
|
|
|
|
|
|
|
|
|
|
- *kak_token_to_complete*::::
|
|
|
|
|
Index of the token being completed in the command line.
|
|
|
|
|
|
2018-05-19 03:54:24 +03:00
|
|
|
|
*-override*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
allow the new command to replace an existing one with the same name
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-hidden*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
do not show the command in command name completions
|
2016-02-03 20:15:35 +03:00
|
|
|
|
|
2016-03-12 12:13:49 +03:00
|
|
|
|
*-docstring*:::
|
2017-11-02 12:37:39 +03:00
|
|
|
|
define the documentation string for the command
|
2016-02-02 22:15:12 +03:00
|
|
|
|
|
2017-04-21 13:32:47 +03:00
|
|
|
|
Using shell expansion allows defining complex commands or accessing
|
|
|
|
|
Kakoune's state:
|
2016-02-02 22:15:12 +03:00
|
|
|
|
|
2016-02-03 20:15:35 +03:00
|
|
|
|
--------------------------------------------------------
|
|
|
|
|
def " print_selection %{ echo %sh{ ${kak_selection} } }"
|
|
|
|
|
--------------------------------------------------------
|
2019-04-20 00:13:23 +03:00
|
|
|
|
|
|
|
|
|
== Aliases
|
|
|
|
|
|
|
|
|
|
With `:alias`, commands can be given additional names.
|
|
|
|
|
As aliases are intended to be used interactively most of the time,
|
|
|
|
|
they are often short. For example `:reg` is an alias for `:set-register`.
|
|
|
|
|
|
|
|
|
|
They are scoped, so that an alias can refer to one command for a buffer,
|
|
|
|
|
and to another for another buffer. For instance `:next` could be an alias
|
|
|
|
|
for `grep-next-match` in a `*grep*` buffer while pointing to
|
|
|
|
|
`:make-next-error` in a `*make*` buffer.
|
|
|
|
|
|
|
|
|
|
The following command defines `<alias>` as an alias for `<command>`:
|
|
|
|
|
|
|
|
|
|
--------------------------------
|
|
|
|
|
:alias <scope> <alias> <command>
|
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
|
|
`<scope>` can be one of `global`, `buffer` or `window`.
|
|
|
|
|
|
|
|
|
|
-------------------------------------
|
|
|
|
|
:unalias <scope> <alias> [<expected>]
|
|
|
|
|
-------------------------------------
|
|
|
|
|
|
|
|
|
|
Will remove the given alias in the given scope. If `<expected>` is specified
|
|
|
|
|
the alias will only be removed if its current value is `<expected>`.
|
|
|
|
|
|