3

Vim users, tell me how many times you remember looking down at your status bar and unexpectedly seeing recording in bold green. It's been recording your keystrokes since you-dont-know-when.

This has happened to me no less than twenty times by now. I don't know how it is even possible for me to press q so often, and it's somewhat a possibility that some errant plugin bind is resulting in an unterminated macro recording.

It occurs to me that the best thing would be if there was somehow a way to bind an escape keystroke that aborts the recording and restores the content of whatever register I happen to be accidentally recording over.

But that's really going above and beyond. I'd simply like to know which register it is that I happen to be currently recording over. Maybe I'll go take a peek at it to see how long its been recording for. Or I'll go and clear it out to keep everything nice and tidy.

Is this even possible?

jamessan
  • 11,045
  • 2
  • 38
  • 53
Steven Lu
  • 2,251
  • 15
  • 26
  • You can see what is in your registers via :reg. Probably not the answer you are looking for, but really all I need. – Peter Rincker Nov 04 '15 at 00:25
  • Yes, I suppose I could basically start typing a recognizable sequence prior to ending the recording and then use :reg to hunt that down. It's not a direct answer to the question but it's a little bit better than nothing – Steven Lu Nov 04 '15 at 00:26
  • If you are anything like me then your mind can only juggle so many things in your head. Mine is 2, anything more is just not happening. So I use certain registers for yank/pasting (a, b) and different ones for macros (q, w). Even more interesting I also carry this trend of using only certain lettres for marks (m, n). So I doubt you will really need to look very hard when you use :reg. Not to mention one typically uses a register close the the time of a yank or recording. Best advice: become a better typist. Secondary advice: Just use :reg – Peter Rincker Nov 04 '15 at 00:34
  • This is a typing problem. – romainl Nov 04 '15 at 09:00
  • 1
    If it's just q you have a problem with you could set your mappings such that q doesn't start recording (perhaps make it play a loud buzzing sound to train you to not press it), and/or to instead use F7 to start recording? –  Nov 04 '15 at 10:01
  • @PeterRincker I only ever use a single register for macros, q for obvious reasons... Now the main issue is not the placement of the q key per se, it's that somehow Vim ends up recording and I got no idea how it ended up in that state. – Steven Lu Nov 04 '15 at 14:31

1 Answers1

2

You can display the current register in your statusline (vim-airline) with

%{v:register}
cee
  • 321
  • 2
  • 3