Skip to main content
Module

x/ddc_vim/deps.ts>fn.chdir

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

Change the current working directory to {dir}. The scope of the directory change depends on the directory of the current window: - If the current window has a window-local directory (:lcd), then changes the window local directory. - Otherwise, if the current tabpage has a local directory (:tcd) then changes the tabpage local directory. - Otherwise, changes the global directory. {dir} must be a String. If successful, returns the previous working directory. Pass this to another chdir() to restore the directory. On failure, returns an empty string.

Example:

let save_dir = chdir(newdir)
if save_dir != ""
   " ... do some work
   call chdir(save_dir)
endif

Can also be used as a method:

GetDir()->chdir()

Parameters

denops: Denops
dir: unknown

Returns

Promise<string>