Skip to main content
Module

x/ddc_vim/deps.ts>fn.readdir

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.readdir
import { fn } from "https://deno.land/x/ddc_vim@v0.0.13/deps.ts";
const { readdir } = fn;

Return a list with file and directory names in {directory}. You can also use |glob()| if you don't need to do complicated things, such as limiting the number of matches. When {expr} is omitted all entries are included. When {expr} is given, it is evaluated to check what to do: If {expr} results in -1 then no further entries will be handled. If {expr} results in 0 then this entry will not be added to the list. If {expr} results in 1 then this entry will be added to the list. Each time {expr} is evaluated |v:val| is set to the entry name. When {expr} is a function the name is passed as the argument. For example, to get a list of files ending in ".txt": readdir(dirname, {n -> n =~ '.txt$'}) To skip hidden and backup files: readdir(dirname, {n -> n !~ '^.|~$'}) If you want to get a directory tree: function! s:tree(dir) return {a:dir : map(readdir(a:dir), \ {_, x -> isdirectory(x) ? \ {x : s:tree(a:dir . '/' . x)} : x})} endfunction echo s:tree(".") Can also be used as a |method|: GetDirName()->readdir()

Parameters

denops: Denops
directory: unknown
optional
expr: unknown

Returns

Promise<unknown>