Skip to content

How to get global current directory? #15034

@ghost

Description

how to get global current directory is not clear in the docs

neovim/runtime/doc/eval.txt

Lines 4513 to 4524 in 1c41689

getcwd([{winnr}[, {tabnr}]]) *getcwd()*
With no arguments the result is a String, which is the name of
the current effective working directory. With {winnr} or
{tabnr} the working directory of that scope is returned.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
Thus the following are equivalent: >
getcwd()
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|.

I am using execute 'cd' getcwd(-1) in vim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions