每次我输入git commit -a
vim 时,它都会以正常模式打开,并且我经常输入不需要的命令。有没有办法让 git 以插入模式打开 vim?
答案1
您可以将其添加到您的.vimrc
:
autocmd FileType gitcommit exec 'au VimEnter * startinsert'
以下是其工作原理的布局:
autocmd FileType gitcommit " Whenever we open a 'gitcommit' file,
exec 'au VimEnter * startinsert' " Run the following command:
au VimEnter " Whenever vim opens,
* " Any type of file
startinsert " Enter insert mode