David542
David542

Reputation: 110502

Suggested place to put Plugin settings

I have a plugin place in my vimrc that looks like this:

 " Plugins {{{
 call plug#begin('~/.vim/plugged')

     " Vim-airline: status-bar for vim: https://github.com/vim-airline/vim-airline
     Plug 'vim-airline/vim-airline'
     Plug 'vim-airline/vim-airline-themes'

    "...

call plug#end()
" }}}

And then I have a bunch of settings for each of the plugins that look something like:

let g:ultisnipseditsplit="tabdo"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"

What is the suggested place to put the plugin settings? Should it be, for example, inside the Plugin section? (perhaps a 2nd fold-level down?). Should I create a new fold-section for it (one for Plugins and one for Plugin-Settings?), or where is this suggested place to put all the settings?

Upvotes: 0

Views: 470

Answers (2)

D. Ben Knoble
D. Ben Knoble

Reputation: 4703

For plugins, I usually use ~/.vim/after/plugin/config/<name>.vim. I’m taking advantage of after being one of the last directories on the runtime path and anything under plugin directories getting sourced at startup.

For as many plugins as I can, I include a check to avoid configuring them (setting mappings, global vars, etc.) if they are not loaded (i.e., don’t exist). For some this is not possible.

Examples

Upvotes: 1

Hayden
Hayden

Reputation: 327

It's complete preference. Most people keep them in their vimrc, but if you think it's getting bloated, then sure - extract it to a separate file and you can source it at the bottom of your vimrc like so:

source ~/.plugins.vim

Upvotes: 2

Related Questions