13

I'm using gVim and I would like to know if there is a way to see the commands I've been typing.

For example, when I pressed the visual mode (v) I've got message -- Visual --, but I don't know which letters I've been pressing so far.

Is there a way to permanent see which characters/commands I've typing?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Gabriel Muñumel
  • 1,876
  • 6
  • 34
  • 57

4 Answers4

19

You can use this setting:

:set showcmd

Type :help 'showcmd' to read more.

jamessan
  • 41,569
  • 8
  • 85
  • 85
kev
  • 155,172
  • 47
  • 273
  • 272
  • Thanks for the answer but it isn't working. I used `:set showcmd` as you suggested but when i enter into the visual mode is not showing the letters i pressed, only appears the `--Visual --` tag. – Gabriel Muñumel Mar 11 '12 at 15:50
  • Well, i'm using `viw`, that select the inner word in visual mode. And i want to see what i'm typing. I can't believe Vi/Vim haven't something for this. :( – Gabriel Muñumel Mar 11 '12 at 21:52
  • 2
    After you `:set showcmd` When you type `vi` it will show on the lower right of the screen. When you type `w` it will all disappear. – Dimitar Slavchev Apr 25 '12 at 09:32
  • NOTE: This can be slow over SSH just like "set relativenumber" can. – dza Jan 06 '17 at 11:16
2

You could set this up:

alias vim="vim -W ~/.last_vim_session_key_pressed"

But this file is written only when you exit vim. You can source it with vim -s but beware, with vim gui versions you can have problems.

Victor S.
  • 2,510
  • 3
  • 22
  • 35
Benoit
  • 76,634
  • 23
  • 210
  • 236
1

There is a tricky 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 as Benoit already said.

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 live video tutorials (or GIFs).

Community
  • 1
  • 1
kenorb
  • 155,785
  • 88
  • 678
  • 743
1

Check your home directory for a .viminfo file.

This will have, among other things, a history from newest to oldest of recent commands you've typed.

alesplin
  • 1,332
  • 14
  • 23
  • Could it be but not exactly what i want. I dont want to check history or any info related to the last command typed. Would like to see the command in a more interactive way: while i'm pressing it. – Gabriel Muñumel Mar 12 '12 at 04:11