Search code examples
vimtext-editorvim-plugin

Splitting Vim config into multiple files


Here is a part of my config:

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

" Here I want to split my Vim config into multiple files
" I'm including other Vim configuration files

for f in glob('.vim/*.vim', 0, 1)
    execute 'source' f
endfor

call plug#end()

And it works perfect from home directory.

But when I'm running Vim from directory with my project (e.g. cd ~/Dev/my-project && vim) all my configuration and plugins from ~/.vim/*.vim files not works.

Vim uses only configuration from ~/.vimrc. And execute not works

How can I solve this problem? I want to split my Vim config into multiple files


Solution

  • for f in glob('~/.vim/*.vim', 0, 1)
        execute 'source' f
    endfor