I have installed Dr. Chip's netrw
from his homepage, since it is newer and more often updated than the files that are part of the main Vim distribution.
Before Vim 8 I always sued the Vimball install method, by opening the .vba
and running :source %
. But, now that Vim 8 added the packages mechanism I decided to use that. I have my packages under:
~/.vim/pack/packages/start/
~/.vim/pack/packages/opt/
So to install NETRW as a package I did:
cd ~/.vim/pack/packages/start/
wget http://www.drchip.org/astronaut/vim/vbafiles/netrw.vba.gz
mkdir netrw.vim
gunzip netrw.vba.gz
vim netrw.vba
:UseVimball ~/.vim/pack/packages/start/netrw.vim
And it installed correctly. But now when I edit a file and use a netrw
command, say, :Lexplore
I'm not sure which netrw
is being used. If I do:
vim foo
:scriptnames
1: /etc/vimrc
2: /usr/share/vim/vimfiles/archlinux.vim
3: ~/.vim/vimrc
(...)
20: /usr/share/vim/vim80/plugin/netrwPlugin.vim
21: /usr/share/vim/vim80/plugin/rrhelper.vim
22: /usr/share/vim/vim80/plugin/spellfile.vim
23: /usr/share/vim/vim80/plugin/tarPlugin.vim
24: /usr/share/vim/vim80/plugin/tohtml.vim
25: /usr/share/vim/vim80/plugin/vimballPlugin.vim
26: /usr/share/vim/vim80/plugin/zipPlugin.vim
27: ~/.vim/pack/packages/start/csv.vim/plugin/csv.vim
28: ~/.vim/pack/packages/start/csv.vim/ftdetect/csv.vim
29: ~/.vim/pack/packages/start/netrw.vim/plugin/netrwPlugin.vim
30: /usr/share/vim/vim80/scripts.vim
So the distribution netrw
runs first (20) and then runs the installed one (29). If I add packloadall
to my vimrc
the situation changes:
1: /etc/vimrc
2: /usr/share/vim/vimfiles/archlinux.vim
3: ~/.vim/vimrc
4: ~/.vim/pack/packages/start/csv.vim/plugin/csv.vim
5: ~/.vim/pack/packages/start/netrw.vim/plugin/netrwPlugin.vim
(...)
19: /usr/share/vim/vim80/plugin/gzip.vim
20: /usr/share/vim/vim80/plugin/logiPat.vim
21: /usr/share/vim/vim80/plugin/manpager.vim
22: /usr/share/vim/vim80/plugin/matchparen.vim
23: /usr/share/vim/vim80/plugin/netrwPlugin.vim
And the installed netrw
in my directory runs first (5). Yet, the Vim distribution netrw
still runs (23)!
Which
netrw
will Vim use when I do, say,:Lexplore
? It appears to use the new (Vimball installed one) for:Lexplore
but I'm not sure since:h pi_netrw
gives me the new document, but:h netrw
gives me the old documentation (the one that comes with Vim).Running
:helptags ~/.vim/pack/packages/start/netrw.vim/doc
does not help with the documentation problem above (i.e. I get sometimes the new one and sometimes the old one). Is there something I'm doing wrong with this?Does Vim always give preference to plugins/scripts/autoload commands that are in
$VIM
(default~/.vim
) above the ones in$VIMRUNTIME
?
~/.vim
and the one in the system directory/usr/share/vim
). Then you can reinstall the newest version of netrw from Dr. Chip's website, and you are sure that only this version will be running now.