-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimdoc.diff
More file actions
95 lines (91 loc) · 4.54 KB
/
vimdoc.diff
File metadata and controls
95 lines (91 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 250c07b62..30894b96d 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -699,7 +699,8 @@ synconcealed({lnum}, {col}) List info about concealing
synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and
{col}
system({expr} [, {input}]) String output of shell command/filter {expr}
-systemlist({expr} [, {input}]) List output of shell command/filter {expr}
+systemlist({expr} [, {input}])
+ List output of shell command/filter {expr}
tabpagebuflist([{arg}]) List list of buffer numbers in tab page
tabpagenr([{arg}]) Number number of current or last tab page
tabpagewinnr({tabarg} [, {arg}])
@@ -11694,6 +11695,30 @@ system({expr} [, {input}]) *system()* *E677*
Get the output of the shell command {expr} as a |String|. See
|systemlist()| to get the output as a |List|.
+ {expr} can be a |String| or a |List|.
+ When {expr} is a |String|, the command is executed through the
+ shell (see below for how the command is constructed).
+
+ *E1575*
+ When {expr} is a |List|, the first item is the executable and
+ the remaining items are passed as arguments directly. The
+ command is executed without using a shell, similar to
+ |job_start()|. Since no shell is involved, shell features
+ such as redirection, piping, globbing, environment variable
+ expansion and backtick expansion will not work. Characters
+ like ">" are passed as literal arguments to the command, not
+ interpreted as redirection. Use this form when arguments may
+ contain special characters that should not be interpreted by
+ the shell. Example: >
+ :let out = system(['grep', '-r', 'pattern', '.'])
+< With the String form ">" would be shell redirection, but
+ with a List it is passed as a literal argument: >
+ :let out = system(['echo', 'hello', '>', 'world'])
+< This outputs "hello > world", not redirect to a file.
+
+ To use the shell explicitly with a List: >
+ :let out = system(['/bin/sh', '-c', 'echo $HOME'])
+<
When {input} is given and is a |String| this string is written
to a file and passed as stdin to the command. The string is
written as-is, you need to take care of using the correct line
@@ -11719,11 +11744,11 @@ system({expr} [, {input}]) *system()* *E677*
being echoed on the screen. >
:silent let f = system('ls *.vim')
<
- 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.
+ Note: When {expr} is a String, 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: >
@@ -11736,7 +11761,8 @@ system({expr} [, {input}]) *system()* *E677*
To avoid the string being truncated at a NUL, all NUL
characters are replaced with SOH (0x01).
- The command executed is constructed using several options:
+ When {expr} is a String, the command executed is constructed
+ using several options:
'shell' 'shellcmdflag' 'shellxquote' {expr} 'shellredir' {tmp} 'shellxquote'
({tmp} is an automatically generated file name).
For Unix, braces are put around {expr} to allow for
@@ -11763,6 +11789,9 @@ system({expr} [, {input}]) *system()* *E677*
systemlist({expr} [, {input}]) *systemlist()*
Same as |system()|, but returns a |List| with lines (parts of
output separated by NL) with NULs transformed into NLs.
+ Like |system()|, {expr} can be a |String| (executed through
+ the shell) or a |List| (executed directly without a shell).
+ See |system()| for details.
Output is the same as |readfile()| will output with {binary}
argument set to "b", except that there is no extra empty item
when the result ends in a NL.
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index ed58dae14..8045698a3 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -52611,6 +52611,8 @@ Other ~
- New "leadtab" value for the 'listchars' setting.
- Improved |:set+=|, |:set^=| and |:set-=| handling of comma-separated "key:value"
pairs individually (e.g. 'listchars', 'fillchars', 'diffopt').
+- |system()| and |systemlist()| functions accept a list as first argument,
+ bypassing the shell completely.
xxd ~
---