summaryrefslogtreecommitdiffstats
path: root/runtime/doc/os_win32.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-02 22:58:42 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-02 22:58:42 +0100
commit01164a6546b4c635daf96a1f17d1cb2d07f32a66 (patch)
tree6e3ff8b26170448c1ee8c53e904738ddc10287e8 /runtime/doc/os_win32.txt
parentea84df8041dbbff95acb1db8532281679c5fbe5a (diff)
Long overdue runtime update.
Diffstat (limited to 'runtime/doc/os_win32.txt')
-rw-r--r--runtime/doc/os_win32.txt41
1 files changed, 38 insertions, 3 deletions
diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt
index 9112dacde2..bb1dbdc46a 100644
--- a/runtime/doc/os_win32.txt
+++ b/runtime/doc/os_win32.txt
@@ -81,10 +81,45 @@ The directory of the Vim executable is appended to $PATH. This is mostly to
make "!xxd" work, as it is in the Tools menu. And it also means that when
executable() returns 1 the executable can actually be executed.
-Quotes in file names *win32-quotes*
+Command line arguments *win32-cmdargs*
+
+Analysis of a command line into parameters is not standardised in MS Windows.
+Vim and gvim used to use different logic to parse it (before 7.4.432), and the
+logic was also depended on what it was compiled with. Now Vim and gvim both
+use the CommandLineToArgvW() Win32 API, so they behave in the same way.
+
+The basic rules are: *win32-backslashes*
+ a) A parameter is a sequence of graphic characters.
+ b) Parameters are separated by white space.
+ c) A parameter can be enclosed in double quotes to include white space.
+ d) A sequence of zero or more backslashes (\) and a double quote (")
+ is special. The effective number of backslashes is halved, rounded
+ down. An even number of backslashes reverses the acceptability of
+ spaces and tabs, an odd number of backslashes produces a literal
+ double quote.
+
+So:
+ " is a special double quote
+ \" is a literal double quote
+ \\" is a literal backslash and a special double quote
+ \\\" is a literal backslash and a literal double quote
+ \\\\" is 2 literal backslashes and a special double quote
+ \\\\\" is 2 literal backslashes and a literal double quote
+ etc.
-Quotes inside a file name (or any other command line argument) can be escaped
-with a backslash. E.g. >
+Example: >
+ vim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\"
+
+opens "C:\My Music\freude" and executes the line mode commands: >
+ set ignorecase; /"foo\ and /bar\"
+
+These rules are also described in the reference of the CommandLineToArgvW API:
+ https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391.aspx
+
+ *win32-quotes*
+There are additional rules for quotes (which are not well documented).
+As described above, quotes inside a file name (or any other command line
+argument) can be escaped with a backslash. E.g. >
vim -c "echo 'foo\"bar'"
Alternatively use three quotes to get one: >