[vim/vim] remap shift-k for GDB/VIM files (Issue #18303)

10 views
Skip to first unread message

Simon Sobisch

unread,
Sep 15, 2025, 3:31:55 AM (3 days ago) Sep 15
to vim/vim, Subscribed
GitMensch created an issue (vim/vim#18303)

[...] an online-help (maybe as "popup") that leverages gdb, seems quite useful.
For example to get more information about br in a script we could get the output of gdb --batch -ex "help br" and present it to the user.

Originally posted by @GitMensch in #10649 (comment)

:help uses vim's good online help text file.
Shift-K currently tries to open a manpage which is quite useful for C/C++; as there isn't one for gdb or vim commands using that on a .gdb file leads to an error message.

(How) Can we change that mapping per file type and would it be reasonable to execute the command above in the case of gdb files to get the very good online help into a buffer, showing it in a popup window?
How to possibly do the same for vim files (or just remapping that to :help <expr>?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303@github.com>

Christian Brabandt

unread,
Sep 15, 2025, 2:05:28 PM (3 days ago) Sep 15
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18303)

I don't understand it. K is using the &keywordprg in vims ftplugin. So you can already use this for Vim script files. For gdb we don't have this, could be a nice side-project. But let's await the updated gdb runtime files first.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293345308@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 2:53:07 PM (3 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#18303)

That's something I explicit need to activate, no?

I suggest to override the default shift-k, which opens a manpage in a vim file on set and others - or raise an error "no manpage".
Of course I'd like to suggest moving from the default shift-k to internally call the :Man plugin instead (after allowing the "word under cursor" there) and auto-loading the plugin when using that the first time and it is still missing.

And yes: enabling shift+k for gdb scripts with the command noted above would also be nice.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293495239@github.com>

Christian Brabandt

unread,
Sep 15, 2025, 2:56:05 PM (3 days ago) Sep 15
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18303)

no, if you use filetype plugin on in your vimrc, than it should be set. I guess opening manpages from within vim scripts is probably rare.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293504066@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 3:04:24 PM (3 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#18303)

I guess opening manpages from within vim scripts is probably rare.

me, too; I'd say "more than rare" - therefore my suggestion to map that per default.

if you use filetype plugin on in your vimrc, than it should be set

Just tested with --cmd "filetype plugin on" and now that vim help works with shift-k.

Would you be fine with a change to:

  • let the filetype plugin (it would be defined there, no?) open the GDB command above, if it is a gdb-type file
  • enabling the filetype plugin on shift+k if not already done (I guess I need to reload the file afterwards, correct), letting it handle the query
  • open the Manpage using :Man <word> for "anything not otherwise defined" (again in the filetype plugin)?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293527321@github.com>

Christian Brabandt

unread,
Sep 15, 2025, 4:34:41 PM (3 days ago) Sep 15
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18303)

should be fine to set something up in GDBs filetype plugin. K should already work for manpages, for anything more sophisticated we would need to call a function and parse somehow the expression and use the 'keywordprg' option. Sourcing ftplugin/man.vim for the :Man command, seems a bit too much however. This sounds more like something for your personal after/ftplugin/man.vim script.

Note sure what you mean with if still not defined, as long this is setup up correctly in a filetype plugin and undone once the buffer is removed. However all of this must only be enabled when a user explicitly enables filetype plugins, nothing of such things should happen without it, that would be too unexpected.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293849493@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 4:43:04 PM (3 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#18303)

Note sure what you mean with if still not defined

I've meant if there was not filetype plugin taking over the command.

What about changing the default (non-filetype) shift+k to open the manpage in a split buffer (using MANPAGER="col -b" man word) instead of the current behaviour (maybe with a "legacy" setting if someone really wants his window to be hidden while watching a non-highlighted manpage)?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3293889270@github.com>

Christian Brabandt

unread,
Sep 16, 2025, 1:46:07 AM (2 days ago) Sep 16
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18303)

That would be a backwards incompatible change. Sounds more like something for an optional plugin, but does not neccessarily belong to Vim core.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3295552258@github.com>

dkearns

unread,
Sep 16, 2025, 7:04:15 AM (2 days ago) Sep 16
to vim/vim, Subscribed
dkearns left a comment (vim/vim#18303)

We're already doing this sort of thing for several filetypes. E.g.,

https://github.com/vim/vim/blob/b2113e511f49761e5fd4fb20781115e379765608/runtime/ftplugin/sh.vim#L56-L62


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18303/3297817556@github.com>

Reply all
Reply to author
Forward
0 new messages