diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2022-02-22 13:19:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 20:19:21 +0000 |
commit | 11f7aeed7aa83d342d19897d9a69ba9f32ece7f7 (patch) | |
tree | 8dc8f25f2e3979203e1b109a5aecb0e820f04850 /runtime | |
parent | 30c9c8815b531e0130ebeb9358bc6d3947a6128a (diff) | |
download | rneovim-11f7aeed7aa83d342d19897d9a69ba9f32ece7f7.tar.gz rneovim-11f7aeed7aa83d342d19897d9a69ba9f32ece7f7.tar.bz2 rneovim-11f7aeed7aa83d342d19897d9a69ba9f32ece7f7.zip |
feat(api): implement nvim_buf_get_text (#15181)
nvim_buf_get_text is the mirror of nvim_buf_set_text. It differs from
nvim_buf_get_lines in that it allows retrieving only portions of lines.
While this can typically be done easily enough by API clients,
implementing this function provides symmetry between the get/set
text/lines APIs, and also provides a nice convenience that saves API
clients the work of having to slice the result of nvim_buf_get_lines
themselves.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 1e1534c31f..de7db3b0b7 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2152,6 +2152,29 @@ nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()* Return: ~ Option value + *nvim_buf_get_text()* +nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col}, + {opts}) + Gets a range from the buffer. + + This differs from |nvim_buf_get_lines()| in that it allows + retrieving only portions of a line. + + Indexing is zero-based. Column indices are end-exclusive. + + Prefer |nvim_buf_get_lines()| when retrieving entire lines. + + Parameters: ~ + {buffer} Buffer handle, or 0 for current buffer + {start_row} First line index + {start_col} Starting byte offset of first line + {end_row} Last line index + {end_col} Ending byte offset of last line (exclusive) + {opts} Optional parameters. Currently unused. + + Return: ~ + Array of lines, or empty array for unloaded buffer. + nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()* Gets a buffer-scoped (b:) variable. |