Hi, The following help items describe similar things:
:help gui-w32-cmdargs :help win32-quotes I think they can be merged. Moreover, they doesn't reflect the change by the patch 7.4.432. Please check the attached patch. (Related: https://github.com/vim/vim/issues/670) Regards, Ken Takata -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
# HG changeset patch # Parent dfdf21dd6d749f0526da4bb1e415045b93fa4f4f diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -382,38 +382,7 @@ Note that a menu that starts with ']' wi ============================================================================== 7. Command line arguments *gui-w32-cmdargs* -Analysis of a command line into parameters is not standardised in MS Windows. -Gvim has to provide logic to analyse a command line. This logic is likely to -be different from the default logic provided by a compilation system used to -build vim. The differences relate to unusual double quote (") usage. -The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the -same way. The argument "+/Sch""iller" may be handled different by gvim and -vim, depending what it was compiled with. - -The rules are: - 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. - -Example: > - gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" - -opens "C:\My Music\freude" and executes the line mode commands: > - set ignorecase; /"foo\ and /bar\" +This part was moved to |win32-cmdargs| in the os_win32.txt. ============================================================================== 8. Various *gui-w32-various* diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -81,10 +81,45 @@ The directory of the Vim executable is a 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. -Quotes inside a file name (or any other command line argument) can be escaped -with a backslash. E.g. > +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. + +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: >