aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-07 06:43:08 +0800
committerGitHub <noreply@github.com>2024-03-07 06:43:08 +0800
commit6525832a8c4d44a8ebabba02a5ea1ce09b389a4f (patch)
tree9edf1b25fcf5b2e953319916f8b605c3af106b53 /src/nvim/eval.lua
parentae5095cac9b233cfb6785534de6f084c70dc6424 (diff)
downloadrneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.tar.gz
rneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.tar.bz2
rneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.zip
vim-patch:9.1.0155: can only get getregion() from current buffer (#27757)
Problem: can only call getregion() for current buffer Solution: Allow to retrieve selections from different buffers (Shougo Matsushita) closes: vim/vim#14131 https://github.com/vim/vim/commit/84bf6e658da51126bdd2e50af1f40cabd149343f Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r--src/nvim/eval.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 2984ce29c6..94c9af50d4 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -4359,11 +4359,13 @@ M.funcs = {
args = { 2, 3 },
base = 1,
desc = [=[
- 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:
@@ -4384,6 +4386,7 @@ M.funcs = {
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
@@ -4393,8 +4396,12 @@ M.funcs = {
- 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>