mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-15 09:17:22 +03:00
Expose buffer list to shell over $kak_buflist
This commit is contained in:
parent
1b14cd1cfe
commit
9f81093411
@ -911,6 +911,7 @@ Some of Kakoune state is available through environment variables:
|
||||
* +kak_selections+: content of the selection separated by colons, colons in
|
||||
the selection contents are escapted with a backslash.
|
||||
* +kak_bufname+: name of the current buffer
|
||||
* +kak_buflist+: the current buffer list, each buffer seperated by a colon
|
||||
* +kak_timestamp+: timestamp of the current buffer, the timestamp is an
|
||||
integer value which is incremented each time the buffer is modified.
|
||||
* +kak_runtime+: directory containing the kak binary
|
||||
|
11
src/main.cc
11
src/main.cc
@ -56,6 +56,17 @@ void register_env_vars()
|
||||
"buffile",
|
||||
[](StringView name, const Context& context) -> String
|
||||
{ return context.buffer().name(); }
|
||||
}, {
|
||||
"buflist",
|
||||
[](StringView name, const Context& context)
|
||||
{
|
||||
String res;
|
||||
for (auto& buf : BufferManager::instance())
|
||||
{
|
||||
res += buf->display_name() + ":";
|
||||
}
|
||||
res.pop_back();
|
||||
return res; }
|
||||
}, {
|
||||
"timestamp",
|
||||
[](StringView name, const Context& context)
|
||||
|
Loading…
Reference in New Issue
Block a user