20 lines
536 B
VimL
20 lines
536 B
VimL
function! projectconfig#find() abort
|
|
let l:basedir = expand('%:p:h')
|
|
for l:project in keys(g:projectconfig_projects)
|
|
if l:basedir =~ l:project
|
|
return get(g:projectconfig_projects, l:project, '')
|
|
endif
|
|
endfor
|
|
endfunction
|
|
|
|
function! projectconfig#load() abort
|
|
let l:file = projectconfig#find()
|
|
if filereadable(l:file)
|
|
let l:safe = fnameescape(l:file)
|
|
execute 'source' l:safe
|
|
return 'Loaded project configuration: ' . l:safe
|
|
else
|
|
return 'Using default project configuration'
|
|
endif
|
|
endfunction
|