Best way to organize filetype settings in .vim and .vimrc?

后端 未结 1 387
-上瘾入骨i
-上瘾入骨i 2020-12-22 17:30

I\'m going through my vim dotfiles to tidy them up. I\'ve noticed that through time I\'ve added various filetype specific settings in various inconsistent ways. Let\'s suppo

相关标签:
1条回答
  • 2020-12-22 18:15

    I store my Python-specific settings is in $HOME/.vim/ftplugin/python.vim, since I do nothing to conflict with $VIMRUNTIME/ftplugin/python.vim.

    Keeping these settings in an ftplugin file keeps my .vimrc nice and generic and easier to maintain (it's still pretty big after over ten years of Vim usage).

    If you want to overrule what the ftplugins with your Vim distribution set up, then $HOME/.vim/after/ftplugin/python.vim is what you want, as it is read after these.

    Similarly $HOME/.vim/filetype.vim will be sourced before $VIMRUNTIME/filetype.vim and that in turn will be sourced before $HOME/.vim/after/filetype.vim.

    Invoking :scriptnames will list all sourced script names, in the order they were first sourced.

    :help filetype provides pretty comprehensive information on all of this.

    0 讨论(0)
提交回复
热议问题