From 16f7440cc7b59b7e5c79f593fedc117d2d16d7dd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 15 Mar 2026 19:02:49 -0400 Subject: 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 ``, then trims punctuation until a valid tag is found. - Set `keywordprg=:help!` by default. - Does not affect `CTRL-]`, that is still fully "tags" based. --- runtime/lua/vim/_meta/options.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'runtime/lua/vim/_meta/options.lua') 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. --- -- cgit