Fixed home directory handling

This commit is contained in:
Emmanuel BENOîT 2015-02-22 11:43:04 +01:00
parent 7f891225ab
commit 7cbef1668e

7
vimrc
View file

@ -5,14 +5,19 @@
let s:own_path = expand( '<sfile>:p:h' ) let s:own_path = expand( '<sfile>:p:h' )
let $VIM_HOME = $VIM_HOME == '' ? '' let $VIM_HOME = $VIM_HOME == '' ? ''
\ : fnamemodify( $VIM_HOME . '/x' , ':p:h' ) \ : fnamemodify( $VIM_HOME . '/x' , ':p:h' )
if $VIM_HOME == '' || $VIM_HOME == s:own_path if $VIM_HOME == '' || $VIM_HOME == s:own_path
" Default configuration directory
let $VIM_HOME = s:own_path let $VIM_HOME = s:own_path
let g:vim_home = fnameescape( $VIM_HOME ) let g:vim_home = fnameescape( $VIM_HOME )
let g:vim_vimrc = fnameescape( $VIM_HOME . '/vimrc' ) let g:vim_vimrc = fnameescape( $VIM_HOME . '/vimrc' )
else else
" Use another configuration directory
let g:vim_home = fnameescape( $VIM_HOME ) let g:vim_home = fnameescape( $VIM_HOME )
let g:vim_vimrc = fnameescape( $VIM_HOME . '/vimrc' ) let g:vim_vimrc = fnameescape( $VIM_HOME . '/vimrc' )
let &rtp = g:vim_home let &rtp = printf(
\ '%s/vimfiles,%s,%s,%s/vimfiles/after,%s/after' ,
\ $VIM , $VIMRUNTIME , g:vim_home , $VIM , g:vim_home )
if filereadable( g:vim_vimrc ) if filereadable( g:vim_vimrc )
execute 'source ' . g:vim_vimrc execute 'source ' . g:vim_vimrc
endif endif