From d03858280aa00676dbb47a0912b3fbf0516172d0 Mon Sep 17 00:00:00 2001 From: Delapouite Date: Thu, 5 Oct 2017 16:41:36 +0200 Subject: [PATCH] Add client_list var --- README.asciidoc | 3 ++- doc/manpages/expansions.asciidoc | 6 ++++-- src/main.cc | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) 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