Questions tagged [undo-redo]

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

Filter by
Sorted by
Tagged with
6
votes
1answer
143 views

How to keep in the undo history just one change for this command?

I want to keep in the undo history just one change for a long command such as: d0kJx. (I took the command from this answer.) This command (d0kJx) does this (The ^ is the cursor position): Before: a ...
3
votes
0answers
1k views

How can I undo last command in command line?

In general, is there a way to UNDO the last "meta" command (I mean a command entered in command line to manage a window ), or some equivalent keystroke sequence ? Btw, I know the u (= undo) and CTRL-...
3
votes
1answer
2k views

Undo diffget in vimdiff

Say I have a merge conflict in Git, and try to resolve it with vimdiff using diff3 view. Here is a screenshot: Now while resolving, I want to diffget once from LO see how it looks like, undo, and ...
27
votes
3answers
10k 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 ...
12
votes
3answers
928 views

Highlighted undo in Vim

I'm trying to have a highlighted undo in Vim, like spacemacs default config. Sometimes when I want quick undo's, I can't realize what changed because it's instantaneous. So I am trying to have ...
4
votes
2answers
182 views

Undo certain modifications

Let's assume I work on a C program file which has 10 functions. During one review, I changed their return types, return values and I added some checks/documentation. After some time I realize that ...
11
votes
1answer
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 ...
4
votes
1answer
1k views

Undo multiple changes in Cygwin's vim

I have two installations of vim: 7.4 in cygwin and 7.2 in a Linux virtual machine. The vim in the virtual machine can undo multiple edits by repeatedly pressing the u key. The vim in cygwin can only ...
12
votes
2answers
341 views

Search all versions of a file in the undo tree

Is there an easier way to find a particular change in Vim's undo tree than just looking at random old versions of the file one at a time (either using vanilla VIM commands, Gundo, or another plugin)? ...
15
votes
5answers
763 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 ...
14
votes
3answers
9k views

Can I undo multiple times in nvi and/or the original vi?

Sometimes I'm on a system without Vim, and use the default nvi (BSD systems) or the original vi (Arch Linux). There are quite a few differences, but the largest annoyance is that I can undo only my ...
7
votes
1answer
3k views

How to cache file editing history in Vim, that it would not disappear after switching the file?

When I open another file in a Vim session all editing history for the other files disappears. Is it possible to configure Vim that it would automatically save and restore file editing history when ...
14
votes
3answers
449 views

How do you use changes tree in vim

Is it possible to retrieve changes branch that I "abandoned"? For example, I am undoing several operations using u, then I am making a change in insert mode. But then I realize I don't want to have ...
1
vote
1answer
248 views

What can happen if I accidentally paste into command mode? What should I do if I do this? [duplicate]

If I have vim in a windowed terminal, sometimes I paste (using the terminal's paste functionality, e.g. middle click) from another window that isn't vim. Most of the time, when I do this, I wanted to ...
12
votes
4answers
782 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 ...
-3
votes
1answer
149 views

Are there any precautionary measures I can take for a beginner? [closed]

When first starting out using vim, I was nervous that I'd get lost in some foreign mode that could potentially wreak havoc. I felt like there was never really any "safety net" preventing me from a ...
48
votes
1answer
13k 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 ...

1
2