Show pressed keys in VIM normal mode statusline
Asked Answered
B

1

39

I use VIM, the Colemak keyboard layout, and a Microsoft Natural 4000 keyboard. Since the Natural 4000 has differently-shaped keys, I could not change the keycaps. This means each key is labeled with an "incorrect" key -- I press the key that says "O" and it types "Y".

That's fine in normal use, because I touch-type smoothly with Colemak and don't make many typos. But with VIM it presents a bit of a problem, because I often need to hit a key "out of sequence" -- i.e, just suddenly hit "g" without any context. For some reason that's harder to do, and I keep hitting the wrong keys.

I'd like to be able to hit a prefix key (say, the leader key twice -- \) and then have any further keys I hit within 1-2 seconds shown on the status line.

This way, I could quickly hit \ and then tap a key or two, and see what key it "really" is.

Any ideas how I could make that happen?

Back answered 3/5, 2011 at 11:43 Comment(0)
A
49

Try set this

:set showcmd

It displays your keystrokes in statusline as you enter them, without any need for a prefix key.

you can also turn it off by using below command in normal mode of vim (pressing Esc key).

:set noshowcmd
Astromancy answered 3/5, 2011 at 11:47 Comment(1)
This didn't work for me in vanilla vim: vim -u NONE or gvim -u NONE. Even when after running :set laststatus=2Chelate

© 2022 - 2024 — McMap. All rights reserved.