Gabriel Muñumel
Gabriel Muñumel

Reputation: 1876

How to know commands I've been typing?

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?

Upvotes: 13

Views: 12274

Answers (4)

Benoit
Benoit

Reputation: 79243

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.

Upvotes: 2

kenorb
kenorb

Reputation: 166919

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).

Upvotes: 1

alesplin
alesplin

Reputation: 1322

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.

Upvotes: 1

kev
kev

Reputation: 161974

You can use this setting:

:set showcmd

Type :help 'showcmd' to read more.

Upvotes: 19

Related Questions