When using set showcmd Vim shows partial commands in the last line of the screen. For example, in Normal mode when typing the command dt. the last line shows dt and then, when you hit . the command is complete and therefore nothing is shown.

Is there a way to show full commands? For example when typing dt.gU(, first dt. would be shown; and when starting to type the second command the first would be cleared, so that in the end only gU( would is displayed.

This could be useful for example in illustrating GIFs; and to check that you typed what you wanted if you face some unexpected result.

  • 1
    What is a full command? The dt is shown because it's the current operator pending. Once it's given a motion, it's no longer an operator pending. Suppose we went further, and did dt.gU(gu)daw or so. Is all of that "one full command", or is it four full commands, or something else? Commented Feb 12, 2015 at 20:19
  • @mixedmath for me that would count as 4 commands. The second paragraph of the answer tries to disambiguate what I mean. Commented Feb 12, 2015 at 20:24
  • 2
    From Vim's perspective, dt.gU( are 2 commands: dt. and gU(.... So what you really want is show some sort of command history (Vim is already showing the "full comamnds"). Commented Feb 12, 2015 at 20:35
  • @Carpetsmoker, yeah, that might be what I want. Thank you for editing the question title. Commented Feb 12, 2015 at 23:13
  • 3
    I've been poking in the Vim source code working on the normal history. In src/normal.c the code calls clear_showcmd() in several places (normal_cmd(), do_pending_operator(), end_visual_mode()). I'm playing with dumping to a file the showcmd_buf at those points, which was looking pretty good, but makes me pretty sure that you can't get what you want without similarly modifying the Vim source code and rebuilding it. Of course, doing so might be worth the hassle to make your gifs.
    – John O'M.
    Commented Feb 13, 2015 at 4:57

2 Answers 2


I couldn't find any way to do this in a regular Vim. However, if you are willing to patch Vim, the following may work for you.

The very simple patch (applied against Vim-7.4.052) disables the actual update to the screen that clears the history at the end of a normal command. It does this by returning whether or not showcmd_is_clear is set prior to updating the display,. (alternatively, you can comment out the if statement and leave just the one original return line. note: The patch below didn't paste very well; you may have to apply this by hand, though it is just a short one-liner. note: I did not comment out the actual display_showcmd() because it appears to be used in visual mode to update the display of the number of selected lines or other possibly other stuff. I have not extensively tested this.

--- src/normal.c    2015-02-14 00:21:23.286352257 -0500
+++ src/normal.c    2015-02-14 00:21:25.238352173 -0500
@@ -4029,6 +4029,7 @@
    /* Don't actually display something if there is nothing to clear. */
    if (showcmd_is_clear)
+   return;


The result looks like this:

Screencast showing the patch

A few interesting things to note:

  • This shows even simple movements, like j, k, b, etc.
  • The x command actually becomes dl in the showcmd_buf.
  • Commands that change the bottom line obliterate the showcmd area (for example, using the : command, or entering insert mode (at least in my setup))
  • The capture program stopped recording many strokes after I typed a ", but my key sequence is visible in the vim window for my long register specified yank.
  • Not shown in the cast, but hitting esc in normal mode shows ^[ in the showcmd area

Apart of John solution, there is another way to show all vim keystrokes which were pressed by using -w parameter which record all the characters that you type in the file. The problem is, that vim writes keystrokes only when you exit Vim. This is how VimGolf works.

To workaround this, Kana Natsuno came up with this single-line patch, which disables buffering of the -w option, so you have access to realtime stream of keystrokes. Then it's a matter of reading them (e.g. tail -f), parsing or you can try to display them in the statusbar (:set statusline).

Check out a custom build of Vim using Drew's live-stream-keystrokes branch of MacVim, to get the realtime stream of keystrokes.

Source: Vimprint - a Vim keystroke parser at Drew Neil blog

This is useful if you'd like to reveal the Vim pressed keystrokes in video tutorials or GIFs.

  • upvote just for the vimgolf link :)
    – icc97
    Commented Dec 22, 2022 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.