Add a %val{selection_count} expansion
This commit is contained in:
parent
dcdafdea77
commit
84379f4466
|
@ -373,6 +373,10 @@ The following expansions are supported (with required context _in italics_):
|
||||||
_in window scope_ +
|
_in window scope_ +
|
||||||
unquoted list of the lengths (in codepoints) of the selections
|
unquoted list of the lengths (in codepoints) of the selections
|
||||||
|
|
||||||
|
*%val{selection_count}*::
|
||||||
|
_in window scope_ +
|
||||||
|
the number of selections
|
||||||
|
|
||||||
*%val{session}*::
|
*%val{session}*::
|
||||||
name of the current session
|
name of the current session
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,10 @@ static const EnvVarDesc builtin_env_vars[] = { {
|
||||||
transform([&](const Selection& s) -> String {
|
transform([&](const Selection& s) -> String {
|
||||||
return to_string(char_length(context.buffer(), s));
|
return to_string(char_length(context.buffer(), s));
|
||||||
}) | gather<Vector<String>>(); }
|
}) | gather<Vector<String>>(); }
|
||||||
|
}, {
|
||||||
|
"selection_count", false,
|
||||||
|
[](StringView name, const Context& context) -> Vector<String>
|
||||||
|
{ return {to_string(context.selections().size())}; }
|
||||||
}, {
|
}, {
|
||||||
"window_width", false,
|
"window_width", false,
|
||||||
[](StringView name, const Context& context) -> Vector<String>
|
[](StringView name, const Context& context) -> Vector<String>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user