【Git】如何将Vim设置为Git的默认编辑器
首先
我将解释如何将Vim设置为Git编辑器的默认选项。
我决定写这篇文章的原因
因为在我家的电脑上编辑Terraform的代码时,当我尝试进行git rebase操作时,出现了“找不到atom命令”的错误提示。
% git rebase -i --autosquash 9fd7947
hint: Waiting for your editor to close the file... atom --wait: atom: command not found
error: There was a problem with the editor 'atom --wait'.
%
我已经卸载了 Atom,但是忘记了更改 Git 的设置。
应对
将Vim设置为Git编辑器的默认选项。
git config --global core.editor vim
确认设置如下。
% git config --global --list | grep editor
core.editor=vim
%
通过设置这个选项,使用git rebase或git commit时,默认会启动Vim。
参考文献