如何全局配置git以使用特定的编辑器(例如vim)提交消息?
当前回答
对于EmEditor用户
要将EmEditor设置为Git的默认文本编辑器,请打开Git Bash,然后键入:
git config--全局core.editor“emeditor.exe-sp”
需要EmEditor v19.9.2或更高版本。
其他回答
Mvim作为您的git编辑器
与所有其他GUI应用程序一样,您必须使用wait标志启动mvim。
git config --global core.editor "mvim --remote-wait"
对于emacs用户
.emacs:
(server-start)
外壳:
export EDITOR=emacsclient
在Ubuntu和Debian(谢谢@MichielB)上,也可以通过运行以下命令来更改默认编辑器:
sudo update-alternatives --config editor
这将提示以下内容:
There are 4 choices for the alternative editor (providing /usr/bin/editor).
Selection Path Priority Status
------------------------------------------------------------
0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
* 3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 10 manual mode
Press enter to keep the current choice[*], or type selection number:
在windows 7中,当添加“Sublime”编辑器时,它仍然给我一个错误:
由于提交消息为空,正在中止提交。
Sublime无法保持焦点。
为了解决这个问题,我打开了c:\users/username/文件夹中的.gitconfig文件,并在单引号外添加了下面一行--wait选项。
[core]
editor = 'F:/Program Files/Sublime Text 2/sublime_text.exe' --wait
希望对Sublime面临类似问题的人有所帮助。
使用git review时,我必须修改sequence.editor值,以便能够进行交互式rebase(gitrebase-I-p):
git config --global sequence.editor "gvim" # or whatever your prefer
gvim要求:apt-installvim-gtk
工具书类
#2944 Interactive Rebase失败,出现警告:“Vim:警告:输出不到终端”安装sjubar/rebase编辑器的部分
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 在Vim中如何从“gf”返回
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式