vim :: recording

many times i accidently q and got the annoying “recording” message at the bottom. Some times even made crazy to quit out of vim.

So what is this recording thing in vim…
It actually records your keystrokes, and you can execute them later.

How to use it ?
In normal mode ( normal = !insert && !visual ), press q and an identifier for your recording (another key). This would start recording your keystrokes and the message “recording” will appear at the bottom of the screen. And to end the recording press q (in normal mode).

Summary -
qx -> start recording (in buffer x) . (in normal mode)
do any work
q -> stop recording, (in normal mode)

Example -
to add <html><body> at top and </body></html> at bottom of a page you can record keystrokes like this
qm1<Shift+g><Home><Insert><html><body><Esc>
<Shift+g><End><Insert><Right></body></head><Esc>q

Example Explained -
qm -> start recording ( to register m)
1<Shift-g><Home> -> go to start of the page
<Insert><html><body><Esc> -> enter insert mode and write <html><body>
<Shift-g><End> -> go to end of the page
<Insert></body></html><Esc> -> enter insert mode and write <html><body>
q -> stop recording

How to use the recorded keystrokes ?
@ and the keyword corresponding to your recording (in normal mode)
for example to use the above macro, we will type @m (see qm => record into register m)

Sometimes another annoying window open, when we accidently type q: (instead of :q, maybe)
It is commandline window. to quit out of it simply press enter or type :q (it wont quit the orignial buffer)

NB:
These recordings are not intelligent. They are just keystrokes recorded, and will be executed as such. You have to make your keystrokes intelligent.

My doubt : Reference -
:help q
:help q:
vim.org/Tip #144: recording keystrokes by “q” for repested jobs
is there any difference between this recording and macros ( in general and in vim) ?

References -
:help q
:help q:
vim.org/Tip #144: recording keystrokes by “q” for repested jobs

* Advanced Vim Tutorial - other strong features of vim.

11 Responses to “vim :: recording”

  1. TeoZilla Says:

    Thanks from a new Vim user
    Thanks, I am a new Vim user and I turned on the annoying recording mode accidentally. Not only did you help me to turn it off, I also learned that Vim has another feature I’ve been looking for in a text editor: the ability to record “macros” for frequently repeated actions.

    Can these recorded actions be repeated in a seperate files and on seperate occasions, or do they die when Vim is killed?

  2. Devraj Says:

    Thanks
    Thanks :)

    You have explained the recording feature in very lucid terms.

  3. Rohit Says:

    Nice tip
    It feels good to know what that annoying recording message really meant. Amen!!

  4. Siddharth Tuli Says:

    Good tip. I found it useful.

  5. Sciencebird Says:

    Thanks for the great info, many times I have quit vim not knowing what to do.

  6. None Says:

    Thank you for the help. Some how went in to recording and then I didn’t know what to do. This helped.

  7. David Holm Says:

    Thanks!!
    This has been annoying me for quite a while, sometimes I’m way too quick when typing and accidentally end up in the evil “recording” state.

  8. Joe Smith Says:

    Thanks a bunch. Jeez, I’ve been bothered by this for so long. Now that I know what it is, it actually seems like something I’ll use. Thanks :D

  9. matze Says:

    very nice ^–^ THX a loooot

  10. Tony Says:

    Thank you. That notice was becoming bothersome.

  11. Daniel d'Andrada Says:

    Just found myself in the same annoying situation of having to deal with the haunting “recording” message out of no where.

    Thanks a lot!

Leave a Reply