[vim/vim] The man page opened via ShKeywordPrg doesn't close upon hitting q (Issue #21204)

11 views
Skip to first unread message

Enrico Maria De Angelis

unread,
Sep 1, 2026, 2:22:20 AM (3 days ago) Sep 1
to vim/vim, Subscribed
Aster89 created an issue (vim/vim#21204)

Steps to reproduce

Assuming you have a ~/.bash_profile, run vim --clean ~/.bash_profile, then move to a keyword and press K. I think it's fundamental that the man page of that keyword is longer than the space available in the window that will open up.

The pager will open up in a terminal split window via this line

https://github.com/vim/vim/blob/5c9c5a43c183e8d1e4156b468343d0aa0f3b081c/runtime/ftplugin/sh.vim#L58

Now, press q to close it.

Expected behaviour

I'd expect the split window to close entirely, but it isn't. It becomes empty, though.

Version of Vim

5c9c5a4

Environment

Operating system: up-to-date ArchLinux
Terminal: URxvt
Value of $TERM: rxvt-unicode-256color
Shell: Bash

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21204@github.com>

Christian Brabandt

unread,
Sep 1, 2026, 7:36:03 AM (3 days ago) Sep 1
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21204)

It's a normal split window, you shouldn't expect q to close it. It seems like you'd rather prefer the non-terminal version of this.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Enrico Maria De Angelis

unread,
Sep 1, 2026, 9:37:28 AM (3 days ago) Sep 1
to vim/vim, Subscribed
Aster89 left a comment (vim/vim#21204)

Well, in a normal spit window q does not what it does here, right? I'm not claiming q should close split windows. I'm just saying that here the split window is used to show a man page, so I'd expect that the necessary mapping would in place for doing the right thing. There's no reason, I think, why I'd want that split window to remain open and empty after I pressed q.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Christian Brabandt

unread,
Sep 1, 2026, 4:58:21 PM (3 days ago) Sep 1
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21204)

What mapping are you talking about? In a normal split window, q does nothing, unless you have it mapped it to some function.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 1, 2026, 9:24:47 PM (3 days ago) Sep 1
to vim/vim, Subscribed
habamax left a comment (vim/vim#21204)

Well, in a normal spit window q does not what it does here, right? I'm not claiming q should close split windows. I'm just saying that here the split window is used to show a man page, so I'd expect that the necessary mapping would in place for doing the right thing. There's no reason, I think, why I'd want that split window to remain open and empty after I pressed q.

If I press q there, it just waits for the register to save macro recording as it should if there was no user q mapping defined.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Enrico Maria De Angelis

unread,
Sep 2, 2026, 1:23:47 AM (2 days ago) Sep 2
to vim/vim, Subscribed
Aster89 left a comment (vim/vim#21204)

It's a normal split window, you shouldn't expect q to close it.

In a normal split window, I don't expect q to close it. I expect q to do what it always does, which is

just waits for the register to save macro recording

But in a split window opened via Shift+k in ~/.bash_profile on a word that a man page long enough, q doesn't do that. In this case q quits the pager.

Yes, it does that not because of a mapping, but simply because that's a terminal window where man is run, and q is doing what it does in that case.

What I'm saying is that the behavior of quitting the man page without also closing the split window is not useful, because the surviving empty window has no use. So I'm suggesting that we should conjure a way to have that terminal window to be automatically closed when the pager quits.


Just in case we are not on the same page about what I'm observing, below is a screencast recorded with asciinema:

asciicast

plus a version of it recorded as a GIF, where you can also see the keystrokes:

Image: Image (view on web)

(I've verified that the behavior would be the same if I had passed the --clean flag, even if that's not what I've done when I recorded.)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 2, 2026, 2:07:29 AM (2 days ago) Sep 2
to vim/vim, Subscribed
habamax left a comment (vim/vim#21204)
command! -buffer -nargs=1 ShKeywordPrg call term_start(['bash', '-c', 'help "$1" 2>/dev/null || man "$1"', '--', <q-args>], {'term_finish': 'close'}) 


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Maxim Kim

unread,
Sep 2, 2026, 7:46:03 AM (2 days ago) Sep 2
to vim/vim, Subscribed
habamax left a comment (vim/vim#21204)

you can go another way:

command! -nargs=1 ShKeywordPrg call term_start(['bash', '-c', 'help "$1" 2>/dev/null || man "$1" | col -b', '--', <q-args>])

and then have a mapping for a terminal buffer to quit on q:

au TerminalWinOpen * nnoremap <buffer> q <cmd>bd<cr>

asciicast


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

dkearns

unread,
Sep 2, 2026, 8:35:28 AM (2 days ago) Sep 2
to vim/vim, Subscribed
dkearns left a comment (vim/vim#21204)

ping @Konfekt


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Enno

unread,
Sep 2, 2026, 12:15:35 PM (2 days ago) Sep 2
to vim/vim, Subscribed
Konfekt left a comment (vim/vim#21204)

Happy to go with @habamax's

command! -nargs=1 ShKeywordPrg call term_start(['bash', '-c', 'help "$1" 2>/dev/null || man "$1" | col -b', '--', <q-args>])


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages