How to enable spellcheck in vim on git-commit

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-24 05:23:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!