2017-11-02 03:03:24 +01:00
|
|
|
|
= Expansions
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
|
== Strings
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
|
|
\'strings'::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
uninterpreted strings, use a backslash (\') to escape the separator
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
"strings"::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
expanded strings, % strings (c.f. next section) contained are expended,
|
|
|
|
|
use a backslash (\\%) to escape the separator
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
%\{strings\}::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
these strings are very useful when entering commands
|
2018-06-03 22:23:17 +02:00
|
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
|
* the '{' and '}' delimiters are configurable, any non alphanumeric
|
2018-06-03 22:23:17 +02:00
|
|
|
|
character can be used
|
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
----------------------------------------------------------
|
2016-02-02 20:15:12 +01:00
|
|
|
|
e.g. %[string], %<string>, %(string), %~string~, %!string!
|
2016-02-03 18:15:35 +01:00
|
|
|
|
----------------------------------------------------------
|
2018-06-03 22:23:17 +02:00
|
|
|
|
|
2017-11-02 10:37:39 +01:00
|
|
|
|
* if the character following '%' is one of '{[(<', then the closing
|
2018-06-03 22:23:17 +02:00
|
|
|
|
one is the matching '}])>' and the delimiters are not escapable but
|
|
|
|
|
are nestable
|
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
-----------------------------------------------------------
|
|
|
|
|
e.g. %{ roger {}; } is a valid string, %{ marcel \} as well
|
|
|
|
|
-----------------------------------------------------------
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
|
== Typed expansions
|
2017-11-01 12:49:13 +01:00
|
|
|
|
|
|
|
|
|
%\{strings\} can have an expansion type between the *%* and the opening
|
|
|
|
|
character. They will be written *%<type>\{<content>\}*. They will be
|
|
|
|
|
expanded according to the given *<type>* using *<content>* as its
|
|
|
|
|
parameter:
|
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*sh*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
shell expansion, similar to posix shell '$(...)' construct (c.f. next
|
|
|
|
|
section)
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*reg*::
|
2018-06-03 06:46:44 +02:00
|
|
|
|
register expansion, will expand to the strings stored in the register
|
|
|
|
|
named by *<content>*. See <<registers#,`:doc registers`>>
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*opt*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
option expansion, will expand to the value of the option named by
|
2018-04-03 13:33:30 +02:00
|
|
|
|
*<content>*. See <<options#,`:doc options`>>
|
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*val*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
value expansion, will expand to the value of the environment variables
|
|
|
|
|
available to shell expansion. *<content>* shall be the name of that
|
|
|
|
|
variable without the *kak_* prefix.
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*arg*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
argument expansion, expand to the arguments of the current
|
|
|
|
|
command, *<content>* can be a number, or @ for all arguments
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
|
== Shell expansions
|
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
|
The '%sh{...}' expansion replaces its content with the output of the
|
|
|
|
|
shell commands in it. The following environment variables are used to pass
|
|
|
|
|
informations about Kakoune's state:
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_selection*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
content of the main selection
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_selections*::
|
2018-05-31 13:14:21 +02:00
|
|
|
|
quoted list of the contents of the selections.
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_selection_desc*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
range of the main selection, represented as anchor,cursor; anchor
|
|
|
|
|
and cursor are in this format: line.column
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_selections_desc*::
|
2018-05-31 13:14:21 +02:00
|
|
|
|
unquoted list range of the selections.
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_bufname*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
name of the current buffer
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_buffile*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
full path of the file or same as kak_bufname when there’s no
|
|
|
|
|
associated file
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_buflist*::
|
2018-05-31 13:14:21 +02:00
|
|
|
|
quoted list of the currently opened buffer names
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-06-06 14:29:06 +02:00
|
|
|
|
*kak_buf_line_count*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
the current buffer line count
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_timestamp*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
timestamp of the current buffer, the timestamp is an integer value
|
|
|
|
|
which is incremented each time the buffer is modified
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-09-04 16:41:27 +02:00
|
|
|
|
*kak_history_id*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
history id of the current buffer, the history id is an integer value
|
|
|
|
|
which is used to reference a specific buffer version in the undo tree
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_runtime*::
|
2018-01-20 01:19:23 +01:00
|
|
|
|
directory containing the kak support files, determined from kakoune's
|
|
|
|
|
binary location.
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2018-01-20 01:19:23 +01:00
|
|
|
|
*kak_config*::
|
|
|
|
|
directory containing the user configuration
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2018-04-09 09:04:51 +02:00
|
|
|
|
*kak_version*::
|
|
|
|
|
version of the current Kakoune server (git hash or release name)
|
|
|
|
|
|
2016-10-26 12:33:09 +02:00
|
|
|
|
*kak_count*::
|
2018-08-15 16:00:19 +02:00
|
|
|
|
count parameter passed to the command, defaults to 0 if no count given
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2018-02-22 21:47:34 +01:00
|
|
|
|
*kak_register*::
|
|
|
|
|
register parameter passed to the command
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_opt_<name>*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
value of option *name*
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_reg_<r>*::
|
2018-06-03 06:46:44 +02:00
|
|
|
|
quoted list of value of register *r*
|
|
|
|
|
|
|
|
|
|
*kak_main_reg_<r>*::
|
|
|
|
|
content of register *r* associated with the main selection.
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_session*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
name of the current session
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_client*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
name of the current client
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-08-28 08:12:15 +02:00
|
|
|
|
*kak_client_pid*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
process id of the current client
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-10-05 16:41:36 +02:00
|
|
|
|
*kak_client_list*::
|
2018-05-31 13:14:21 +02:00
|
|
|
|
unquoted list of the names of clients connected to the current session
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-01-06 20:43:20 +01:00
|
|
|
|
*kak_source*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
path of the file currently getting executed (through the source
|
|
|
|
|
command)
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-05-18 17:36:06 +02:00
|
|
|
|
*kak_modified*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
buffer has modifications not saved
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_cursor_line*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
line of the end of the main selection
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_cursor_column*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
column of the end of the main selection (in byte)
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-09-12 06:43:38 +02:00
|
|
|
|
*kak_cursor_char_value*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
unicode value of the codepoint under the cursor
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_cursor_char_column*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
column of the end of the main selection (in character)
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-06-06 14:29:06 +02:00
|
|
|
|
*kak_cursor_byte_offset*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
Offset of the main selection from the beginning of the buffer (in bytes).
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_window_width*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
width of the current kakoune window
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_window_height*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
height of the current kakoune window
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_hook_param*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
filtering text passed to the currently executing hook
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2017-03-30 12:29:06 +02:00
|
|
|
|
*kak_hook_param_capture_N*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
text captured by the hook filter regex capture N
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
|
*kak_client_env_<name>*::
|
2017-11-02 10:37:39 +01:00
|
|
|
|
value of the *name* variable in the client environment
|
|
|
|
|
(e.g. *$kak_client_env_SHELL* is the SHELL variable)
|
2018-04-03 13:33:30 +02:00
|
|
|
|
|
2018-03-02 07:45:04 +01:00
|
|
|
|
*kak_user_modes*::
|
2018-05-31 13:14:21 +02:00
|
|
|
|
unquoted list of user modes.
|
|
|
|
|
|
|
|
|
|
Quoted lists are separated by spaces, and each element is surrounded by
|
|
|
|
|
`'` with contained `'` doubled. Unquoted lists are simply separated by
|
|
|
|
|
spaces and is used for values that will not contain whitespaces.
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
|
Note that in order for Kakoune to pass a value in the environment, the
|
2018-01-23 05:59:46 +01:00
|
|
|
|
variable has to be spelled out within the body of the expansion.
|
|
|
|
|
|
|
|
|
|
Those environment variables are available in every context where
|
|
|
|
|
Kakoune use a shell command, such as the `|`, `!` or `$` normal
|
|
|
|
|
mode commands (See <<keys#,`:doc keys`>>).
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
|
== Markup strings
|
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
|
In certain contexts, Kakoune can take a markup string, which is a string
|
2017-05-11 20:42:09 +02:00
|
|
|
|
containing formatting informations. In these strings, the {facename}
|
2016-02-10 22:03:49 +01:00
|
|
|
|
syntax will enable the face facename until another face gets activated,
|
|
|
|
|
or the end of the string is reached.
|
|
|
|
|
|
|
|
|
|
Literal '{' characters shall be written '\{', and a literal backslash ('\')
|
2016-04-08 18:00:24 +02:00
|
|
|
|
that precedes a '{' character shall be escaped as well ('\\').
|