vim – How to quickly edit with vim in a terminal?

This article is a small tutorial with a few simple steps on how to quickly edit with vim editor. Knowledge can be used for a quick edit of any document in the Linux terminal.

I made a simple typo in one of my project’s and noticed it after I already pushed the commit to the repository. For such cases, it is handy to know the vim editor and how to handle vim edit mode if you are in the terminal.

All you have to do is this:

  • Go to file folder you want to edit. In our case, for example, it is a folder containing git repository with file.
  • Type vim
  • Get to the edit/insert mode by typing [i] keyboard.
  • Fix the typo.
  • Hit [Esc] keyboard to leave the vim insert mode.
  • And finally, type :w for writing the change or :x for saving and exiting the vim. Hit [Enter] and execute the command.

To save the file content to a new file named e.g NEW_FILE, we need to use :w NEW_FILE or :x NEW_FILE and hit [Enter].

This entry was posted in Tutorials and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.