Questions tagged [undo-redo]

Question about navigation in the undo history, undoing, and redoing changes

Filter by
Sorted by
Tagged with
18 votes
5 answers
851 views

Can I be notified when I'm undoing changes from the undofile?

I've been using the undofile feature in Vim for a while now. It's a very nice feature. However, one annoyance is that it's very easy to accidentally undo changes that I did the last time I opened the ...
Martin Tournoij's user avatar
56 votes
1 answer
19k views

How can I use the undofile?

The last news item on vim.org talks about using the 'undofile' to save your history and undo changes even after a reboot: A feature I enjoy using myself is not known to many users, as I found out ...
Undo's user avatar
  • 2,531
13 votes
4 answers
1k views

How can I safely undo changes that I may or may not have made?

Too often do I make the mistake of typing with the wrong window focused (and have done so a few times with a USB authenticator). In programs with lots of hotkeys enabled (Gmail, VLC, Vim), this often ...
JohnB's user avatar
  • 235
13 votes
1 answer
2k views

How to change undo granularity in Vim?

At some point my Vim would undo an entire word when I hit u. [i]typing some words[C-c][u] Would result in typing some However, the undo granularity seems to have changed to deleting one letter at ...
Dan Prince's user avatar
5 votes
2 answers
313 views

How can I filter a buffer to an external command on save without causing any side effects?

Since importing a package and not using it in Go is a compilation error, fixing the import manually can be a bit of a pain while debugging, so I'm currently using this to fix it up automatically ...
Martin Tournoij's user avatar
3 votes
1 answer
412 views

Console vim(x): Can I map the scroll wheel to undo--redo?

It's sort-of a follow to a recent XKCD. I want to know whether it's possible to map the scroll wheel to undo and redo, possibly n undos/redos per scroll? I'm using mate-terminal in MATE 1.6.x, bash, ...
yo''s user avatar
  • 1,131
31 votes
3 answers
13k views

Undo in insert mode

Is there a command to undo the last operation performed while in insert mode? I just pasted text from the wrong register using <C-r>, and I have two options: Delete by hand what I just pasted ...
zool's user avatar
  • 982
6 votes
3 answers
408 views

Turn Vim's multiple undo history into git commits?

When refactoring I sometimes do too much at once—all little steps, but I forget to commit after each little change. Of course in many cases a commit after each change would be too much, but if each ...
Wildcard's user avatar
  • 4,305
6 votes
1 answer
1k views

Why does Vim say "Already at newest change" despite a full "changes" history list?

I seem to be unable to undo something in a file I saved, despite that the history of changes shows up with I press :changes. So the change history is known to vim but I cannot access it? I thought it ...
johnbakers's user avatar
2 votes
1 answer
261 views

Undo <count> macro instances

Often I would record a macro and run it till end of file like 200@q. However, there may be a few lines/instances at the bottom I don't want to run the macro on (like 5 lines). Pressing u would undo ...
ChocolateOverflow's user avatar
1 vote
1 answer
139 views

Vim - edit last action before using (.)

Related to but not duplicate¹ of Bundling command sequences together for repeat (.). The point (.) command is really useful to redo the last action (insertion, replacement, etc.). Sometimes I find ...
Gabriel Devillers's user avatar