Cross-platform vim-plug setup
I’ve recently switch to vim-plug, a lightweight Vim plugin manager.
It comes with a little .vimrc
snippet which downloads the plugin, but it only works for Unix. I use Vim across all three platforms regularly, so I updated the snippet:
" Download and install vim-plug (cross platform).
if empty(glob(
\ '$HOME/' . (has('win32') ? 'vimfiles' : '.vim') . '/autoload/plug.vim'))
execute '!curl -fLo ' .
\ (has('win32') ? '\%USERPROFILE\%/vimfiles' : '$HOME/.vim') .
\ '/autoload/plug.vim --create-dirs ' .
\ 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
The above should work across all three major OSes, since Windows 10 recently received curl
support.
4 read-only comments
These are the read-only comments I've exported from Disqus (which I no longer use). If you'd like to share your thoughts about this article, you can ✍️ Reply by email.
I mean curl may work on windows 10, but what about git? Doesn't vim-plug require git, which Windows 10 natively doesn't provide? (I've been using pathogen on Windows for this reason)
I don't really tinker much with my Windows command prompt, but I have git installed and accessible in cmd.exe. I think I either installed it as a part of MinGW or just downloaded the binary from git-scm.
https://uploads.disquscdn.c...
You can install git for windows. vim-plug's function is easy to use compared to pathogen.
I have updated this code to work with both Neovim and Vim8, on Windows and Linux.
https://github.com/rickpric...