1

I open the diff files between 2 code revisions using git difftool. I can use :qa to close the current diff and go to the next one. Rather than pressing :qa repeatedly, I would like to use @:, but I get an error E30: No previous command line when I try this. I want to know if there is some way to get @: working in this case.

1
  • Use this instead of default git difftool
    – balki
    Commented Jan 5, 2023 at 20:59

1 Answer 1

1

The "colon" register tracks last command typed during current session. As you type :qa to quit from Vim, you cannot reuse it later.

So you need to do something else. Maybe create a mapping, maybe store your command in one of "letter" registers, maybe just hit "colon" and then "arrow up", etc. That's the matter of your personal preference.

3
  • 1
    Is that true even if viminfo saves registers?
    – D. Ben Knoble
    Commented Jan 5, 2023 at 14:09
  • 1
    (From testing, it appears the answer is "yes, it is true," but I'm surprised. This isn't mentioned in the help.)
    – D. Ben Knoble
    Commented Jan 5, 2023 at 14:12
  • 1
    @D.BenKnoble Only 0-9, a-z and "minus" are saved. Also, "slash" (though it is a slightly different story) and "unnamed" (which is just the pointer w/o real contents). Other registers are never saved by Vim and this is kind of expected. Though maybe it deserves a direct note in help.
    – Matt
    Commented Jan 5, 2023 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.