tags:

views:

40

answers:

3

I basically want to add something like

source ~/.vim/source.d/*.vim

to vimrc.

Is it possible to loop over a set of globbed files?

A: 

Got the following answer on #vim:

exe join(map(split(glob("~/.vim/source.d/*.vim"), "\n"), '"source " . v:val'), "\n")
blueyed
`split(glob(...))` without `"\n"` works just fine, if it is not supposed to handle filenames with spaces. If it is then you miss escaping some characters (starting with space).
ZyX
+4  A: 

Why don't you put them into your ~/.vim/plugin/ directory? It will get the job done, and transparently furthermore.

Luc Hermitte
Somehow this did not work properly when loading .py files from the command line: the `call matchadd()` (and probably everything else was not properly setup): from turning on "-verbose" it looked like it did not trigger `autocmd` for *.py, but for *.
blueyed
python specific configuration shall not go into plain plugins, but into ftplugins.
Luc Hermitte
+1  A: 

Use the :runtime! command (including the !).

:runtime! source.d/*.vim

This is how the plugin folder is loaded.

too much php