4

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 undo the most recent change. Pressing it a second time is a "redo" (which in the virtual machine can be accomplished with the Ctrl-r sequence).

I would like to get the cygwin installation to be able to undo multiple edits through repeatedly pressing the u key, like it does in the virtual machine.

I have tried comparing the features included in both installations, but I have not identified what could be causing this difference in behavior. Another post on this website suggested I could use the . key after using the u to undo multiple times, but that has not worked for me in the cygwin installation. I also haven't found any settings in the vimrc files that seem like they would modify this behavior.

  • Using . for multiple undos doesn't work in Vim. That's a feature specific to nvi, which is an entirely different (re-)implementation of vi. – Rich Mar 3 '15 at 15:04
5

Try to :set nocompatible and see if that does it. vi had only one undo level so Vim's ability to behave differently is one of the non-compatible changes the nocompatible setting implements.

  • 2
    Simply creating a ~/.vimrc file will also enable 'nocompatible' mode. – jamessan Mar 2 '15 at 17:51
  • 2
    Relevant documentation: :help cpo-u and :help undo-two-ways – Wumpus Q. Wumbley Mar 2 '15 at 20:57
  • Thanks Quincy and jamessan. Just creating the ~/.vimrc file worked! – Rusty Lemur Mar 3 '15 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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