What is Vim recording and how can it be disabled?
Asked Answered
B

6

917

I keep seeing the recording message at the bottom of my gVim 7.2 window.

What is it and how do I turn it off?

Brancusi answered 6/10, 2009 at 20:3 Comment(3)
To turn off vim recording for good, add map q <Nop> to your .vimrc file.Sulcate
I can't believe you want to turn recording off! I would show a really annoying popup 'Are you sure?' if one asks to turn it off (or probably would like to give options like the Windows 10 update gives).Tepee
Related: How do I exit the Vim editor?Pentalpha
E
1305

You start recording by q<letter> and you can end it by typing q again.

Recording is a really useful feature of Vim.

It records everything you type. You can then replay it simply by typing @<letter>. Record search, movement, replacement...

One of the best feature of Vim IMHO.

Enzootic answered 6/10, 2009 at 20:8 Comment(13)
As seen other places, it's q followed by a register. A really cool (and possibly non-intuitive) part of this is that these are the same registers used by things like delete, yank, and put. This means that you can yank text from the editor into a register, then execute it as a command.Cocks
One more thing to note is you can hit any number before the @ to replay the recording that many times like (100@<letter>) will play your actions 100 timesIbarra
You could add it afterward, by editing the register with put/yank. But I don't know why you'd want to turn recording on or off as part of a macro. ('q' doesn't affect anything when typed in insert mode.)Dorsett
Hey @Jefromi, do you know what registers are used by delete, yank and put? Or are they custom ones only accessible by vimSpermic
@Wade " - it's called the default register.Cocks
@N0thing What, you mean what if you wanted a recording which let you create another recording?Omland
and how to turn off was also the questionPronounced
Cool but wrong key, i can't recall how many billion time i want to :q to quit and it go to recording. It happen because i type q too fast and then try to redo :q and it go to recording.Subservient
A bit of dissent here: vim is OK, but the first thing I do in every environment is to set compatible. You know, if I wanted all those 'smart' features, I'd use emacs; I use vi for its combination of simplicity, efficiency and portability.Holloman
That q does not help. No reaction. Looking at vim I am proud for all programmers of the world that greatly moved the requirements and convenience of technology during last 40 years. Even Microsoft starts to look well in comparison.Engedi
What if you need to use the letter q in your recording? How would you use it without ending the recording?Gabi
A few people here see this as a very powerful tool, so now I'm curious: what so good about it? Can you give a specific situation where recording is useful? I'm wondering what I am missing!Springhouse
@Springhouse One sort of simple case is when you have some key word you want to replace in the buffer, but not every instance: it could be that only every third instance of the keyword is one you want to replace. So that would involve a pattern of something like '3nce<newtext>' repeated many many times. If you record it in register 'q', you could run 1000@q to run the sequence 1000 times and if you set nowrapscan, it can save a lot of repetitionVerda
J
116

Type :h recording to learn more.

                           *q* *recording*
q{0-9a-zA-Z"}           Record typed characters into register {0-9a-zA-Z"}
                        (uppercase to append).  The 'q' command is disabled
                        while executing a register, and it doesn't work inside
                        a mapping.  {Vi: no recording}

q                       Stops recording.  (Implementation note: The 'q' that
                        stops recording is not stored in the register, unless
                        it was the result of a mapping)  {Vi: no recording}


                                                        *@*
@{0-9a-z".=*}           Execute the contents of register {0-9a-z".=*} [count]
                        times.  Note that register '%' (name of the current
                        file) and '#' (name of the alternate file) cannot be
                        used.  For "@=" you are prompted to enter an
                        expression.  The result of the expression is then
                        executed.  See also |@:|.  {Vi: only named registers}
Jayme answered 6/10, 2009 at 20:17 Comment(0)
E
66

Typing q starts macro recording, and the recording stops when the user hits q again.

As Joey Adams mentioned, to disable recording, add the following line to .vimrc in your home directory:

map q <Nop>
Endowment answered 13/2, 2015 at 14:16 Comment(1)
only answer about "how to turn off" part of the question. Well, it makes recording inaccessible, effectively turning it off - at least noone expects vi to have a separate thread for this code, I guess, including me.Pronounced
S
45

It sounds like you have macro recording turned on. To shut it off, press q.

Refer to ":help recording" for further information.

Related links:

Solangesolano answered 6/10, 2009 at 20:7 Comment(0)
B
31

As others have said, it's macro recording, and you turn it off with q. Here's a nice article about how-to and why it's useful.

Bloomsbury answered 6/10, 2009 at 20:10 Comment(0)
S
27

It means you're in "record macro" mode. This mode is entered by typing q followed by a register name, and can be exited by typing q again.

Suet answered 6/10, 2009 at 20:6 Comment(2)
It's actually entered by typing q followed by any register name, which is 0-9, a-z, A-Z, and ".Jayme
Actually, it's q{0-9a-zA-Z"} - you can record a macro into any register (named by digit, letter, "). In case you actually want to use it... you execute the contents of a register with @<register>. See :help q and :help @ if you're interested in using it.Cocks

© 2022 - 2024 — McMap. All rights reserved.