Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.getcwd

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.getcwd
import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { getcwd } = fn;

The result is a String, which is the name of the current working directory. 'autochdir' is ignored.

With {winnr} return the local current directory of this window in the current tab page. {winnr} can be the window number or the window-ID. If {winnr} is -1 return the name of the global working directory. See also haslocaldir().

With {winnr} and {tabnr} return the local current directory of the window in the specified tab page. If {winnr} is -1 return the working directory of the tabpage. If {winnr} is zero use the current window, if {tabnr} is zero use the current tabpage. Without any arguments, return the actual working directory of the current window. Return an empty string if the arguments are invalid.

Examples:

" Get the working directory of the current window
:echo getcwd()
:echo getcwd(0)
:echo getcwd(0, 0)
" Get the working directory of window 3 in tabpage 2
:echo getcwd(3, 2)
" Get the global working directory
:echo getcwd(-1)
" Get the working directory of tabpage 3
:echo getcwd(-1, 3)
" Get the working directory of current tabpage
:echo getcwd(-1, 0)

Can also be used as a method:

GetWinnr()->getcwd()

Parameters

denops: Denops
optional
winnr: unknown
optional
tabnr: unknown

Returns

Promise<string>