Merge pull request #33456 from zeertzjq/vim-eded336

vim-patch: improve 'wildmode' description
This commit is contained in:
zeertzjq
2025-04-14 08:44:35 +08:00
committed by GitHub
3 changed files with 144 additions and 114 deletions

View File

@@ -7103,55 +7103,65 @@ A jump table for the options with a short description can be found at |Q_op|.
*'wildmode'* *'wim'* *'wildmode'* *'wim'*
'wildmode' 'wim' string (default "full") 'wildmode' 'wim' string (default "full")
global global
Completion mode that is used for the character specified with Completion mode used for the character specified with 'wildchar'.
'wildchar'. It is a comma-separated list of up to four parts. Each This option is a comma-separated list of up to four parts,
part specifies what to do for each consecutive use of 'wildchar'. The corresponding to the first, second, third, and fourth presses of
first part specifies the behavior for the first use of 'wildchar', 'wildchar'. Each part is a colon-separated list of completion
The second part for the second use, etc. behaviors, which are applied simultaneously during that phase.
Each part consists of a colon separated list consisting of the The possible behavior values are:
following possible values: "" Only complete (insert) the first match. No further
"" Complete only the first match. matches are cycled or listed.
"full" Complete the next full match. After the last match, "full" Complete the next full match. Cycles through all
the original string is used and then the first match matches, returning to the original input after the
again. Will also start 'wildmenu' if it is enabled. last match. If 'wildmenu' is enabled, it will be
"longest" Complete till longest common string. If this doesn't shown.
result in a longer string, use the next part. "longest" Complete to the longest common substring. If this
"list" When more than one match, list all matches. doesn't extend the input, the next 'wildmode' part is
"lastused" When completing buffer names and more than one buffer used.
matches, sort buffers by time last used (other than "list" If multiple matches are found, list all of them.
the current buffer). "lastused" When completing buffer names, sort them by most
"noselect" Do not pre-select first menu item and start 'wildmenu' recently used (excluding the current buffer). Only
if it is enabled. applies to buffer name completion.
When there is only a single match, it is fully completed in all cases "noselect" If 'wildmenu' is enabled, show the menu but do not
except when "noselect" is present. preselect the first item.
If only one match exists, it is completed fully, unless "noselect" is
specified.
Examples of useful colon-separated values: Some useful combinations of colon-separated values:
"longest:full" Like "longest", but also start 'wildmenu' if it is "longest:full" Start with the longest common string and show
enabled. Will not complete to the next full match. 'wildmenu' (if enabled). Does not cycle
"list:full" When more than one match, list all matches and through full matches.
complete first match. "list:full" List all matches and complete first match.
"list:longest" When more than one match, list all matches and "list:longest" List all matches and complete till the longest
complete till longest common string. common prefix.
"list:lastused" When more than one buffer matches, list all matches "list:lastused" List all matches. When completing buffers,
and sort buffers by time last used (other than the sort them by most recently used (excluding the
current buffer). current buffer).
"noselect:lastused" Do not preselect the first item in 'wildmenu'
if it is active. When completing buffers,
sort them by most recently used (excluding the
current buffer).
Examples: >vim Examples: >vim
set wildmode=full set wildmode=full
< Complete first full match, next match, etc. (the default) >vim < Complete full match on every press (default behavior) >vim
set wildmode=longest,full set wildmode=longest,full
< Complete longest common string, then each full match >vim < First press: longest common substring
Second press: cycle through full matches >vim
set wildmode=list:full set wildmode=list:full
< List all matches and complete each full match >vim < First press: list all matches and complete the first one >vim
set wildmode=list,full set wildmode=list,full
< List all matches without completing, then each full match >vim < First press: list matches only
Second press: complete full matches >vim
set wildmode=longest,list set wildmode=longest,list
< Complete longest common string, then list alternatives >vim < First press: longest common substring
Second press: list all matches >vim
set wildmode=noselect:full set wildmode=noselect:full
< Display 'wildmenu' without completing, then each full match >vim < Show 'wildmenu' without completing or selecting on first press
Cycle full matches on second press >vim
set wildmode=noselect:lastused,full set wildmode=noselect:lastused,full
< Same as above, but sort buffers by time last used. < Same as above, but buffer matches are sorted by time last used
More info here: |cmdline-completion|. More info here: |cmdline-completion|.
*'wildoptions'* *'wop'* *'wildoptions'* *'wop'*

View File

@@ -7756,76 +7756,86 @@ vim.o.wmnu = vim.o.wildmenu
vim.go.wildmenu = vim.o.wildmenu vim.go.wildmenu = vim.o.wildmenu
vim.go.wmnu = vim.go.wildmenu vim.go.wmnu = vim.go.wildmenu
--- Completion mode that is used for the character specified with --- Completion mode used for the character specified with 'wildchar'.
--- 'wildchar'. It is a comma-separated list of up to four parts. Each --- This option is a comma-separated list of up to four parts,
--- part specifies what to do for each consecutive use of 'wildchar'. The --- corresponding to the first, second, third, and fourth presses of
--- first part specifies the behavior for the first use of 'wildchar', --- 'wildchar'. Each part is a colon-separated list of completion
--- The second part for the second use, etc. --- behaviors, which are applied simultaneously during that phase.
--- ---
--- Each part consists of a colon separated list consisting of the --- The possible behavior values are:
--- following possible values: --- "" Only complete (insert) the first match. No further
--- "" Complete only the first match. --- matches are cycled or listed.
--- "full" Complete the next full match. After the last match, --- "full" Complete the next full match. Cycles through all
--- the original string is used and then the first match --- matches, returning to the original input after the
--- again. Will also start 'wildmenu' if it is enabled. --- last match. If 'wildmenu' is enabled, it will be
--- "longest" Complete till longest common string. If this doesn't --- shown.
--- result in a longer string, use the next part. --- "longest" Complete to the longest common substring. If this
--- "list" When more than one match, list all matches. --- doesn't extend the input, the next 'wildmode' part is
--- "lastused" When completing buffer names and more than one buffer --- used.
--- matches, sort buffers by time last used (other than --- "list" If multiple matches are found, list all of them.
--- the current buffer). --- "lastused" When completing buffer names, sort them by most
--- "noselect" Do not pre-select first menu item and start 'wildmenu' --- recently used (excluding the current buffer). Only
--- if it is enabled. --- applies to buffer name completion.
--- When there is only a single match, it is fully completed in all cases --- "noselect" If 'wildmenu' is enabled, show the menu but do not
--- except when "noselect" is present. --- preselect the first item.
--- If only one match exists, it is completed fully, unless "noselect" is
--- specified.
--- ---
--- Examples of useful colon-separated values: --- Some useful combinations of colon-separated values:
--- "longest:full" Like "longest", but also start 'wildmenu' if it is --- "longest:full" Start with the longest common string and show
--- enabled. Will not complete to the next full match. --- 'wildmenu' (if enabled). Does not cycle
--- "list:full" When more than one match, list all matches and --- through full matches.
--- complete first match. --- "list:full" List all matches and complete first match.
--- "list:longest" When more than one match, list all matches and --- "list:longest" List all matches and complete till the longest
--- complete till longest common string. --- common prefix.
--- "list:lastused" When more than one buffer matches, list all matches --- "list:lastused" List all matches. When completing buffers,
--- and sort buffers by time last used (other than the --- sort them by most recently used (excluding the
--- current buffer). --- current buffer).
--- "noselect:lastused" Do not preselect the first item in 'wildmenu'
--- if it is active. When completing buffers,
--- sort them by most recently used (excluding the
--- current buffer).
--- ---
--- Examples: --- Examples:
--- ---
--- ```vim --- ```vim
--- set wildmode=full --- set wildmode=full
--- ``` --- ```
--- Complete first full match, next match, etc. (the default) --- Complete full match on every press (default behavior)
--- ---
--- ```vim --- ```vim
--- set wildmode=longest,full --- set wildmode=longest,full
--- ``` --- ```
--- Complete longest common string, then each full match --- First press: longest common substring
--- Second press: cycle through full matches
--- ---
--- ```vim --- ```vim
--- set wildmode=list:full --- set wildmode=list:full
--- ``` --- ```
--- List all matches and complete each full match --- First press: list all matches and complete the first one
--- ---
--- ```vim --- ```vim
--- set wildmode=list,full --- set wildmode=list,full
--- ``` --- ```
--- List all matches without completing, then each full match --- First press: list matches only
--- Second press: complete full matches
--- ---
--- ```vim --- ```vim
--- set wildmode=longest,list --- set wildmode=longest,list
--- ``` --- ```
--- Complete longest common string, then list alternatives --- First press: longest common substring
--- Second press: list all matches
--- ---
--- ```vim --- ```vim
--- set wildmode=noselect:full --- set wildmode=noselect:full
--- ``` --- ```
--- Display 'wildmenu' without completing, then each full match --- Show 'wildmenu' without completing or selecting on first press
--- Cycle full matches on second press
--- ---
--- ```vim --- ```vim
--- set wildmode=noselect:lastused,full --- set wildmode=noselect:lastused,full
--- ``` --- ```
--- Same as above, but sort buffers by time last used. --- Same as above, but buffer matches are sorted by time last used
--- More info here: `cmdline-completion`. --- More info here: `cmdline-completion`.
--- ---
--- @type string --- @type string

View File

@@ -10133,55 +10133,65 @@ local options = {
flags = true, flags = true,
deny_duplicates = false, deny_duplicates = false,
desc = [=[ desc = [=[
Completion mode that is used for the character specified with Completion mode used for the character specified with 'wildchar'.
'wildchar'. It is a comma-separated list of up to four parts. Each This option is a comma-separated list of up to four parts,
part specifies what to do for each consecutive use of 'wildchar'. The corresponding to the first, second, third, and fourth presses of
first part specifies the behavior for the first use of 'wildchar', 'wildchar'. Each part is a colon-separated list of completion
The second part for the second use, etc. behaviors, which are applied simultaneously during that phase.
Each part consists of a colon separated list consisting of the The possible behavior values are:
following possible values: "" Only complete (insert) the first match. No further
"" Complete only the first match. matches are cycled or listed.
"full" Complete the next full match. After the last match, "full" Complete the next full match. Cycles through all
the original string is used and then the first match matches, returning to the original input after the
again. Will also start 'wildmenu' if it is enabled. last match. If 'wildmenu' is enabled, it will be
"longest" Complete till longest common string. If this doesn't shown.
result in a longer string, use the next part. "longest" Complete to the longest common substring. If this
"list" When more than one match, list all matches. doesn't extend the input, the next 'wildmode' part is
"lastused" When completing buffer names and more than one buffer used.
matches, sort buffers by time last used (other than "list" If multiple matches are found, list all of them.
the current buffer). "lastused" When completing buffer names, sort them by most
"noselect" Do not pre-select first menu item and start 'wildmenu' recently used (excluding the current buffer). Only
if it is enabled. applies to buffer name completion.
When there is only a single match, it is fully completed in all cases "noselect" If 'wildmenu' is enabled, show the menu but do not
except when "noselect" is present. preselect the first item.
If only one match exists, it is completed fully, unless "noselect" is
specified.
Examples of useful colon-separated values: Some useful combinations of colon-separated values:
"longest:full" Like "longest", but also start 'wildmenu' if it is "longest:full" Start with the longest common string and show
enabled. Will not complete to the next full match. 'wildmenu' (if enabled). Does not cycle
"list:full" When more than one match, list all matches and through full matches.
complete first match. "list:full" List all matches and complete first match.
"list:longest" When more than one match, list all matches and "list:longest" List all matches and complete till the longest
complete till longest common string. common prefix.
"list:lastused" When more than one buffer matches, list all matches "list:lastused" List all matches. When completing buffers,
and sort buffers by time last used (other than the sort them by most recently used (excluding the
current buffer). current buffer).
"noselect:lastused" Do not preselect the first item in 'wildmenu'
if it is active. When completing buffers,
sort them by most recently used (excluding the
current buffer).
Examples: >vim Examples: >vim
set wildmode=full set wildmode=full
< Complete first full match, next match, etc. (the default) >vim < Complete full match on every press (default behavior) >vim
set wildmode=longest,full set wildmode=longest,full
< Complete longest common string, then each full match >vim < First press: longest common substring
Second press: cycle through full matches >vim
set wildmode=list:full set wildmode=list:full
< List all matches and complete each full match >vim < First press: list all matches and complete the first one >vim
set wildmode=list,full set wildmode=list,full
< List all matches without completing, then each full match >vim < First press: list matches only
Second press: complete full matches >vim
set wildmode=longest,list set wildmode=longest,list
< Complete longest common string, then list alternatives >vim < First press: longest common substring
Second press: list all matches >vim
set wildmode=noselect:full set wildmode=noselect:full
< Display 'wildmenu' without completing, then each full match >vim < Show 'wildmenu' without completing or selecting on first press
Cycle full matches on second press >vim
set wildmode=noselect:lastused,full set wildmode=noselect:lastused,full
< Same as above, but sort buffers by time last used. < Same as above, but buffer matches are sorted by time last used
More info here: |cmdline-completion|. More info here: |cmdline-completion|.
]=], ]=],
full_name = 'wildmode', full_name = 'wildmode',