summaryrefslogtreecommitdiffstats
path: root/runtime/doc/options.txt
diff options
context:
space:
mode:
authorYee Cheng Chin <ychin.git@gmail.com>2023-10-09 18:12:31 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-09 18:12:31 +0200
commit54844857fd6933fa4f6678e47610c4b9c9f7a091 (patch)
treec06d0264ce73c0ae3c6401419c3fccccce674fd9 /runtime/doc/options.txt
parentb07b9dc4dafe2aad5ee752a51f06acacae210fef (diff)
patch 9.0.2009: cmdline-completion for comma-separated options wrongv9.0.2009
Problem: cmdline-completion for comma-separated options wrong Solution: Fix command-line expansions for options with filenames with commas Fix command-line expansions for options with filenames with commas Cmdline expansion for option values that take a comma-separated list of file names is currently not handling file names with commas as the commas are not escaped. For such options, the commas in file names need to be escaped (to differentiate from a comma that delimit the list items). The escaped comma is unescaped in `copy_option_part()` during option parsing. Fix as follows: - Cmdline completion for option values with comma-separated file/folder names will not start a new match when seeing `\\,` and will instead consider it as one value. - File/folder regex matching will strip the `\\` when seeing `\\,` to make sure it can match the correct files/folders. - The expanded value will escape `,` with `\\,`, similar to how spaces are escaped to make sure the option value is correct on the cmdline. This fix also takes into account the fact that Win32 Vim handles file name escaping differently. Typing '\,' for a file name results in it being handled literally but in other platforms '\,' is interpreted as a simple ',' and commas need to be escaped using '\\,' instead. Also, make sure this new logic only applies to comma-separated options like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex commands like `:edit <Tab>` do not require escaping and will continue to work. Also fix up documentation to be clearer. The original docs are slightly misleading in how it discusses triple slashes for 'tags'. closes: #13303 related: #13301 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'runtime/doc/options.txt')
-rw-r--r--runtime/doc/options.txt27
1 files changed, 22 insertions, 5 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index c518663904..cfef59de60 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -192,10 +192,27 @@ To include white space in a string option value it has to be preceded with a
backslash. To include a backslash you have to use two. Effectively this
means that the number of backslashes in an option value is halved (rounded
down).
+In options 'path', 'cdpath', and 'tags', spaces have to be preceded with three
+backslashes instead for compatibility with version 3.0 where the options can
+be separated by either commas or spaces.
+Comma-separated options like 'backupdir' and 'tags' will also require commas
+to be escaped with two backslashes, whereas this is not needed for
+non-comma-separated ones like 'makeprg'.
+When setting options using |:let| and |literal-string|, you need to use one
+fewer layer of backslash.
A few examples: >
- :set tags=tags\ /usr/tags results in "tags /usr/tags"
- :set tags=tags\\,file results in "tags\,file"
- :set tags=tags\\\ file results in "tags\ file"
+ :set makeprg=make\ file results in "make file"
+ :let &makeprg='make file' (same as above)
+ :set makeprg=make\\\ file results in "make\ file"
+ :set tags=tags\ /usr/tags results in "tags" and "/usr/tags"
+ :set tags=tags\\\ file results in "tags file"
+ :let &tags='tags\ file' (same as above)
+
+ :set makeprg=make,file results in "make,file"
+ :set makeprg=make\\,file results in "make\,file"
+ :set tags=tags,file results in "tags" and "file"
+ :set tags=tags\\,file results in "tags,file"
+ :let &tags='tags\,file' (same as above)
The "|" character separates a ":set" command from a following command. To
include the "|" in the option value, use "\|" instead. This example sets the
@@ -8213,8 +8230,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|+emacs_tags|: "./tags,./TAGS,tags,TAGS")
global or local to buffer |global-local|
Filenames for the tag command, separated by spaces or commas. To
- include a space or comma in a file name, precede it with a backslash
- (see |option-backslash| about including spaces and backslashes).
+ include a space or comma in a file name, precede it with backslashes
+ (see |option-backslash| about including spaces/commas and backslashes).
When a file name starts with "./", the '.' is replaced with the path
of the current file. But only when the 'd' flag is not included in
'cpoptions'. Environment variables are expanded |:set_env|. Also see