[1] I created a new package directory using the 'packpath' option in my vimrc:
:set packpath+=$HOME/vimlocal/pack[2] I run the command :set packpath? and the directory is listed in the output:
packpath=
~/vimfiles,
C:\Program Files (x86)\Vim/vimfiles,
C:\Program Files (x86)\Vim\vim81,
C:\Program Files (x86)\Vim/vimfiles/after,
~/vimfiles/after,
~/vimlocal/packBut none of the plugins (colorschemes) in the directory work. The directory structure is:
~/vimlocal/pack/colors/start/color1
~/vimlocal/pack/colors/start/color2
~/vimlocal/pack/colors/start/color3[3] I run the command:
:set rtp? but the directory is not listed in the output.
runtimepath=
~/vimlocal,
~/vimfiles,
~\vimfiles\bundle\alduin-master,
~\vimfiles\bundle\color-plugins,
~\vimfiles\bundle\ctrlp.vim,
~\vimfiles\bundle\dbext.vim,
~\vimfiles\bundle\goyo.vim,
~\vimfiles\bundle\hexHighlight.vim-master,
~\vimfiles\bundle\limelight.vim,
~\vimfiles\bundle\manpageview,
~\vimfiles\bundle\markdown-preview.nvim-master,
~\vimfiles\bundle\supertab,
~\vimfiles\bundle\tabular,
~\vimfiles\bundle\ultisnips,
~\vimfiles\bundle\utl.vim,
~\vimfiles\bundle\vim-colorschemes,
~\vimfiles\bundle\vim-HiLinkTrace,
~\vimfiles\bundle\vim-markdown-master,
~\vimfiles\bundle\vim-zenroom2,
~\vimfiles\bundle\vimoutliner,
~\vimfiles\bundle\vimtweak-master,
C:\Program Files (x86)\Vim/vimfiles,
C:\Program Files (x86)\Vim\vim81,
C:\Program Files (x86)\Vim\vim81\pack\dist\opt\matchit,
C:\Program Files (x86)\Vim/vimfiles/after,
~\vimfiles\bundle\vim-markdown-master\after,
~\vimfiles\bundle\ultisnips\after,
~\vimfiles\bundle\tabular\after,
~/vimfiles/afterNB: the path '~\vimfiles\bundle....' is set by Pathogen. I'm trying to migrate all my plugins from there to the new packpath directory.
[4] When I move the colorscheme files to the pack file in
'C:\Program Files (x86)\Vim\vim81\pack' (with their same directory structure) they work fine (and appear in output of the runtimepath command).
My question is why are they not working in the directory I set in vimrc with the packpath option?
11 Answer
You should not include the pack component in your 'packpath' setting, since Vim will add that for you.
What you want is simply:
:set packpath+=$HOME/vimlocalOr, better yet, just use the existing ~/vimfiles and store your plug-ins under ~/vimfiles/pack/colors/start/color1 and so on. If you do that, you don't need to touch 'packpath' at all.
You can take a look at the documentation on packages, which says:
When Vim starts up, after processing your
.vimrc, it scans all directories in'packpath'for plugins under thepack/*/startdirectory. First all those directories are added to'runtimepath'. Then all the plugins are loaded.
Emphasis mine. You can see that pack is a path component added by Vim, so you shouldn't have it in paths listed in 'packpath'. In fact, as you can observe, the ones included by Vim already don't include pack at all, and yet a pack directory right underneath those will work for packages, as you already noticed yourself.