[vim/vim] Showcmd Option Shows Useless Keystrokes (Issue #11535)

140 views
Skip to first unread message

Joey H

unread,
Nov 12, 2022, 3:18:46 PM11/12/22
to vim/vim, Subscribed

Steps to reproduce

  1. Open a file in Vim (preferably with many lines of text)
  2. Type :set showcmd in a Vim instance
  3. Navigate down the file using j. Notice that it shows the j keystroke in the bottom right for a split second, but quickly disappears

Expected behaviour

One of two things should happen:

  1. These types of keys (j,k, h, l, Up arrow, Down arrow, etc.) should not be displayed as they are not useful to see in showcmd because they disappear right away
  2. The last command should persist (This would be a feature request as that does not currently happen for any command).

I have found a similar issue in neovim (which shows exactly what goes on in the video attached), but it was found to be an issue within vim itself.

I can submit a PR to fix this. Just let me know which of the above would be the better way (or another way not mentioned).

Version of Vim

9.0.813

Environment

OS: Arch Linux (6.0.8-arch1-1)
Terminal: Alacritty 0.11.0 (8dbaa0bb)
TERM: xterm-256color
Shell: Bash 5.1.8

Logs and stack traces

No response


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/11535@github.com>

Bram Moolenaar

unread,
Nov 12, 2022, 4:57:53 PM11/12/22
to vim/vim, Subscribed


> ### Steps to reproduce
>
> 1. Open a file in Vim (preferably with many lines of text)
> 2. Type `:set showcmd` in a Vim instance
> 3. Navigate down the file using `j`. Notice that it shows the `j`

> keystroke in the bottom right for a split second, but quickly
> disappears
>
> ### Expected behaviour

>
> One of two things should happen:
> 1. These types of keys (j,k, h, l, Up arrow, Down arrow, etc.) should

> not be displayed as they are not useful to see in showcmd because they
> disappear right away

I think you don't understand what 'showcmd' is for. It shows whatever
command is typed until it's done. There is no logic about what would be
useful to show or not, it intentionally just shows whatever was typed,
since it's completely unpredictable how long it takes to execute. Even
a simple "j" can take time, e.g. with slow syntax highlighting or when
an autocmd is triggered by it. Anyway, guessing if it's short enough to
show will require some magic way to decide what's worth to show, which
will never satisfy users completely. Just accept the brief display.

> 2. The last command should persist (This would be a feature request as

> that does not currently happen for any command).

That would be a completely different thing, and generally seeing what
was typed in the past is hardly ever useful. It should certainly not
show where 'showcmd' currently shows, since you can't tell if it's
something currently executing or something already done.

There have been ideas to show what's typed for demo purposes, but there
are tools for that, it doesn't need to be built into Vim.

The other reason would be when something unexpected happens and you want
to see what you actually typed. But that shouldn't show all the time,
only when you need it, and probably should be displayed very differently
from how 'showcmd' shows the keys. Probably just messages on the
command line. You could turn this issue in a feature request for that,
if you give some idea of how it would work.


> I have found [a similar
> issue](https://github.com/neovim/neovim/issues/13841) in neovim (which

> shows exactly what goes on in the video attached), but it was found to
> be an issue within vim itself.
>
> I can submit a PR to fix this. Just let me know which of the above
> would be the better way (or another way not mentioned).

It is working as intended, thus a fix is not desired.

--
CVS sux, men don't like commitment

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


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/11535/1312580515@github.com>

Joey H

unread,
Nov 12, 2022, 5:30:43 PM11/12/22
to vim/vim, Subscribed

Sounds good. Thanks for the explanation!


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/11535/1312586527@github.com>

Joey H

unread,
Nov 12, 2022, 5:30:48 PM11/12/22
to vim/vim, Subscribed

Closed #11535 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11535/issue_event/7797422619@github.com>

C.D. MacEachern

unread,
Aug 6, 2025, 12:41:41 PM8/6/25
to vim/vim, Subscribed
craigmac left a comment (vim/vim#11535)

Usecase where this constant flickering of 'j/k' movements are shown is distruptive: if you use a custom highlight like hl-User1..9 and (only possible in neovim I believe) move the showcmd location to the statusline (or tabline) by using the %S stl item. In my case I have a white text on blue background set so as I move around a buffer my stl is constantly flashing on/off when using j/k keys. If anyone comes across any workarounds for this I'd be happy to hear (other than just turning off showcmd, which I'm considering).


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/11535/3160856088@github.com>

Reply all
Reply to author
Forward
0 new messages