escape
Links
- See also: option-backslash
- To include white space in a string option value it has to be preceded with a backslash.
- To include a backslash you have to use two.
:set tags=tags\ /usr/tags
→ tags /usr/tags
:set tags=tags\\,file
→ tags\,file
:set tags=tags\\\ file
→ tags\ file
- escape({string}, {chars})
- Replace any of the
{chars}
in {string}
with a backslash.
:echo escape('c:\program files\vim', ' \')
- →
c:\\program\ files\\vim
- shellescape({string} [, {special}])
:exe '!dir ' . shellescape(expand('<cfile>'), 1)
:call system("chmod +w -- " . shellescape(expand("%")))
- fnameescape({string})
- 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
:let fname = '+some str%nge|name'
:exe "edit " . fnameescape(fname)
- →
:edit \+some\ str\%nge\|name
- Misc