blueyed
blueyed

Reputation: 27858

How do I source a list of files from vimrc?

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?

Upvotes: 3

Views: 290

Answers (3)

too much php
too much php

Reputation: 91028

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

:runtime! source.d/*.vim

This is how the plugin folder is loaded.

Upvotes: 3

Luc Hermitte
Luc Hermitte

Reputation: 32946

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

Upvotes: 4

blueyed
blueyed

Reputation: 27858

Got the following answer on #vim:

exe join(map(split(glob("~/.vim/source.d/*.vim"), "\n"), '"source " . v:val'), "\n")

Upvotes: 0

Related Questions