updated for version 7.4.191
Problem: Escaping a file name for shell commands can't be done without a
function.
Solution: Add the :S file name modifier.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7d6708a..7b57e7f 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5428,6 +5428,7 @@
< This results in a directory listing for the file under the
cursor. Example of use with |system()|: >
:call system("chmod +w -- " . shellescape(expand("%")))
+< See also |::S|.
shiftwidth() *shiftwidth()*
@@ -5910,14 +5911,16 @@
passed as stdin to the command. The string is written as-is,
you need to take care of using the correct line separators
yourself. Pipes are not used.
- Note: Use |shellescape()| to escape special characters in a
- command argument. Newlines in {expr} may cause the command to
- fail. The characters in 'shellquote' and 'shellxquote' may
- also cause trouble.
+ Note: Use |shellescape()| or |::S| with |expand()| or
+ |fnamemodify()| to escape special characters in a command
+ argument. Newlines in {expr} may cause the command to fail.
+ The characters in 'shellquote' and 'shellxquote' may also
+ cause trouble.
This is not to be used for interactive commands.
The result is a String. Example: >
:let files = system("ls " . shellescape(expand('%:h')))
+ :let files = system('ls ' . expand('%:h:S'))
< To make the result more system-independent, the shell output
is filtered to replace <CR> with <NL> for Macintosh, and