diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-03-15 19:02:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-15 19:02:49 -0400 |
| commit | 16f7440cc7b59b7e5c79f593fedc117d2d16d7dd (patch) | |
| tree | 6794a10d9c955f0ce283a16268ed8aa28c2d2cb2 /runtime/lua/vim/_meta/options.lua | |
| parent | 747da13f44ef895e51081065546f3c465637a615 (diff) | |
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.
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/options.lua | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 6652045c87..ab24f03595 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3834,20 +3834,27 @@ vim.go.keymodel = vim.o.keymodel vim.go.km = vim.go.keymodel --- 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 --- security reasons. --- |
