问题
I am trying to enable the spell in Vim in case of editing the git commit message.
The filename is fixed, so autocmd won't help.
I've put a modeline in the initial message, but the ftpplugin/gitcommit.vim disables the modeline.
What is the way to have custom vim settings for git-commit case?
回答1:
git commit msg has filetype gitcommit. You can add autocmd on that filetype, for example:
autocmd FileType gitcommit setlocal spell
All commit message in your vim should have spell check activated.
回答2:
You can override ftplugins with the after/ftplugin directory, so I put
setlocal spell
in ~/.vim/after/ftplugin/gitcommit.vim. Don’t forget to read :help b:undo_ftplugin.
来源:https://stackoverflow.com/questions/57686741/how-to-enable-spellcheck-in-vim-on-git-commit