LucHermitte / local_vimrc

Per project/tree configuration plugins
GNU General Public License v3.0
125 stars 7 forks source link

Unable to get local vimrc from sub directory #7

Closed garrettmaring closed 7 years ago

garrettmaring commented 8 years ago

I'm unable to trigger a local vimrc from a sub directory.

Project/
+ file.txt
+ Server/
+ Configs/
++ file2.txt
++ Vim/
+++ localvim.rc

I set g:local_vimrc to be ["/absolute/path/to/local/vimrc"] with no luck.

LucHermitte commented 8 years ago

Hi.

If I've correctly reproduced your tree:

.
`-- Project
    |-- Config
    |   |-- file2.txt
    |   `-- Vim
    |       `-- localvim.rc
    |-- file.txt
    `-- Server

And If I'm not mistaken, you should set g:local_vimrc to ['Config/Vim/localvim.rc']. It works with relative paths, and you'll also need to tell the filename you're using.

Then, it'll also be important to be sure that your working path is not in the blacklist. By default it may not be the case. You can follow what happens if you execute :call lh#local_vimrc#verbose(1) from your .vimrc or before a manual :SourceLocalVimrc. Note: :SourceLocalVimrc doesn't update the copy of g:local_vimrc it caches. You'll may have to set

" .vimrc
let g:local_vimrc_options.whitelist = [ '/absolute/path/to/Project'] 
" ...
" Or instead, even better, after plugins have been loaded by your plugin manager:
runtime plugin/let.vim
" Be sure the variable exist, but don't clear it otherwise
LetIfUndef g:local_vimrc_options.whitelist []
" Add the path to the list if it exists
call lh#path#munge(g:local_vimrc_options.whitelist, '/absolute/path/to/Project')

PS: BTW, I've found a bug this week in the asklist/sandboxlist management. It has been fixed in https://github.com/LucHermitte/lh-vim-lib/commit/caed16085e992a52fa4f15b837d305b87e3c744d I'll eventually refactor local_vimrc to use the extracted and fixed function. It's not very high in my priority list for the moment. Let me know if this is a blocking issue for you.