Mercurial > vim
diff runtime/doc/eval.txt @ 5690:40f18a1c1592 v7.4.191
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.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 23 Feb 2014 23:39:13 +0100 |
parents | 1dea14d4c738 |
children | 80e5f9584b02 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5428,6 +5428,7 @@ shellescape({string} [, {special}]) *s < 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 @@ system({expr} [, {input}]) *system()* 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