How to save and exit in VIM?

7

I have a problem (I think it's a problem) in the vim text editor.

When I create a file readme.md and then I make the command vim readme.md , it opens the editor and then the problem starts.

When I type something in there, I do not know which command to save and exit, to go back to Git bash.

    
asked by anonymous 10.11.2017 / 16:27

2 answers

7

To exit vim you need to use :q in command mode. To save is :w . Therefore, to exit and save is :wq .

If you do not know if you are in command mode or in insert mode, you can go straight to the command mode using the Esc combination > + Esc .

That is

Esc : Esc kbd> + w + q

    
10.11.2017 / 16:29
0

To exit git in an easy way after entering% insertion mode esc and i and entering your commit message, simply press esc again after ZZ capital.

    
10.11.2017 / 16:35