Hi group

Is there a neat way to source vim files in a directory?
Currently I use following solution that relies on "ls" - it's not
feasible on other than Unix systems.

function! SourceFile(path, file)
let path_file = a:path . '/' . a:file
exe "source " . path_file
endfunction

function! SourceDir(path)
let files = system("ls " . a:path)
let pattern = '[A-Za-z0-9-_]\+.vim'
while match(files, pattern) != -1
 let file = matchstr(files, pattern)
 let files = substitute(files, pattern . '\n', '', '')
 call SourceFile(a:path, file)
endwhile
endfunction

"Source files frenzy
call SourceDir("~/vim_local/plugin")

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4mir - http://amix.dk
-----------------------------------------------------------
/(bb|[^b]{2})/ that is the Question

Reply via email to