How To Edit and Exit the VIM Editor

exiting and editing the vim editor
Written by DEL support01
Updated 8 months ago

First you have to your desired file present in your system you are working on while in your terminal. by typing " Vim [ name of file]

Next once in your Vim editor, depending on what you want to edit or change you have first and foremost to make sure you want to make changes to that particular file.

When you are sure of editing that file, you have to press the {I} key on your keyboard to enter the insert mode which will permit you to edit the file. it should at the bottom of the page insert when you do that step.

When in insert mode, you can start now editing your file normally.

When done you can choose to save and quit or if you are not too sure of what you are editing and do not  want to save the changes made, you can choose just to quit.

TAKE NOTE: in vim to save and you need to press the keys below

  • w = save
  • q = quit
  • ! = force quit (always force quit when done it always help)

The First Option: saving and quiting

  • You are done and you want to save and quit: In vim to save, you have first exit the insert mode. To do so you have to press the [ESC] key on your keyboard generally located at the top left of all keyboards.

  • Next step is to:
  • first press the shift key and while still holding the key press the semicolon/colon key on keyboard together
  • Then press w key followed by the q key followed by the ! key and press enter to save.
  • If done correctly it should appear on your terminal like the picture below. Then press enter to exit the editor
  • Second Option: Just quitting without saving
  • - Exit the insert mode by just pressing the esc key on your keyboard
  • - Then press while holding the shift key press the semicolon/colon key at the same time of your keyboard.
  • - Next step is to just press the q key(to quit) and the ! key(force) then press the enter key to exit your editor.
  • when does step are it show in your editor like this below
  • YOU HAVE SUCCESSFULLY EDITED AND EXITED YOUR VIM FILE

Did this answer your question?