From 6f633a82af412c05e2e7a49ea666e7efc584bf3c Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Sat, 25 May 2013 10:30:31 +0200 Subject: [PATCH 1/3] Put ~/.vim first in &rtp and ~/.vim/after last. The paths ~/.vim and ~/.vim/after where hardcoded so this might be an *NIX only solution. Could close #244. --- autoload/vundle/config.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 5bb6e3f..c983b5a 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -81,6 +81,10 @@ func! s:rtp_add_a() let appends = join(paths, '/after,').'/after' exec 'set rtp^='.fnameescape(prepends) exec 'set rtp+='.fnameescape(appends) + set rtp-=~/.vim + set rtp^=~/.vim + set rtp-=~/.vim/after + set rtp+=~/.vim/after endf func! s:rtp_rm(dir) abort From 95ada556db9507418fa267336e0f9c3e3d08653a Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Wed, 12 Jun 2013 10:05:42 +0200 Subject: [PATCH 2/3] Reorder &rtp to have default values in sensible places Use the default value of &rtp to be operating system independant. Move the /after directories at the end and the other default directories at the beginning of &rtp. Known issues * If a user removes one of the default directories from &rtp it will be added again. * If a user added some other directory manually it might end up in an unintended place. --- autoload/vundle/config.vim | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index c983b5a..24616bb 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -76,15 +76,36 @@ func! s:rtp_rm_a() endf func! s:rtp_add_a() + " Try to move the default directories in sensible places. By resetting the + " option, we are using the correct values no matter on which OS we are. + let old_rtp = &rtp + set rtp& + let default_rtp = split(&rtp, ',') + let middle = match(default_rtp, '/after') + let part_one = default_rtp[: middle - 1] + call reverse(part_one) + let part_two = default_rtp[middle :] + " Reset &rtp to the old value + let &rtp = old_rtp + " add the vundles let paths = map(copy(g:bundles), 'v:val.rtpath') let prepends = join(paths, ',') let appends = join(paths, '/after,').'/after' exec 'set rtp^='.fnameescape(prepends) exec 'set rtp+='.fnameescape(appends) - set rtp-=~/.vim - set rtp^=~/.vim - set rtp-=~/.vim/after - set rtp+=~/.vim/after + " Now we can move the default directories to the right places + "set rtp-=~/.vim + "set rtp^=~/.vim + "set rtp-=~/.vim/after + "set rtp+=~/.vim/after + for item in part_one + execute 'set rtp-=' . item + execute 'set rtp^=' . item + endfor + for item in part_two + execute 'set rtp-=' . item + execute 'set rtp+=' . item + endfor endf func! s:rtp_rm(dir) abort From f24ec5086deed6f29e5ba5616ea17ffca6183c55 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Wed, 12 Jun 2013 10:29:08 +0200 Subject: [PATCH 3/3] Reorder &rtp to have default values in sensible places Use the default value of &rtp to be operating system independant. Move the /after directories at the end and the other default directories at the beginning of &rtp. Known issues * If a user removes one of the default directories from &rtp it will be added again. * If a user added some other directory manually it might end up in an unintended place. --- autoload/vundle/config.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 24616bb..0ea9bbb 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -76,7 +76,7 @@ func! s:rtp_rm_a() endf func! s:rtp_add_a() - " Try to move the default directories in sensible places. By resetting the + " Try to move the default directories in sensible places. By resetting the " option, we are using the correct values no matter on which OS we are. let old_rtp = &rtp set rtp& @@ -85,7 +85,8 @@ func! s:rtp_add_a() let part_one = default_rtp[: middle - 1] call reverse(part_one) let part_two = default_rtp[middle :] - " Reset &rtp to the old value + " Reset &rtp to the old value, if we don't do this we might lose changes + " made by the user. let &rtp = old_rtp " add the vundles let paths = map(copy(g:bundles), 'v:val.rtpath')