diff --git a/README.asciidoc b/README.asciidoc index 8f01a692..89e13312 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -813,8 +813,9 @@ Some of Kakoune state is available through environment variables: * `kak_opt_`: value of option * `kak_reg_`: value of register * `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 diff --git a/doc/manpages/expansions.asciidoc b/doc/manpages/expansions.asciidoc index 9b48f64c..d213429f 100644 --- a/doc/manpages/expansions.asciidoc +++ b/doc/manpages/expansions.asciidoc @@ -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) diff --git a/src/main.cc b/src/main.cc index c69c72a3..2d7f8307 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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& c) -> const String& + { return c->context().name(); }), ':'); } }, { "modified", false, [](StringView name, const Context& context) -> String