linux system how to enter the exit vim editor

Into the VIM editor
1, VIM editor, you can create a new file can modify the file, the command is: vim / path / filename
2, if the file did not have before, for the New, there are tips below as a new file, As shown in FIG.
If the file already exists, without prompting.

 

3, into the editor, we press the "I", i.e. switch to the "insert" state. The cursor can be moved up and down by, or space, backspace, and carriage return to edit the content.

 

Method exit vim editor and differences

After the end of the text editor, usually exit the editor. Exit editor is divided into four situations: save and exit, normal exit, exit without saving and forced to withdraw.
1, save and exit: When we edit or modify the content of the document is good, as shown.

 

Press the upper left corner of the keyboard "ESC", then enter "colon", namely ":" (without quotation marks), the colon will appear at the bottom, waiting for input commands, as my input is wq

W: write, write
Q: quit, quit
and then Enter to save and exit the

 

2, the normal exit: normal exit there is a prerequisite, open the text file in the content has not been altered.
Press ESC then enter the colon, when you enter the command, direct input "q"

3, exit without saving: a lot of time to open the file or correct some places, only to find wrong, a great need to exit without saving.
Press ESC, and then enter the colon, when you enter the command, direct input "q!"

4, Force Quit: this really should not do the operation
press ESC, then colon, when you enter the command, enter "!."
But after the exit, there will be prompt!

Guess you like

Origin www.cnblogs.com/peiya/p/12595938.html