Take a plugin like Flake8. It instructs users to install using Vim 8's package manager by:
mkdir -p ~/.vim/pack/flake8/start/
cd ~/.vim/pack/flake8/start/
git clone https://github.com/nvie/vim-flake8.git
On Windows, this brings up some questions about the compatibility of these paths. What is ~
here? Should the files actually go in ~/.vim
, or should they go in the Windows equivalent - ~/vimfiles
?
You can answer these questions by:
- Using
:echo expand('~')
and:echo $HOME
to learn what~
and$HOME
mean. - Using
:set packpath
to show your packpath.
These are the answers I get on my copy of Windows 10, with a fresh install of Vim 8.1:
:set packpath
packpath=~/vimfiles,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86) \Vim\vim81,C:\Program Files (x86)\Vim/vimfiles/after,~/vimfiles/after
:echo expand('~')
C:\Users\user.name
:echo $HOME
C:\Users\user.name
From those answers, it seems like the place to make the pack/*/start
directories is in C:\Users\user.name\vimfiles
.
However, that doesn't work! If I put the Flake8 files in C:\Users\user.name\vimfiles\pack\flake8\start
, they don't get automatically loaded. And this problem doesn't seem to be with just with Flake8 - this doesn't work with any plugin I've tried.
Looking at :scriptnames
, the only scripts that are picked up are in C:\Program Files (x86)
. Nothing in ~
.
Note that there is no _vimrc
or .vimrc
file in ~
or ~/vimfiles
or ~/.vim
at this time.
I can verify that Flake8 works just fine if it's sourced manually, like so:
:source ~\vimfiles\pack\flake8\start\autoload\flake8.vim
:source ~\vimfiles\pack\flake8\start\ftplugin\python_flake8.vim
Is it possible to use the Vim 8 package manager on a per-user basis when Vim is running on Windows? If it is, what am I doing wrong?