diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 13 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 13 |
2 files changed, 20 insertions, 6 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index a043121adf..87353ff5a6 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2919,11 +2919,13 @@ getreginfo([{regname}]) *getreginfo()* The returned Dictionary can be passed to |setreg()|. getregion({pos1}, {pos2} [, {opts}]) *getregion()* - Returns the list of strings from {pos1} to {pos2} in current + Returns the list of strings from {pos1} to {pos2} from a buffer. {pos1} and {pos2} must both be |List|s with four numbers. - See |getpos()| for the format of the list. + See |getpos()| for the format of the list. It's possible + to specify positions from a different buffer, but please + note the limitations at |getregion-notes| The optional argument {opts} is a Dict and supports the following items: @@ -2944,6 +2946,7 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* This function is useful to get text starting and ending in different columns, such as a |charwise-visual| selection. + *getregion-notes* Note that: - Order of {pos1} and {pos2} doesn't matter, it will always return content from the upper left position to the lower @@ -2953,8 +2956,12 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* - If the region is blockwise and it starts or ends in the middle of a multi-cell character, it is not included but its selected part is substituted with spaces. - - If {pos1} or {pos2} is not current in the buffer, an empty + - If {pos1} and {pos2} are not in the same buffer, an empty list is returned. + - {pos1} and {pos2} must belong to a |bufloaded()| buffer. + - It is evaluated in current window context, this makes a + different if a buffer is displayed in a different window and + 'virtualedit' or 'list' is set Examples: > :xnoremap <CR> diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index ff95edddf6..3c72d8be1d 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3525,11 +3525,13 @@ function vim.fn.getreg(regname, list) end --- @return table function vim.fn.getreginfo(regname) end ---- Returns the list of strings from {pos1} to {pos2} in current +--- Returns the list of strings from {pos1} to {pos2} from a --- buffer. --- --- {pos1} and {pos2} must both be |List|s with four numbers. ---- See |getpos()| for the format of the list. +--- See |getpos()| for the format of the list. It's possible +--- to specify positions from a different buffer, but please +--- note the limitations at |getregion-notes| --- --- The optional argument {opts} is a Dict and supports the --- following items: @@ -3550,6 +3552,7 @@ function vim.fn.getreginfo(regname) end --- This function is useful to get text starting and ending in --- different columns, such as a |charwise-visual| selection. --- +--- *getregion-notes* --- Note that: --- - Order of {pos1} and {pos2} doesn't matter, it will always --- return content from the upper left position to the lower @@ -3559,8 +3562,12 @@ function vim.fn.getreginfo(regname) end --- - If the region is blockwise and it starts or ends in the --- middle of a multi-cell character, it is not included but --- its selected part is substituted with spaces. ---- - If {pos1} or {pos2} is not current in the buffer, an empty +--- - If {pos1} and {pos2} are not in the same buffer, an empty --- list is returned. +--- - {pos1} and {pos2} must belong to a |bufloaded()| buffer. +--- - It is evaluated in current window context, this makes a +--- different if a buffer is displayed in a different window and +--- 'virtualedit' or 'list' is set --- --- Examples: > --- :xnoremap <CR> |