import { fn } from "https://deno.land/x/ddu_vim@v4.0.0/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