1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

Expose kak_buf_line_count

This commit is contained in:
Delapouite 2017-06-06 14:29:06 +02:00
parent 73ecbdbc97
commit 09daaa8b3a
3 changed files with 8 additions and 1 deletions

View File

@ -780,6 +780,7 @@ Some of Kakoune state is available through environment variables:
* `kak_buffile`: full path of the file or same as `kak_bufname` when
there's no associated file
* `kak_buflist`: the current buffer list, each buffer separated by a colon
* `kak_buf_line_count`: the current buffer line count
* `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

View File

@ -69,6 +69,8 @@ informations about Kakoune's state:
associated file
*kak_buflist*::
the current buffer list, each buffer separated by a colon
*kak_buf_line_count*::
the current buffer line count
*kak_timestamp*::
timestamp of the current buffer, the timestamp is an integer value
which is incremented each time the buffer is modified
@ -95,7 +97,7 @@ informations about Kakoune's state:
column of the end of the main selection (in byte)
*kak_cursor_char_column*::
column of the end of the main selection (in character)
*kak_cursor_byte_offset*::
*kak_cursor_byte_offset*::
Offset of the main selection from the beginning of the buffer (in bytes).
*kak_window_width*::
width of the current kakoune window

View File

@ -93,6 +93,10 @@ void register_env_vars()
[](StringView name, const Context& context)
{ return join(BufferManager::instance() |
transform(std::mem_fn(&Buffer::display_name)), ':'); }
}, {
"buf_line_count", false,
[](StringView name, const Context& context) -> String
{ return to_string(context.buffer().line_count()); }
}, {
"timestamp", false,
[](StringView name, const Context& context) -> String