|
1 |
| -*os_win32.txt* For Vim version 8.0. Last change: 2016 Oct 12 |
| 1 | +*os_win32.txt* For Vim version 8.0. Last change: 2017 Mar 21 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by George Reilly
|
@@ -81,10 +81,45 @@ The directory of the Vim executable is appended to $PATH. This is mostly to
|
81 | 81 | make "!xxd" work, as it is in the Tools menu. And it also means that when
|
82 | 82 | executable() returns 1 the executable can actually be executed.
|
83 | 83 |
|
84 |
| -Quotes in file names *win32-quotes* |
| 84 | +Command line arguments *win32-cmdargs* |
| 85 | + |
| 86 | +Analysis of a command line into parameters is not standardised in MS Windows. |
| 87 | +Vim and gvim used to use different logic to parse it (before 7.4.432), and the |
| 88 | +logic was also depended on what it was compiled with. Now Vim and gvim both |
| 89 | +use the CommandLineToArgvW() Win32 API, so they behave in the same way. |
| 90 | + |
| 91 | +The basic rules are: *win32-backslashes* |
| 92 | + a) A parameter is a sequence of graphic characters. |
| 93 | + b) Parameters are separated by white space. |
| 94 | + c) A parameter can be enclosed in double quotes to include white space. |
| 95 | + d) A sequence of zero or more backslashes (\) and a double quote (") |
| 96 | + is special. The effective number of backslashes is halved, rounded |
| 97 | + down. An even number of backslashes reverses the acceptability of |
| 98 | + spaces and tabs, an odd number of backslashes produces a literal |
| 99 | + double quote. |
| 100 | + |
| 101 | +So: |
| 102 | + " is a special double quote |
| 103 | + \" is a literal double quote |
| 104 | + \\" is a literal backslash and a special double quote |
| 105 | + \\\" is a literal backslash and a literal double quote |
| 106 | + \\\\" is 2 literal backslashes and a special double quote |
| 107 | + \\\\\" is 2 literal backslashes and a literal double quote |
| 108 | + etc. |
85 | 109 |
|
86 |
| -Quotes inside a file name (or any other command line argument) can be escaped |
87 |
| -with a backslash. E.g. > |
| 110 | +Example: > |
| 111 | + vim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" |
| 112 | +
|
| 113 | +opens "C:\My Music\freude" and executes the line mode commands: > |
| 114 | + set ignorecase; /"foo\ and /bar\" |
| 115 | +
|
| 116 | +These rules are also described in the reference of the CommandLineToArgvW API: |
| 117 | + https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391.aspx |
| 118 | + |
| 119 | + *win32-quotes* |
| 120 | +There are additional rules for quotes (which are not well documented). |
| 121 | +As described above, quotes inside a file name (or any other command line |
| 122 | +argument) can be escaped with a backslash. E.g. > |
88 | 123 | vim -c "echo 'foo\"bar'"
|
89 | 124 |
|
90 | 125 | Alternatively use three quotes to get one: >
|
@@ -135,7 +170,7 @@ you will need to get a version older than that.
|
135 | 170 | 6. Running under Windows 3.1 *win32-win3.1*
|
136 | 171 |
|
137 | 172 | *win32s* *windows-3.1* *gui-w32s*
|
138 |
| -There was a special version of Gvim that runs under Windows 3.1 and 3.11. |
| 173 | +There was a special version of gvim that runs under Windows 3.1 and 3.11. |
139 | 174 | Support was removed in patch 7.4.1363.
|
140 | 175 |
|
141 | 176 | ==============================================================================
|
@@ -212,10 +247,19 @@ A. You can't! This is a limitation of the NT console. NT 5.0 is reported to
|
212 | 247 | be able to set the blink rate for all console windows at the same time.
|
213 | 248 |
|
214 | 249 | *:!start*
|
215 |
| -Q. How can I run an external command or program asynchronously? |
216 |
| -A. When using :! to run an external command, you can run it with "start": > |
217 |
| - :!start winfile.exe<CR> |
218 |
| -< Using "start" stops Vim switching to another screen, opening a new console, |
| 250 | +Q. How can I asynchronously run an external command or program, or open a |
| 251 | + document or URL with its default program? |
| 252 | +A. When using :! to run an external command, you can run it with "start". For |
| 253 | + example, to run notepad: > |
| 254 | + :!start notepad |
| 255 | +< To open "image.jpg" with the default image viewer: > |
| 256 | + :!start image.jpg |
| 257 | +< To open the folder of the current file in Windows Explorer: > |
| 258 | + :!start %:h |
| 259 | +< To open the Vim home page with the default browser: > |
| 260 | + :!start http://www.vim.org/ |
| 261 | +< |
| 262 | + Using "start" stops Vim switching to another screen, opening a new console, |
219 | 263 | or waiting for the program to complete; it indicates that you are running a
|
220 | 264 | program that does not affect the files you are editing. Programs begun
|
221 | 265 | with :!start do not get passed Vim's open file handles, which means they do
|
|
0 commit comments