Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 275
Entry Guy Avatar asked Feb 21 '26 23:02

Entry Guy


1 Answers

for f in glob('~/.vim/*.vim', 0, 1)
    execute 'source' f
endfor
like image 135
Azat S. Avatar answered Feb 24 '26 12:02

Azat S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!