undo VIM Command

How to use undo Command in Linux VIM editor?

Explanation


This command is used to undo a change done in the editor. After you done the changes in the file, if you think the change is not necessary. Then you can undo the change, before you save the changes.

Usage:

u

Example:

  • Open the file test.txt using the command
    $ vim test.txt
  • The text in the file is
    Hiox Software
    Vim tutorial

  • To make the editor into insert mode
    Press i
  • Enter the text 'Hiox India'
    undo Vim Command
  • To come out of insert mode
    Press Esc
  • To undo the insertion
    Press :u
    Repeat Last Command

Ask Questions

Ask Question