Tuesday 2 April 2019

How to exit VIM and get back to 'normal' terminal?


I did find this answer here: Vim Stuck In Insert Mode


However none of the commands listed worked for me. Exit, cntrl + [, cntrl + q


I'm totally a terminal newb, trying to learn how to setup git using homebrew. Watching this tutorial and I was able to set my global username and email, but I'm stuck in VIM.


I can get out of it by quitting the terminal, but I have to do this every time :(


Is there a better way?



Answer



:q is not good because you need to save the file manually before quit.


If you use main window only(no tabs), :wq or equivalent ZZ is better. They will save and quit. ZZ is easier to type.


I use tabs often, so normal commands :wq or ZZ can't fit my need.


Then I made such mapping in vimrc


"Quit vim with saving all tabs and buffers
nnoremap WQ :wqa

After this, I forget all other quit options, only this one to fit all.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...