如何使Git使用我選擇的編輯器來提交?我更愿意用Vim編寫提交消息,但它正在Emacs中打開它們。如何將Git配置為始終使用Vim?請注意,我希望在全球范圍內這樣做,而不僅僅是針對單個項目。
3 回答

慕尼黑8549860
TA貢獻1818條經驗 獲得超11個贊
集 在Git配置中: git config --global core.editor "vim"
設置 環境變量: export GIT_EDITOR=vim
VISUAL
EDITOR
export VISUAL=vim export EDITOR="$VISUAL"
VISUAL
VISUAL
EDITOR
.
為崇高的文本.gitconfig
--wait
[core] editor = 'subl' --wait
“subl”可以被可執行文件的完整路徑替換,但通常在正確安裝時可用。

ITMISS
TA貢獻1871條經驗 獲得超8個贊
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:
- 3 回答
- 0 關注
- 1347 瀏覽
添加回答
舉報
0/150
提交
取消