backport: docs: misc, window (#39722)

- formalize `window-number` similar to `tabpage-number`.
- reference it from docs.
This commit is contained in:
Justin M. Keyes
2026-05-11 17:06:59 -04:00
committed by GitHub
parent 5b8268356a
commit 25b522a75d
12 changed files with 227 additions and 210 deletions

View File

@@ -461,11 +461,11 @@ do
vim.keymap.set({ 'x' }, '[N', function()
require 'vim.treesitter._select'.select_grow_prev(vim.v.count1)
end, { desc = 'Select expand previous node' })
end, { desc = 'Select previous sibling node' })
vim.keymap.set({ 'x' }, ']N', function()
require 'vim.treesitter._select'.select_grow_next(vim.v.count1)
end, { desc = 'Select expand next node' })
end, { desc = 'Select next sibling node' })
vim.keymap.set({ 'x', 'o' }, 'an', function()
if vim.treesitter.get_parser(nil, nil, { error = false }) then
@@ -995,7 +995,7 @@ do
and os.getenv('NVIM_TEST') == nil
then
vim.notify(
"defaults.lua: Did not detect DSR response from terminal for 'background' detection. This results in a slower startup time. To disable this and other 'ttyfast' features during startup, set the environment variable NVIM_NOTTYFAST",
"E1568: Terminal did not respond to DSR request for 'background' color. Startup may be slower. :help 'ttyfast'",
vim.log.levels.WARN,
{ _truncate = true }
)

View File

@@ -6808,7 +6808,7 @@ vim.wo.stc = vim.wo.statuscolumn
--- added without modifying code that reacts on mouse clicks on
--- this label.
--- Use `getmousepos()`.winid in the specified function to get the
--- corresponding window id of the clicked item.
--- corresponding `window-ID` of the clicked item.
--- \< - Where to truncate line if too long. Default is at the start.
--- No width fields allowed.
--- = - Separation point between alignment sections. Each section will
@@ -7517,12 +7517,20 @@ vim.o.ttm = vim.o.ttimeoutlen
vim.go.ttimeoutlen = vim.o.ttimeoutlen
vim.go.ttm = vim.go.ttimeoutlen
--- Assume that the underlying terminal can respond quickly to queries
--- required by features such as 'background' detection.
--- Enables Nvim `TUI` features which assume a fast (usually local) host
--- terminal. During startup, Nvim queries the terminal (for 'background'
--- detection, etc.) and must wait for a response (or timeout).
---
--- Nvim issues terminal queries before reading the user's `config` file,
--- so disabling this option there will not work. Set $NVIM_NOTTYFAST
--- before starting Nvim to disable terminal queries.
--- If your terminal environment is slow (e.g. remote SSH), or broken
--- (doesn't respond to queries), Nvim startup may be slower. Therefore
--- you can disable this option by setting the `$NVIM_NOTTYFAST`
--- environment variable before starting Nvim:
--- ```
--- NVIM_NOTTYFAST=1 nvim
--- ```
---
--- The queries are performed early, before `--cmd` and user `config`, so
--- `:set nottyfast` in your config happens too late.
---
--- @type boolean
vim.o.ttyfast = true

View File

@@ -122,8 +122,8 @@ function vim.fn.appendbufline(buf, lnum, text) end
--- If {winid} is not supplied, the argument list of the current
--- window is used.
--- If {winid} is -1, the global argument list is used.
--- Otherwise {winid} specifies the window of which the argument
--- list is used: either the window number or the window ID.
--- Otherwise {winid} (a |window-number| or |window-ID|) specifies
--- the window of which the argument list is used.
--- Returns -1 if the {winid} argument is invalid.
---
--- @param winid? integer
@@ -145,7 +145,7 @@ function vim.fn.argidx() end
--- With {winnr} only use this window in the current tabpage.
--- With {winnr} and {tabnr} use the window in the specified tab
--- page.
--- {winnr} can be the window number or the |window-ID|.
--- {winnr} is a |window-number| or |window-ID|.
---
--- @param winnr? integer
--- @param tabnr? integer
@@ -163,7 +163,7 @@ function vim.fn.arglistid(winnr, tabnr) end
--- <Without the {nr} argument, or when {nr} is -1, a |List| with
--- the whole |arglist| is returned.
---
--- The {winid} argument specifies the window ID, see |argc()|.
--- The {winid} argument is a |window-ID|, see |argc()|.
--- For the Vim command line arguments see |v:argv|.
---
--- Returns an empty string if {nr}th argument is not present in
@@ -633,7 +633,7 @@ function vim.fn.bufnr(buf, create) end
--- @return integer
function vim.fn.bufwinid(buf) end
--- Like |bufwinid()| but return the window number instead of the
--- Like |bufwinid()| but returns a |window-number| instead of a
--- |window-ID|.
--- If buffer {buf} doesn't exist or there is no such window, -1
--- is returned. Example: >vim
@@ -930,8 +930,8 @@ function vim.fn.cindent(lnum) end
--- Clears all matches previously defined for the current window
--- by |matchadd()| and the |:match| commands.
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window.
--- If {win} is specified, use this |window-number| or |window-ID|
--- instead of the current window.
---
--- @param win? integer
function vim.fn.clearmatches(win) end
@@ -3165,10 +3165,10 @@ function vim.fn.getcompletiontype(pat) end
--- the cursor is returned in "col". To get the character
--- position, use |getcursorcharpos()|.
---
--- The optional {winid} argument can specify the window. It can
--- be the window number or the |window-ID|. The last known
--- cursor position is returned, this may be invalid for the
--- current value of the buffer if it is not the current window.
--- The optional {winid} (|window-number| or |window-ID|) specifies
--- the window. The last known cursor position is returned, this
--- may be invalid for the current value of the buffer if it is not
--- the current window.
--- If {winid} is invalid a list with zeroes is returned.
---
--- This can be used to save and restore the cursor position: >vim
@@ -3204,7 +3204,7 @@ function vim.fn.getcursorcharpos(winid) end
--- getcwd(0)
--- getcwd(0, 0)
--- <If {winnr} is -1 it is ignored, only the tab is resolved.
--- {winnr} can be the window number or the |window-ID|.
--- {winnr} is a |window-number| or |window-ID|.
--- If both {winnr} and {tabnr} are -1 the global working
--- directory is returned.
--- Note: When {tabnr} is -1 Vim returns an empty string to
@@ -3310,8 +3310,8 @@ function vim.fn.getftype(fname) end
--- Returns the |jumplist| for the specified window.
---
--- Without arguments use the current window.
--- With {winnr} only use this window in the current tabpage.
--- {winnr} can also be a |window-ID|.
--- With {winnr} (|window-number| or |window-ID|) only use this
--- window in the current tabpage.
--- With {winnr} and {tabnr} use the window in the specified tab
--- page. If {winnr} or {tabnr} is invalid, an empty list is
--- returned.
@@ -3366,12 +3366,12 @@ function vim.fn.getline(lnum, end_) end
function vim.fn.getline(lnum, end_) end
--- Returns a |List| with all the entries in the location list for
--- window {nr}. {nr} can be the window number or the |window-ID|.
--- window {nr} (|window-number| or |window-ID|).
--- When {nr} is zero the current window is used.
---
--- For a location list window, the displayed location list is
--- returned. For an invalid window number {nr}, an empty list is
--- returned. Otherwise, same as |getqflist()|.
--- returned. For an invalid {nr}, an empty list is returned.
--- Otherwise, same as |getqflist()|.
---
--- If the optional {what} dictionary argument is supplied, then
--- returns the items listed in {what} as a dictionary. Refer to
@@ -3428,9 +3428,9 @@ function vim.fn.getmarklist(buf) end
--- |getmatches()| is useful in combination with |setmatches()|,
--- as |setmatches()| can restore a list of matches saved by
--- |getmatches()|.
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window. If {win} is invalid,
--- an empty list is returned.
--- If {win} is specified, use this |window-number| or |window-ID|
--- instead of the current window. If {win} is invalid, an empty
--- list is returned.
--- Example: >vim
--- echo getmatches()
--- < >
@@ -3943,7 +3943,7 @@ function vim.fn.gettabvar(tabnr, varname, def) end
--- Note that {varname} must be the name without "w:".
--- Tabs are numbered starting with one. For the current tabpage
--- use |getwinvar()|.
--- {winnr} can be the window number or the |window-ID|.
--- {winnr} is a |window-number| or |window-ID|.
--- When {winnr} is zero the current window is used.
--- This also works for a global option, buffer-local option and
--- window-local option, but it doesn't work for a global variable
@@ -3965,8 +3965,8 @@ function vim.fn.gettabvar(tabnr, varname, def) end
--- @return any
function vim.fn.gettabwinvar(tabnr, winnr, varname, def) end
--- Returns the tag stack of window {winnr} as a Dict.
--- {winnr} can be the window number or the |window-ID|.
--- Returns the tag stack of window {winnr} (|window-number| or
--- |window-ID|) as a Dict.
--- When {winnr} is not specified, the current window is used.
--- When window {winnr} doesn't exist, an empty Dict is returned.
---
@@ -4042,7 +4042,7 @@ function vim.fn.gettext(text) end
--- wincol leftmost screen column of the window;
--- "col" from |win_screenpos()|
--- winid |window-ID|
--- winnr window number
--- winnr |window-number|
--- winrow topmost screen line of the window;
--- "row" from |win_screenpos()|
---
@@ -4300,7 +4300,7 @@ function vim.fn.has_key(dict, key) end
--- echo haslocaldir(0, 0)
--- <With {winnr} use that window in the current tabpage.
--- With {winnr} and {tabnr} use the window in that tabpage.
--- {winnr} can be the window number or the |window-ID|.
--- {winnr} is a |window-number| or |window-ID|.
--- If {winnr} is -1 it is ignored, only the tab is resolved.
--- Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
---
@@ -5734,8 +5734,8 @@ function vim.fn.match(expr, pat, start, count) end
--- conceal Special character to show instead of the
--- match (only for |hl-Conceal| highlighted
--- matches, see |:syn-cchar|)
--- window Instead of the current window use the
--- window with this number or window ID.
--- window Use this |window-number| or |window-ID| instead
--- of the current window.
---
--- The number of matches is not limited, as it is the case with
--- the |:match| commands.
@@ -5874,8 +5874,7 @@ function vim.fn.matchbufline(buf, pat, lnum, end_, dict) end
--- or one of the |:match| commands. Returns 0 if successful,
--- otherwise -1. See example for |matchadd()|. All matches can
--- be deleted in one operation by |clearmatches()|.
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window.
--- {win} (if given) is a |window-number| or |window-ID|.
---
--- @param id integer
--- @param win? integer
@@ -8299,12 +8298,12 @@ function vim.fn.setfperm(fname, mode) end
--- @return any
function vim.fn.setline(lnum, text) end
--- Create or replace or add to the location list for window {nr}.
--- {nr} can be the window number or the |window-ID|.
--- Create or replace or add to the location list for window {nr}
--- (|window-number| or |window-ID|).
--- When {nr} is zero the current window is used.
---
--- For a location list window, the displayed location list is
--- modified. For an invalid window number {nr}, -1 is returned.
--- modified. For an invalid {nr}, -1 is returned.
--- Otherwise, same as |setqflist()|.
--- Also see |location-list|.
---
@@ -8325,8 +8324,7 @@ function vim.fn.setloclist(nr, list, action, what) end
--- current window. Returns 0 if successful, otherwise -1. All
--- current matches are cleared before the list is restored. See
--- example for |getmatches()|.
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window.
--- {win} (if given) is a |window-number| or |window-ID|.
---
--- @param list vim.fn.getmatches.ret.item[]
--- @param win? integer
@@ -8591,7 +8589,7 @@ function vim.fn.settabvar(tabnr, varname, val) end
--- {val}.
--- Tabs are numbered starting with one. For the current tabpage
--- use |setwinvar()|.
--- {winnr} can be the window number or the |window-ID|.
--- {winnr} is a |window-number| or |window-ID|.
--- When {winnr} is zero the current window is used.
--- This also works for a global or local buffer option, but it
--- doesn't work for a global or local buffer variable.
@@ -8609,8 +8607,8 @@ function vim.fn.settabvar(tabnr, varname, val) end
--- @return any
function vim.fn.settabwinvar(tabnr, winnr, varname, val) end
--- Modify the tag stack of the window {nr} using {dict}.
--- {nr} can be the window number or the |window-ID|.
--- Modify the tag stack of the window {nr} (|window-number| or
--- |window-ID|) using {dict}.
---
--- For a list of supported items in {dict}, refer to
--- |gettagstack()|. "curidx" takes effect before changing the tag
@@ -10795,8 +10793,8 @@ function vim.fn.virtcol(expr, list, winid) end
--- For a multi-byte character, the column number of the first
--- byte in the character is returned.
---
--- The {winid} argument can be the window number or the
--- |window-ID|. If this is zero, then the current window is used.
--- {winid} is a |window-number| or |window-ID|. If zero, the
--- current window is used.
---
--- Returns -1 if the window {winid} doesn't exist or the buffer
--- line {lnum} or virtual column {col} is invalid.
@@ -10915,10 +10913,9 @@ function vim.fn.win_findbuf(bufnr) end
--- Get the |window-ID| for the specified window.
--- When {win} is missing use the current window.
--- With {win} this is the window number. The top window has
--- number 1.
--- Without {tab} use the current tab, otherwise the tab with
--- number {tab}. The first tab has number one.
--- With {win} this is the |window-number|.
--- Without {tab} use the current tab, otherwise the
--- |tabpage-number| given by {tab}.
--- Return zero if the window cannot be found.
---
--- @param win? integer
@@ -10938,8 +10935,8 @@ function vim.fn.win_getid(win, tab) end
--- "unknown" window {nr} not found
---
--- When {nr} is omitted return the type of the current window.
--- When {nr} is given return the type of this window by number or
--- |window-ID|.
--- When {nr} is given (|window-number| or |window-ID|) return the
--- type of that window.
---
--- Also see the 'buftype' option.
---
@@ -10947,8 +10944,7 @@ function vim.fn.win_getid(win, tab) end
--- @return 'autocmd'|'command'|''|'loclist'|'popup'|'preview'|'quickfix'|'unknown'
function vim.fn.win_gettype(nr) end
--- Go to window with ID {expr}. This may also change the current
--- tabpage.
--- Go to |window-ID| {expr}. May change the current tabpage.
--- Return TRUE if successful, FALSE if the window cannot be
--- found.
---
@@ -10956,15 +10952,15 @@ function vim.fn.win_gettype(nr) end
--- @return 0|1
function vim.fn.win_gotoid(expr) end
--- Return a list with the tab number and window number of window
--- with ID {expr}: [tabnr, winnr].
--- Return [tabnr, winnr] for window with |window-ID| {expr}, where
--- tabnr is the |tabpage-number| and winnr is the |window-number|.
--- Return [0, 0] if the window cannot be found.
---
--- @param expr integer
--- @return any
function vim.fn.win_id2tabwin(expr) end
--- Return the window number of window with ID {expr}.
--- Return the |window-number| of for the given |window-ID| {expr}.
--- Return 0 if the window cannot be found in the current tabpage.
---
--- @param expr integer
@@ -10973,7 +10969,7 @@ function vim.fn.win_id2win(expr) end
--- Move window {nr}'s vertical separator (i.e., the right border)
--- by {offset} columns, as if being dragged by the mouse. {nr}
--- can be a window number or |window-ID|. A positive {offset}
--- is a |window-number| or |window-ID|. A positive {offset}
--- moves right and a negative {offset} moves left. Moving a
--- window's vertical separator will change the width of the
--- window and the width of other windows adjacent to the vertical
@@ -10991,8 +10987,8 @@ function vim.fn.win_id2win(expr) end
function vim.fn.win_move_separator(nr, offset) end
--- Move window {nr}'s status line (i.e., the bottom border) by
--- {offset} rows, as if being dragged by the mouse. {nr} can be
--- a window number or |window-ID|. A positive {offset} moves
--- {offset} rows, as if being dragged by the mouse. {nr} is a
--- |window-number| or |window-ID|. A positive {offset} moves
--- down and a negative {offset} moves up. Moving a window's
--- status line will change the height of the window and the
--- height of other windows adjacent to the status line. The
@@ -11009,8 +11005,8 @@ function vim.fn.win_move_statusline(nr, offset) end
--- Return the screen position of window {nr} as a list with two
--- numbers: [row, col]. The first window always has position
--- [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.
--- {nr} is a |window-number| or |window-ID|. Use zero for the
--- current window.
--- Returns [0, 0] if the window cannot be found.
---
--- @param nr integer
@@ -11022,7 +11018,7 @@ function vim.fn.win_screenpos(nr) end
--- 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 {nr} and {target} are a |window-number| or |window-ID|.
--- Both must be in the current tabpage.
---
--- Returns zero for success, non-zero for failure.
@@ -11042,8 +11038,8 @@ function vim.fn.win_screenpos(nr) end
--- @return any
function vim.fn.win_splitmove(nr, target, options) end
--- Returns the buffer number associated with window {nr}.
--- {nr} can be the window number or the |window-ID|.
--- Returns the buffer number associated with window {nr}
--- (|window-number| or |window-ID|).
--- When {nr} is zero, the number of the buffer in the current
--- window is returned.
--- When window {nr} doesn't exist, -1 is returned.