Merge remote-tracking branch 'danr/Add-modified-value-if-buffer-has-modifications-not-saved'

This commit is contained in:
Maxime Coste 2017-05-21 06:43:19 +01:00
commit df4eadd2f5
3 changed files with 7 additions and 0 deletions

View File

@ -788,6 +788,7 @@ Some of Kakoune state is available through environment variables:
* `kak_reg_<r>`: value of register <r> * `kak_reg_<r>`: value of register <r>
* `kak_session`: name of the current session * `kak_session`: name of the current session
* `kak_client`: name of current client * `kak_client`: name of current client
* `kak_modified`: buffer has modifications not saved
* `kak_source`: path of the file currently getting executed (through the source command) * `kak_source`: path of the file currently getting executed (through the source command)
* `kak_cursor_line`: line of the end of the main selection * `kak_cursor_line`: line of the end of the main selection
* `kak_cursor_column`: column of the end of the main selection (in byte) * `kak_cursor_column`: column of the end of the main selection (in byte)

View File

@ -87,6 +87,8 @@ informations about Kakoune's state:
*kak_source*:: *kak_source*::
path of the file currently getting executed (through the source path of the file currently getting executed (through the source
command) command)
*kak_modified*::
buffer has modifications not saved
*kak_cursor_line*:: *kak_cursor_line*::
line of the end of the main selection line of the end of the main selection
*kak_cursor_column*:: *kak_cursor_column*::

View File

@ -127,6 +127,10 @@ void register_env_vars()
"client", false, "client", false,
[](StringView name, const Context& context) -> String [](StringView name, const Context& context) -> String
{ return context.name(); } { return context.name(); }
}, {
"modified", false,
[](StringView name, const Context& context) -> String
{ return context.buffer().is_modified() ? "true" : "false"; }
}, { }, {
"cursor_line", false, "cursor_line", false,
[](StringView name, const Context& context) -> String [](StringView name, const Context& context) -> String