Git commit in terminal opens VIM, but can't get back to terminal

command-line-interface, commit, git, terminal, vim

Solution

To save your work and exit press Esc and then :wq (w for write and q for quit).

Alternatively, you could both save and exit by pressing Esc and then :x

To set another editor run `export EDITOR=myFavoriteEdior`on your terminal, where `myFavoriteEdior` can be `vi`, `gedit`, `subl`(for sublime) etc.

Problem

Trying to learn GitHub at the moment and doing this Git essentials tutorial over at nettuts. I'm on the lesson about making commits. The teacher types `git commit` and it opens VIM as his editor (I'd also like to know how to make it open up in Sublime Text 2 instead) anyways it opens in VIM and I add in 1 line saying this is my first commit and hit save. Next it then prompts me to save the output to the desktop, something I did not see in his screencast. Now I'm still in VIM and not sure how to get back to 'normal' terminal :( I couldn't figure it out so I just exited the terminal and relaunched it, did git commit again and had some warning messages about duplicates! Not sure if I need to `(E)edit` anyways or `(A)abort`. git status vim message when I reopen terminal and do git commit again

Original source

Related problems