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 With no arguments, returns the name of the effective
|current-directory|. With {winnr} or {tabnr} the working |current-directory|. With {winnr} or {tabnr} the working
directory of that scope is returned, and 'autochdir' is directory of that scope is returned, and 'autochdir' is
ignored. ignored. Tabs and windows are identified by their respective
Tabs and windows are identified by their respective numbers, numbers, 0 means current tab or window. Missing tab number
0 means current tab or window. Missing tab number implies 0. implies 0. Thus the following are equivalent: >vim
Thus the following are equivalent: >vim
getcwd(0) getcwd(0)
getcwd(0, 0) getcwd(0, 0)
< If {winnr} is -1 it is ignored, only the tab is resolved. < If {winnr} is -1 it is ignored, only the tab is resolved.
{winnr} can be the window number or the |window-ID|. {winnr} can be the window number or the |window-ID|.
If both {winnr} and {tabnr} are -1 the global working If both {winnr} and {tabnr} are -1 the global working
directory is returned. 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| Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
Parameters: ~ Parameters: ~

View File

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

View File

@@ -3915,16 +3915,19 @@ M.funcs = {
With no arguments, returns the name of the effective With no arguments, returns the name of the effective
|current-directory|. With {winnr} or {tabnr} the working |current-directory|. With {winnr} or {tabnr} the working
directory of that scope is returned, and 'autochdir' is directory of that scope is returned, and 'autochdir' is
ignored. ignored. Tabs and windows are identified by their respective
Tabs and windows are identified by their respective numbers, numbers, 0 means current tab or window. Missing tab number
0 means current tab or window. Missing tab number implies 0. implies 0. Thus the following are equivalent: >vim
Thus the following are equivalent: >vim
getcwd(0) getcwd(0)
getcwd(0, 0) getcwd(0, 0)
<If {winnr} is -1 it is ignored, only the tab is resolved. <If {winnr} is -1 it is ignored, only the tab is resolved.
{winnr} can be the window number or the |window-ID|. {winnr} can be the window number or the |window-ID|.
If both {winnr} and {tabnr} are -1 the global working If both {winnr} and {tabnr} are -1 the global working
directory is returned. 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| Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
]=], ]=],