终端中的 Git 提交打开 VIM,但无法返回终端 [英] Git commit in terminal opens VIM, but can't get back to terminal
问题描述
目前正在尝试学习 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 中打开,我添加了 1 行说这是我的第一次提交并点击保存.
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 commit 并收到一些关于重复项的警告消息!不确定我是否需要 (E)edit
或 (A)abort
.
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
message 当我重新打开终端并再次执行 git commit 时
message when I reopen terminal and do git commit again
推荐答案
要保存您的工作并退出,请按 Esc 然后按 :wq(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
(用于 sublime)等
To set another editor run export EDITOR=myFavoriteEdior
on your terminal, where myFavoriteEdior
can be vi
, gedit
, subl
(for sublime) etc.
这篇关于终端中的 Git 提交打开 VIM,但无法返回终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!