Merge remote-tracking branch 'Delapouite/client_list'

This commit is contained in:
Maxime Coste 2017-10-06 13:53:55 +08:00
commit cbb6e9ea0f
3 changed files with 12 additions and 3 deletions

View File

@ -813,8 +813,9 @@ Some of Kakoune state is available through environment variables:
* `kak_opt_<name>`: value of option <name>
* `kak_reg_<r>`: value of register <r>
* `kak_session`: name of the current session
* `kak_client`: name of current client
* `kak_client`: name of the current client
* `kak_client_pid`: pid of the current client
* `kak_client_list`: list of clients connected to the current session
* `kak_modified`: buffer has modifications not saved
* `kak_source`: path of the file currently getting executed (through the source command)
* `kak_cursor_line`: line of the end of the main selection

View File

@ -88,9 +88,11 @@ informations about Kakoune's state:
*kak_session*::
name of the current session
*kak_client*::
name of current client
name of the current client
*kak_client_pid*::
process id of current client
process id of the current client
*kak_client_list*::
list of clients connected to the current session
*kak_source*::
path of the file currently getting executed (through the source
command)

View File

@ -135,6 +135,12 @@ void register_env_vars()
"client_pid", false,
[](StringView name, const Context& context) -> String
{ return to_string(context.client().pid()); }
}, {
"client_list", false,
[](StringView name, const Context& context) -> String
{ return join(ClientManager::instance() |
transform([](const std::unique_ptr<Client>& c) -> const String&
{ return c->context().name(); }), ':'); }
}, {
"modified", false,
[](StringView name, const Context& context) -> String