Open fladd opened 5 years ago
Can you provide one? I'm not familiar with the Windows environment, so I could use your help.
if empty(glob('$LOCALAPPDATA\nvim\autoload\plug.vim'))
silent ! powershell (md "$env:LOCALAPPDATA\nvim\autoload")
silent ! powershell (New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', $env:LOCALAPPDATA + '\nvim\autoload\plug.vim')
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('$LOCALAPPDATA\nvim\plugged')
In the .vimrc. This should automatically install plug to %LOCALAPPDATA%\nvim\autoload
.
This unfortunately does not work:
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:1 char:1
+ (New-Object Net.WebClient).DownloadFile('https://raw.githubuserconten ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Is it acceptable to install scoop which can install curl? The same instructions with curl should apply on Windows, save for the user config directory (ie. ~/vimfiles/
for vim, output of stdpath('config')
for Neovim).
This snippet works for me:
if empty(glob('$LOCALAPPDATA\nvim\autoload\plug.vim'))
silent ! powershell -Command "
\ New-Item -Path ~\AppData\Local\nvim -Name autoload -Type Directory -Force;
\ Invoke-WebRequest
\ -Uri 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
\ -OutFile ~\AppData\Local\nvim\autoload\plug.vim
\ "
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
Windows 10 ships with curl
now, so you can use this as well (works on Linux, macOS and Windows):
let g:dotvim = '...'
if empty(glob(g:dotvim . '/autoload/plug.vim'))
silent execute '!curl -fLo ' . g:dotvim . '/autoload/plug.vim --create-dirs '
\ . '"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
The automatic installation instructions for Windows are missing.