Lai Yu-Hsuan
Lai Yu-Hsuan

Reputation: 28081

separate vimrc into two file?

I'm going to upload my vimrc to githug. But some settings is not general(e.g. on slower machine I dont use cursorcolumn)

So I don't want to put all my settings in one file. How to do this? Is there something like 'source' in bash?

Upvotes: 2

Views: 550

Answers (2)

Sam Brinck
Sam Brinck

Reputation: 901

to avoid errors if the file doesn't exist surround it with if filereadable.
I have generalized and shared my vimrc and have a line that sources a .vimrc.loc in the users home directory to allow for customization by people that use my vimrc.

if filereadable($HOME."/.vimrc.loc")
    source ${HOME}/.vimrc.loc
endif

Upvotes: 2

kev
kev

Reputation: 161644

There is a source command in vim

:so[urce] {file}    
        Read Ex commands from {file}.  These are commands that
        start with a ":".
        Triggers the |SourcePre| autocommand.

Upvotes: 2

Related Questions