vim-patch:b6f9d38: runtime(doc): Improve documentation of the ..= assignment operator (#35916)

Explicitly mention the "..=" compound assignment operator everywhere
".=" is documented.

Convert some uses of "." and ".=" in the examples to ".." and "..=",
respectively.

closes: vim/vim#18380

b6f9d38f96

Cherry-pick a change to eval.txt from patch 9.1.1232.

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
zeertzjq
2025-09-26 07:31:21 +08:00
committed by GitHub
parent bfa3e111c2
commit 0646d0ea28
5 changed files with 24 additions and 14 deletions

View File

@@ -1078,7 +1078,7 @@ These modifiers can be given, in this order:
:S Escape special characters for use with a shell command (see :S Escape special characters for use with a shell command (see
|shellescape()|). Must be the last one. Examples: > |shellescape()|). Must be the last one. Examples: >
:!dir <cfile>:S :!dir <cfile>:S
:call system('chmod +w -- ' . expand('%:S')) :call system('chmod +w -- ' .. expand('%:S'))
Examples, when the file name is "src/version.c", current dir Examples, when the file name is "src/version.c", current dir
"/home/mool/vim": > "/home/mool/vim": >
@@ -1360,7 +1360,7 @@ the `CmdlineLeavePre` autocmd from the next section): >
\ Grep call <SID>VisitFile() \ Grep call <SID>VisitFile()
func s:Grep(arglead, cmdline, cursorpos) func s:Grep(arglead, cmdline, cursorpos)
if match(&grepprg, '\$\*') == -1 | let &grepprg .= ' $*' | endif if match(&grepprg, '\$\*') == -1 | let &grepprg ..= ' $*' | endif
let cmd = substitute(&grepprg, '\$\*', shellescape(escape(a:arglead, '\')), '') let cmd = substitute(&grepprg, '\$\*', shellescape(escape(a:arglead, '\')), '')
return len(a:arglead) > 1 ? systemlist(cmd) : [] return len(a:arglead) > 1 ? systemlist(cmd) : []
endfunc endfunc

View File

@@ -722,7 +722,7 @@ Otherwise, for the defined variable "g:ftplugin_java_source_path", the local
value of the 'path' option will be further modified by prefixing the value of value of the 'path' option will be further modified by prefixing the value of
the variable, e.g.: > the variable, e.g.: >
let g:ftplugin_java_source_path = $JDK_SRC_PATH let g:ftplugin_java_source_path = $JDK_SRC_PATH
let &l:path = g:ftplugin_java_source_path . ',' . &l:path let &l:path = g:ftplugin_java_source_path .. ',' .. &l:path
< <
and the "gf" command can be used on a fully-qualified type to look for a file and the "gf" command can be used on a fully-qualified type to look for a file
in the "path" and to try to load it. in the "path" and to try to load it.

View File

@@ -1440,7 +1440,7 @@ declares an only parameter of type string and puts to use a command equivalent
of |:make|, and assigning its |Funcref| to the selected key. For example: of |:make|, and assigning its |Funcref| to the selected key. For example:
>vim >vim
function! GenericPostCompilerCommand(arguments) abort function! GenericPostCompilerCommand(arguments) abort
execute 'make ' . a:arguments execute 'make ' .. a:arguments
endfunction endfunction
let g:spotbugs_properties = { let g:spotbugs_properties = {
@@ -1471,7 +1471,7 @@ that will arrange for "PostCompilerActionExecutor" to be invoked; and then run
function! GenericPreCompilerCommand(arguments) abort function! GenericPreCompilerCommand(arguments) abort
if !exists('g:spotbugs_compilation_done') if !exists('g:spotbugs_compilation_done')
doautocmd java_spotbugs_post User doautocmd java_spotbugs_post User
execute 'make ' . a:arguments execute 'make ' .. a:arguments
" only run doautocmd when :make was synchronous " only run doautocmd when :make was synchronous
" see note below " see note below
doautocmd java_spotbugs_post ShellCmdPost " XXX: (a) doautocmd java_spotbugs_post ShellCmdPost " XXX: (a)
@@ -1484,7 +1484,7 @@ that will arrange for "PostCompilerActionExecutor" to be invoked; and then run
function! GenericPreCompilerTestCommand(arguments) abort function! GenericPreCompilerTestCommand(arguments) abort
if !exists('g:spotbugs_test_compilation_done') if !exists('g:spotbugs_test_compilation_done')
doautocmd java_spotbugs_post User doautocmd java_spotbugs_post User
execute 'make ' . a:arguments execute 'make ' .. a:arguments
" only run doautocmd when :make was synchronous " only run doautocmd when :make was synchronous
" see note below " see note below
doautocmd java_spotbugs_post ShellCmdPost " XXX: (b) doautocmd java_spotbugs_post ShellCmdPost " XXX: (b)

View File

@@ -597,7 +597,7 @@ EXECUTING AUTOCOMMANDS
It is possible to trigger an autocommand by pretending an event has occurred. It is possible to trigger an autocommand by pretending an event has occurred.
This is useful to have one autocommand trigger another one. Example: > This is useful to have one autocommand trigger another one. Example: >
:autocmd BufReadPost *.new execute "doautocmd BufReadPost " . expand("<afile>:r") :autocmd BufReadPost *.new execute "doautocmd BufReadPost " .. expand("<afile>:r")
This defines an autocommand that is triggered when a new file has been edited. This defines an autocommand that is triggered when a new file has been edited.
The file name must end in ".new". The ":execute" command uses expression The file name must end in ".new". The ":execute" command uses expression

View File

@@ -1921,6 +1921,7 @@ This does NOT work: >
Set environment variable {env-name} to the result of Set environment variable {env-name} to the result of
the expression {expr1}. The type is always String. the expression {expr1}. The type is always String.
:let ${env-name} .= {expr1} :let ${env-name} .= {expr1}
:let ${env-name} ..= {expr1}
Append {expr1} to the environment variable {env-name}. Append {expr1} to the environment variable {env-name}.
If the environment variable didn't exist yet this If the environment variable didn't exist yet this
works like "=". works like "=".
@@ -1940,6 +1941,7 @@ This does NOT work: >
that would match everywhere. that would match everywhere.
:let @{reg-name} .= {expr1} :let @{reg-name} .= {expr1}
:let @{reg-name} ..= {expr1}
Append {expr1} to register {reg-name}. If the Append {expr1} to register {reg-name}. If the
register was empty it's like setting it to {expr1}. register was empty it's like setting it to {expr1}.
@@ -1954,6 +1956,7 @@ This does NOT work: >
:let &path = &path .. ',/usr/local/include' :let &path = &path .. ',/usr/local/include'
:let &{option-name} .= {expr1} :let &{option-name} .= {expr1}
:let &{option-name} ..= {expr1}
For a string option: Append {expr1} to the value. For a string option: Append {expr1} to the value.
Does not insert a comma like |:set+=|. Does not insert a comma like |:set+=|.
@@ -1963,16 +1966,18 @@ This does NOT work: >
{expr1}. {expr1}.
:let &l:{option-name} = {expr1} :let &l:{option-name} = {expr1}
:let &l:{option-name} .= {expr1}
:let &l:{option-name} += {expr1} :let &l:{option-name} += {expr1}
:let &l:{option-name} -= {expr1} :let &l:{option-name} -= {expr1}
:let &l:{option-name} .= {expr1}
:let &l:{option-name} ..= {expr1}
Like above, but only set the local value of an option Like above, but only set the local value of an option
(if there is one). Works like |:setlocal|. (if there is one). Works like |:setlocal|.
:let &g:{option-name} = {expr1} :let &g:{option-name} = {expr1}
:let &g:{option-name} .= {expr1}
:let &g:{option-name} += {expr1} :let &g:{option-name} += {expr1}
:let &g:{option-name} -= {expr1} :let &g:{option-name} -= {expr1}
:let &g:{option-name} .= {expr1}
:let &g:{option-name} ..= {expr1}
Like above, but only set the global value of an option Like above, but only set the global value of an option
(if there is one). Works like |:setglobal|. (if there is one). Works like |:setglobal|.
@@ -1995,11 +2000,15 @@ This does NOT work: >
:echo x :echo x
< The result is [0, 2]. < The result is [0, 2].
:let [{name1}, {name2}, ...] .= {expr1}
:let [{name1}, {name2}, ...] += {expr1} :let [{name1}, {name2}, ...] += {expr1}
:let [{name1}, {name2}, ...] -= {expr1} :let [{name1}, {name2}, ...] -= {expr1}
Like above, but append/add/subtract the value for each `:let [{name1}, {name2}, ...] *= {expr1}`
|List| item. :let [{name1}, {name2}, ...] /= {expr1}
:let [{name1}, {name2}, ...] %= {expr1}
:let [{name1}, {name2}, ...] .= {expr1}
:let [{name1}, {name2}, ...] ..= {expr1}
Like above, but add, subtract, multiply, divide,
modulo, or append the value for each |List| item.
:let [{name}, ..., ; {lastname}] = {expr1} *E452* :let [{name}, ..., ; {lastname}] = {expr1} *E452*
Like |:let-unpack| above, but the |List| may have more Like |:let-unpack| above, but the |List| may have more
@@ -2009,10 +2018,11 @@ This does NOT work: >
Example: > Example: >
:let [a, b; rest] = ["aval", "bval", 3, 4] :let [a, b; rest] = ["aval", "bval", 3, 4]
< <
:let [{name}, ..., ; {lastname}] .= {expr1}
:let [{name}, ..., ; {lastname}] += {expr1} :let [{name}, ..., ; {lastname}] += {expr1}
:let [{name}, ..., ; {lastname}] -= {expr1} :let [{name}, ..., ; {lastname}] -= {expr1}
Like above, but append/add/subtract the value for each :let [{name}, ..., ; {lastname}] .= {expr1}
:let [{name}, ..., ; {lastname}] ..= {expr1}
Like above, but add/subtract/append the value for each
|List| item. |List| item.
*:let=<<* *:let-heredoc* *:let=<<* *:let-heredoc*