Merge remote-tracking branch 'Franciman/exposed_history_id'

This commit is contained in:
Maxime Coste 2017-09-06 11:55:00 +08:00
commit 8e3e5b10c1
3 changed files with 9 additions and 0 deletions

View File

@ -792,6 +792,8 @@ Some of Kakoune state is available through environment variables:
* `kak_buf_line_count`: the current buffer line count * `kak_buf_line_count`: the current buffer line count
* `kak_timestamp`: timestamp of the current buffer, the timestamp is an * `kak_timestamp`: timestamp of the current buffer, the timestamp is an
integer value which is incremented each time the buffer is modified. integer value which is incremented each time the buffer is modified.
* `kak_history_id`: history id of the current buffer, the history id is an integer value
which is used to reference a specific buffer version in the undo tree
* `kak_runtime`: directory containing the kak binary * `kak_runtime`: directory containing the kak binary
* `kak_count`: count parameter passed to the command * `kak_count`: count parameter passed to the command
* `kak_opt_<name>`: value of option <name> * `kak_opt_<name>`: value of option <name>

View File

@ -74,6 +74,9 @@ informations about Kakoune's state:
*kak_timestamp*:: *kak_timestamp*::
timestamp of the current buffer, the timestamp is an integer value timestamp of the current buffer, the timestamp is an integer value
which is incremented each time the buffer is modified which is incremented each time the buffer is modified
*kak_history_id*::
history id of the current buffer, the history id is an integer value
which is used to reference a specific buffer version in the undo tree
*kak_runtime*:: *kak_runtime*::
directory containing the kak binary directory containing the kak binary
*kak_count*:: *kak_count*::

View File

@ -93,6 +93,10 @@ void register_env_vars()
"timestamp", false, "timestamp", false,
[](StringView name, const Context& context) -> String [](StringView name, const Context& context) -> String
{ return to_string(context.buffer().timestamp()); } { return to_string(context.buffer().timestamp()); }
}, {
"history_id", false,
[](StringView name, const Context& context) -> String
{ return to_string(context.buffer().current_history_id()); }
}, { }, {
"selection", false, "selection", false,
[](StringView name, const Context& context) [](StringView name, const Context& context)