patch 9.1.1138: cmdline completion for :hi is too simplistic

Problem:  Existing cmdline completion for :highlight was barebone and
          only completed the highlight group names.

Solution: Implement full completion for the highlight group arguments
          such as guifg and cterm. If the user tries to complete
          immediately after the '=' (e.g. `hi Normal guifg=<Tab>`), the
          completion will fill in the existing value, similar to how
          cmdline completion for options work (Yee Cheng Chin).

closes: #16712

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yee Cheng Chin
2025-02-23 09:32:47 +01:00
committed by Christian Brabandt
parent f4b36417e8
commit a7b8120820
12 changed files with 627 additions and 89 deletions

View File

@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2025 Feb 11
*version9.txt* For Vim version 9.1. Last change: 2025 Feb 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41573,8 +41573,11 @@ Include the "linematch" algorithm for the 'diffopt' setting. This aligns
changes between buffers on similar lines improving the diff highlighting in
Vim
Adjusted default values ~
-----------------------
*changed-9.2*
Changed~
-------
Default values: ~
- the default 'history' option value has been increased to 200 and removed
from |defaults.vim|
- the default 'backspace' option for Vim has been set to "indent,eol,start"
@ -41584,61 +41587,69 @@ Adjusted default values ~
- the default value of the 'keyprotocol' option has been updated and support
for the ghostty terminal emulator (using kitty protocol) has been added
*changed-9.2*
Changed~
-------
- use 'smoothscroll' logic for CTRL-F and CTRL-B for pagewise scrolling
- use 'smoothscroll' logic for CTRL-D and CTRL-U for half-pagewise scrolling
- the default for 'commentstring' contains whitespace padding to have
automatic comments look nicer |comment-install|
- 'completeopt' is now a |global-local| option.
- 'nrformats' accepts the new "blank" suboption, to determine a signed or
unsigned number based on whitespace in front of a minus sign.
- allow to specify a priority when defining a new sign |:sign-define|
- provide information about function arguments using the get(func, "arity")
function |get()-func|
- |:bwipe| also wipes jumplist and tagstack data
- moving in the buffer list using |:bnext| and similar commands, behaves as
documented and skips help buffers (if not run from a help buffer, else
moves to the next/previous help buffer).
Completion: ~
- allow to complete directories from 'cdpath' for |:cd| and similar commands,
add the "cd_in_path" completion type for e.g. |:command-complete| and
|getcompletion()|
- allow to complete shell commands and files using the new shellcmdline
completion type using |:command-complete| and |getcmdcomplpat()|
- add 'cpoptions' flag "z" |cpo-z|, to disable some (traditional) vi
behaviour/inconsistency (see |d-special| and |cw|).
- allow to specify additional attributes in the completion menu (allows to
mark deprecated attributes from LSP server) |complete-items|
- the regex engines match correctly case-insensitive multi-byte characters
(and apply proper case folding)
- the completed word and completion type are provided when handling the
|CompleteDone| autocommand in the |v:event| dictionary
- |complete_info()| returns the list of matches shown in the poppu menu via
the "matches" key
- New option value for 'completeopt':
"nosort" - do not sort completion results
"preinsert" - highlight to be inserted values
- handle multi-line completion as expected
- improved commandline completion for the |:hi| command
Options: ~
- the default for 'commentstring' contains whitespace padding to have
automatic comments look nicer |comment-install|
- 'completeopt' is now a |global-local| option.
- 'nrformats' accepts the new "blank" suboption, to determine a signed or
unsigned number based on whitespace in front of a minus sign.
- add 'cpoptions' flag "z" |cpo-z|, to disable some (traditional) vi
behaviour/inconsistency (see |d-special| and |cw|).
- 'rulerformat' now supports the |stl-%!| item
- use 'smoothscroll' logic for CTRL-F / CTRL-B for pagewise scrolling
and CTRL-D / CTRL-U for half-pagewise scrolling
Ex commands: ~
- allow to specify a priority when defining a new sign |:sign-define|
- |:bwipe| also wipes jumplist and tagstack data
- moving in the buffer list using |:bnext| and similar commands, behaves as
documented and skips help buffers (if not run from a help buffer, else
moves to the next/previous help buffer).
- |:keeppatterns| preserves the last substitute pattern when used with |:s|
Functions: ~
- provide information about function arguments using the get(func, "arity")
function |get()-func|
- |setqflist()| and |setloclist()| can optionally try to preserve the current
selection in the quickfix list with the "u" action.
- allow to pass local Vim script variables to python interpreter |py3eval()|
- |getwininfo()| now also returns the "leftcol" property for a window
- |v:stacktrace| The stack trace of the exception most recently caught and
not finished
- Add the optional {opts} |Dict| argument to |getchar()| to control: cursor
behaviour, return type and whether or not to simplify the returned key
Others: ~
- the regex engines match correctly case-insensitive multi-byte characters
(and apply proper case folding)
- the putty terminal is detected using an |TermResponse| autocommand in
|defaults.vim| and Vim switches to a dark background
- the |help-TOC| package is included to ease navigating the documentation.
- an interactive tutor plugin has been included |vim-tutor-mode|, can be
started via |:Tutor|
- improve the |vimtutor| and add a second chapter for more advanced tips
- allow to pass local Vim script variables to python interpreter |py3eval()|
- |getwininfo()| now also returns the "leftcol" property for a window
- 'rulerformat' now supports the |stl-%!| item
- the completed word and completion type are provided when handling the
|CompleteDone| autocommand in the |v:event| dictionary
- |complete_info()| returns the list of matches shown in the poppu menu via
the "matches" key
- |v:stacktrace| The stack trace of the exception most recently caught and
not finished
- New option value for 'completeopt':
"nosort" - do not sort completion results
"preinsert" - highlight to be inserted values
- add |dist#vim9#Launch()| and |dist#vim9#Open()| to the |vim-script-library|
and decouple it from |netrw|
- new digraph "APPROACHES THE LIMIT" using ".="
- Add the optional {opts} |Dict| argument to |getchar()| to control: cursor
behaviour, return type and whether or not to simplify the returned key
- handle multi-line completion as expected
*added-9.2*
Added ~