Expose the character under the cursor as $kak_cursor_char_value
Fixes #142
This commit is contained in:
parent
6fefe66415
commit
772f85b883
|
@ -805,6 +805,7 @@ Some of Kakoune state is available through environment variables:
|
|||
* `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_column`: column of the end of the main selection (in byte)
|
||||
* `kak_cursor_char_value`: unicode value of the codepoint under the cursor
|
||||
* `kak_cursor_char_column`: column of the end of the main selection (in character)
|
||||
* `kak_cursor_byte_offset`: offset of the main selection from the beginning of the buffer (in byte).
|
||||
* `kak_window_width`: width of the current kakoune window
|
||||
|
|
|
@ -100,6 +100,8 @@ informations about Kakoune's state:
|
|||
line of the end of the main selection
|
||||
*kak_cursor_column*::
|
||||
column of the end of the main selection (in byte)
|
||||
*kak_cursor_char_value*::
|
||||
unicode value of the codepoint under the cursor
|
||||
*kak_cursor_char_column*::
|
||||
column of the end of the main selection (in character)
|
||||
*kak_cursor_byte_offset*::
|
||||
|
|
|
@ -146,6 +146,12 @@ void register_env_vars()
|
|||
"cursor_column", false,
|
||||
[](StringView name, const Context& context) -> String
|
||||
{ return to_string(context.selections().main().cursor().column + 1); }
|
||||
}, {
|
||||
"cursor_char_value", false,
|
||||
[](StringView name, const Context& context) -> String
|
||||
{ auto coord = context.selections().main().cursor();
|
||||
auto& buffer = context.buffer();
|
||||
return to_string((size_t)utf8::codepoint(buffer.iterator_at(coord), buffer.end())); }
|
||||
}, {
|
||||
"cursor_char_column", false,
|
||||
[](StringView name, const Context& context) -> String
|
||||
|
|
Loading…
Reference in New Issue
Block a user