终端中的Git提交会打开VIM,但无法返回到终端 [英] Git commit in terminal opens VIM, but can't get back to terminal

查看:96
本文介绍了终端中的Git提交会打开VIM,但无法返回到终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在尝试学习GitHub,并在nettuts上进行 Git基础教程。我正在上关于提交的课程。

Trying to learn GitHub at the moment and doing this Git essentials tutorial over at nettuts. I'm on the lesson about making commits.

老师键入 git commit ,它将打开VIM作为其编辑器(我也想知道如何使它在 Sublime Text 2中打开)无论如何它还是在VIM中打开的,并且我添加了第一行表示这是我的第一次提交,然后单击保存。

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.

接下来,它提示我将输出保存到桌面,这在他的屏幕录像中没有看到。现在我仍在VIM中,不确定如何返回普通终端:(

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 :(

我不知道为什么,所以我退出了终端,然后重新启动它,git是否再次提交并有一些关于重复的警告消息!不知道我是否仍然需要(E)edit (A)中止

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状态

vim

消息,当我重新打开终端并再次执行git commit

message when I reopen terminal and do git commit again

推荐答案

保存您的工作并退出,请按 Esc ,然后按 w q (w表示写入,q表示退出)。

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

或者,您可以依次按 Esc 保存并退出: x

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

设置另一个编辑器在终端上运行 export EDITOR = myFavoriteEdior ,其中 myFavoriteEdior 可以为 vi gedit subl (用于崇高)等。

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

这篇关于终端中的Git提交会打开VIM,但无法返回到终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆