import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { fnameescape } = fn;
Escape {string} for use as file name command argument. All
characters that have a special meaning, such as '%' and '|'
are escaped with a backslash.
For most systems the characters escaped are
" \t\n*?[{`$\\%#'\"|!<"
. For systems where a backslash
appears in a filename, it depends on the value of 'isfname'.
A leading '+' and '>' is also escaped (special after :edit
and :write
). And a "-" by itself (special after :cd
).
Returns an empty string on error.
Example:
:let fname = '+some str%nge|name'
:exe "edit " .. fnameescape(fname)
results in executing:
edit \+some\ str\%nge\|name
Can also be used as a method
:
GetName()->fnameescape()
Parameters
denops: Denops