Meino Christian Cramer wrote:
Hi,

 for my zsh I split the .zshrc in several files, which contain only
related things. For example all "bindkey"-related things go into .zsh.bindkey.
 .zshrc only sources those parts if available. Make things more
 readable.

 I would like to do the same thing with my $HOME/.vimrc.

I looked into
   :he source

 but "source" seems to work for ex commands only, or ?

 Is there a way, to "source" several files as startup files from
 within $HOME/.vimrc, without a too great performance penalty on
 startup time ?

 Keep hacking!
 mcc


Your vimrc is supposed to consist of ex-commands only (ex-commands are the commands you can type in Normal mode by prefixing them with a colon; in a script such as the vimrc, the colon is not necessary). So you should be able to dissect your vimrc into, let's say,

        if has('unix')
                language messages C
        else
                language messages en
        endif
        runtime vimrc_example.vim
        source ~/rc1.vim
        source ~/rc2.vim
        source ~/rc3.vim

An alternative would be to create "user-plugins", scripts which you would place in ~/.vim/plugin/ (for Unix) or ~/vimfiles/plugin/ (for Windows). They would then be sourced automagically in (probably) alphabetical order, just before the global plugins (i.e., after your ~/.vimrc): see the output of the ":scriptnames" command.

(and if you don't yet have the required directory, create it with:

on Linux:

        mkdir -p ~/.vim/plugin

on Windows:

        cd %HOME%
        md vimfiles
        cd vimfiles
        md plugin


Best regards,
Tony.

Reply via email to