docs(vimfn): getcwd() behavior #36222

(cherry picked from commit cf48741227)
This commit is contained in:
Robert
2025-10-21 18:40:02 +01:00
committed by github-actions[bot]
parent f9cad88d5a
commit a215da823f
3 changed files with 21 additions and 12 deletions

View File

@@ -3485,16 +3485,19 @@ getcwd([{winnr} [, {tabnr}]]) *getcwd()*
With no arguments, returns the name of the effective
|current-directory|. With {winnr} or {tabnr} the working
directory of that scope is returned, and 'autochdir' is
ignored.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing tab number implies 0.
Thus the following are equivalent: >vim
ignored. Tabs and windows are identified by their respective
numbers, 0 means current tab or window. Missing tab number
implies 0. Thus the following are equivalent: >vim
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|.
If both {winnr} and {tabnr} are -1 the global working
directory is returned.
Note: When {tabnr} is -1 Vim returns an empty string to
signal that it is invalid, whereas Nvim returns either the
global working directory if {winnr} is -1 or the working
directory of the window indicated by {winnr}.
Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
Parameters: ~

View File

@@ -3124,16 +3124,19 @@ function vim.fn.getcursorcharpos(winid) end
--- With no arguments, returns the name of the effective
--- |current-directory|. With {winnr} or {tabnr} the working
--- directory of that scope is returned, and 'autochdir' is
--- ignored.
--- Tabs and windows are identified by their respective numbers,
--- 0 means current tab or window. Missing tab number implies 0.
--- Thus the following are equivalent: >vim
--- ignored. Tabs and windows are identified by their respective
--- numbers, 0 means current tab or window. Missing tab number
--- implies 0. Thus the following are equivalent: >vim
--- 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|.
--- If both {winnr} and {tabnr} are -1 the global working
--- directory is returned.
--- Note: When {tabnr} is -1 Vim returns an empty string to
--- signal that it is invalid, whereas Nvim returns either the
--- global working directory if {winnr} is -1 or the working
--- directory of the window indicated by {winnr}.
--- Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
---
--- @param winnr? integer

View File

@@ -3915,16 +3915,19 @@ M.funcs = {
With no arguments, returns the name of the effective
|current-directory|. With {winnr} or {tabnr} the working
directory of that scope is returned, and 'autochdir' is
ignored.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing tab number implies 0.
Thus the following are equivalent: >vim
ignored. Tabs and windows are identified by their respective
numbers, 0 means current tab or window. Missing tab number
implies 0. Thus the following are equivalent: >vim
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|.
If both {winnr} and {tabnr} are -1 the global working
directory is returned.
Note: When {tabnr} is -1 Vim returns an empty string to
signal that it is invalid, whereas Nvim returns either the
global working directory if {winnr} is -1 or the working
directory of the window indicated by {winnr}.
Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
]=],