Skip to main content
Module

x/denops_std/function/mod.ts>fnameescape

📚 Standard module for denops.vim
Go to Latest
function fnameescape
import { fnameescape } from "https://deno.land/x/denops_std@v4.3.1/function/mod.ts";

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
string: unknown

Returns

Promise<string>