Skip to content

Commit

Permalink
make it possible to supply a list of local vimrc filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
embear committed Jul 10, 2014
1 parent 696a4fa commit 3630fec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 10 additions & 2 deletions doc/localvimrc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ to set them in your global vimrc.
------------------------------------------------------------------------------
*g:localvimrc_name*

Filename of local vimrc files.
List of filenames of local vimrc files. The given name can include a directory
name such as ".config/localvimrc".

Default: ".lvimrc"
Previous versions of localvimrc only supported a single file as string. This
is still supported for backward compatibility.

Default: [ ".lvimrc" ]

------------------------------------------------------------------------------
*g:localvimrc_event*
Expand Down Expand Up @@ -254,10 +258,14 @@ CREDITS *localvimrc-credits*
- Simon Howard for his hint about "sandbox"
- Mark Weber for the idea of using checksums
- Daniel Hahler for various patches
- Justin M. Keyes for ideas to improve this plugin

==============================================================================
CHANGELOG *localvimrc-changelog*

vA.B.C : XXXX-YY-ZZ
- make it possible to supply a list of local vimrc filenames

v2.3.0 : 2014-02-06
- private persistence file to enable persistence over concurrent vim
instances.
Expand Down
14 changes: 10 additions & 4 deletions plugin/localvimrc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ endif
" define default "localvimrc_name" {{{2
" copy to script local variable to prevent .lvimrc modifying the name option.
if (!exists("g:localvimrc_name"))
let s:localvimrc_name = ".lvimrc"
let s:localvimrc_name = [ ".lvimrc" ]
else
let s:localvimrc_name = g:localvimrc_name
if type(g:localvimrc_name) == type("")
let s:localvimrc_name = [ g:localvimrc_name ]
elseif type(g:localvimrc_name) == type([])
let s:localvimrc_name = g:localvimrc_name
endif
endif

" define default "localvimrc_event" {{{2
Expand Down Expand Up @@ -182,8 +186,10 @@ function! s:LocalVimRC()

" generate a list of all local vimrc files with absolute file names along path to root
let l:absolute = {}
for l:rcfile in findfile(s:localvimrc_name, l:directory . ";", -1)
let l:absolute[resolve(fnamemodify(l:rcfile, ":p"))] = ""
for l:rcname in s:localvimrc_name
for l:rcfile in findfile(l:rcname, l:directory . ";", -1)
let l:absolute[resolve(fnamemodify(l:rcfile, ":p"))] = ""
endfor
endfor
let l:rcfiles = sort(keys(l:absolute))
call s:LocalVimRCDebug(1, "found files: " . string(l:rcfiles))
Expand Down

0 comments on commit 3630fec

Please sign in to comment.