mirror of
https://github.com/neovim/neovim.git
synced 2026-04-20 22:35:33 +00:00
feat(help): super K (":help!") guesses tag at cursor #36205
Problem:
`K` in help files may fail in some noisy text. Example:
(`fun(config: vim.lsp.ClientConfig): boolean`)
^cursor
Solution:
- `:help!` (bang, no args) activates DWIM behavior: tries `<cWORD>`,
then trims punctuation until a valid tag is found.
- Set `keywordprg=:help!` by default.
- Does not affect `CTRL-]`, that is still fully "tags" based.
This commit is contained in:
@@ -5058,24 +5058,31 @@ local options = {
|
||||
abbreviation = 'kp',
|
||||
defaults = {
|
||||
condition = 'MSWIN',
|
||||
if_true = ':help',
|
||||
if_true = ':help!',
|
||||
if_false = ':Man',
|
||||
doc = '":Man", Windows: ":help"',
|
||||
},
|
||||
desc = [=[
|
||||
Program to use for the |K| command. Environment variables are
|
||||
expanded |:set_env|. ":help" may be used to access the Vim internal
|
||||
help. (Note that previously setting the global option to the empty
|
||||
value did this, which is now deprecated.)
|
||||
When the first character is ":", the command is invoked as a Vim
|
||||
Ex command prefixed with [count].
|
||||
When "man" or "man -s" is used, Vim will automatically translate
|
||||
a [count] for the "K" command to a section number.
|
||||
expanded |:set_env|.
|
||||
|
||||
Special cases:
|
||||
- ":help" opens the |word| at cursor using |:help|. (Note that
|
||||
previously setting the global option to the empty value did this,
|
||||
which is now deprecated.)
|
||||
- ":help!" performs |:help!| (DWIM) on the |WORD| at cursor.
|
||||
- If the value starts with ":", it is invoked as an Ex command
|
||||
prefixed with [count].
|
||||
- If "man" or "man -s", [count] is the manpage section number.
|
||||
|
||||
See |option-backslash| about including spaces and backslashes.
|
||||
|
||||
Example: >vim
|
||||
set keywordprg=:help!
|
||||
set keywordprg=man\ -s
|
||||
set keywordprg=:Man
|
||||
< This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
<
|
||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
security reasons.
|
||||
]=],
|
||||
expand = true,
|
||||
|
||||
Reference in New Issue
Block a user