Document $kak_quoted_...
This commit is contained in:
parent
c9858bb6d1
commit
95da8cbc8f
|
@ -31,6 +31,9 @@ released versions.
|
||||||
* Added a new hook `ModuleLoad` which is run when a module is loaded,
|
* Added a new hook `ModuleLoad` which is run when a module is loaded,
|
||||||
allowing for module specific configuration.
|
allowing for module specific configuration.
|
||||||
|
|
||||||
|
* Shell quoting of lists is not automatic anymore, `$kak_quoted_...`
|
||||||
|
makes it opt-in, and works for all option types.
|
||||||
|
|
||||||
== Kakoune 2019.01.20
|
== Kakoune 2019.01.20
|
||||||
|
|
||||||
* `auto_complete` has been renamed to `autocomplete` for more
|
* `auto_complete` has been renamed to `autocomplete` for more
|
||||||
|
|
|
@ -128,24 +128,23 @@ Here's how expansion patterns map to variable names:
|
||||||
*%val{x}*::
|
*%val{x}*::
|
||||||
becomes `$kak_x`
|
becomes `$kak_x`
|
||||||
|
|
||||||
When turned into environment variables, list-type options, `$kak_reg_x`, and
|
Values can be quoted with a shell compatible quoting by using `$kak_quoted_`
|
||||||
"quoted list" values will be shell-quoted so the shell doesn't get confused
|
as a prefix, this is mostly useful for list-type options and registers, as
|
||||||
about how many items the list contains. You will need to apply `eval` to get
|
it allows to correctly work with lists where elements might contains
|
||||||
back the original values. For example, if you want to process the contents
|
whitespaces:
|
||||||
of each selection, you can do something like:
|
|
||||||
|
|
||||||
----
|
----
|
||||||
eval set -- "$kak_selections"
|
eval set -- "$kak_quoted_selections"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
# ... do a thing with $1 ...
|
# ... do a thing with $1 ...
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
----
|
----
|
||||||
|
|
||||||
The `eval` command will take the expanded `$kak_selections` and unquote them,
|
The `eval` command will take the expanded `$kak_quoted_selections`
|
||||||
then execute the resulting `set` command, which sets the shell's argument
|
and unquote them, then execute the resulting `set` command, which sets
|
||||||
variables to the items from `$kak_selections`. The `while` loop with `shift`
|
the shell's argument variables to the items from `$kak_selections`. The
|
||||||
iterates through the arguments one by one.
|
`while` loop with `shift` iterates through the arguments one by one.
|
||||||
|
|
||||||
Only variables actually mentioned in the body of the shell expansion will
|
Only variables actually mentioned in the body of the shell expansion will
|
||||||
be exported into the shell's environment. For example:
|
be exported into the shell's environment. For example:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user