aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_meta/vimfn.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/_meta/vimfn.lua')
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua57
1 files changed, 34 insertions, 23 deletions
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index be89c7dd01..da251f89ad 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -3185,7 +3185,7 @@ function vim.fn.getjumplist(winnr, tabnr) end
--- <To get lines from another buffer see |getbufline()| and
--- |getbufoneline()|
---
---- @param lnum integer
+--- @param lnum integer|string
--- @param end_? nil|false
--- @return string
function vim.fn.getline(lnum, end_) end
@@ -3525,43 +3525,49 @@ 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:
---
---- type Specify the selection type
+--- type Specify the region's selection type
--- (default: "v"):
--- "v" for |charwise| mode
--- "V" for |linewise| mode
--- "<CTRL-V>" for |blockwise-visual| mode
---
--- exclusive If |TRUE|, use exclusive selection
---- for the end position 'selection'.
+--- for the end position
+--- (default: follow 'selection')
---
--- You can get the last selection type by |visualmode()|.
--- If Visual mode is active, use |mode()| to get the Visual mode
--- (e.g., in a |:vmap|).
---- This function uses the line and column number from the
---- specified position.
---- It is useful to get text starting and ending in different
---- columns, such as |charwise-visual| selection.
+--- 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
--- right position.
---- - If 'virtualedit' is enabled and selection is past the end of
---- line, resulting lines are filled with blanks.
---- - If the selection starts or ends in the middle of a multibyte
---- 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 'virtualedit' is enabled and the region is past the end
+--- of the lines, resulting lines are padded with spaces.
+--- - 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} 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, which makes a
+--- difference if the buffer is displayed in a window with
+--- different 'virtualedit' or 'list' values.
---
--- Examples: >
--- :xnoremap <CR>
@@ -4246,7 +4252,7 @@ function vim.fn.id(expr) end
--- |getline()|.
--- When {lnum} is invalid -1 is returned.
---
---- @param lnum integer
+--- @param lnum integer|string
--- @return integer
function vim.fn.indent(lnum) end
@@ -6514,6 +6520,9 @@ function vim.fn.prevnonblank(lnum) end
--- echo printf("%1$*2$.*3$f", 1.4142135, 6, 2)
--- < 1.41
---
+--- You will get an overflow error |E1510|, when the field-width
+--- or precision will result in a string longer than 6400 chars.
+---
--- *E1500*
--- You cannot mix positional and non-positional arguments: >vim
--- echo printf("%s%1$s", "One", "Two")
@@ -7253,6 +7262,7 @@ function vim.fn.screenstring(row, col) end
--- When a match has been found its line number is returned.
--- If there is no match a 0 is returned and the cursor doesn't
--- move. No error message is given.
+--- To get the matched string, use |matchbufline()|.
---
--- {flags} is a String, which can contain these character flags:
--- 'b' search Backward instead of forward
@@ -10585,17 +10595,16 @@ function vim.fn.win_move_statusline(nr, offset) end
--- [1, 1], unless there is a tabline, then it is [2, 1].
--- {nr} can be the window number or the |window-ID|. Use zero
--- for the current window.
---- Returns [0, 0] if the window cannot be found in the current
---- tabpage.
+--- Returns [0, 0] if the window cannot be found.
---
--- @param nr integer
--- @return any
function vim.fn.win_screenpos(nr) end
---- Move the window {nr} to a new split of the window {target}.
---- This is similar to moving to {target}, creating a new window
---- using |:split| but having the same contents as window {nr}, and
---- then closing {nr}.
+--- Temporarily switch to window {target}, then move window {nr}
+--- to a new split adjacent to {target}.
+--- Unlike commands such as |:split|, no new windows are created
+--- (the |window-ID| of window {nr} is unchanged after the move).
---
--- Both {nr} and {target} can be window numbers or |window-ID|s.
--- Both must be in the current tab page.
@@ -10718,7 +10727,9 @@ function vim.fn.winline() end
--- # the number of the last accessed window (where
--- |CTRL-W_p| goes to). If there is no previous
--- window or it is in another tab page 0 is
---- returned.
+--- returned. May refer to the current window in
+--- some cases (e.g. when evaluating 'statusline'
+--- expressions).
--- {N}j the number of the Nth window below the
--- current window (where |CTRL-W_j| goes to).
--- {N}k the number of the Nth window above the current