junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.7k stars 1.9k forks source link

PowerShell automatic installation script. #1245

Closed debajyoti1990 closed 1 year ago

debajyoti1990 commented 1 year ago

For automatic installation in Unix, we have the following script:

let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
  silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

Is there any similar script for PowerShell ?

debajyoti1990 commented 1 year ago

Answer inspired from #837 and Vim specific :

`if empty(glob('~\vimfiles\autoload\plug.vim'))

silent ! powershell -Command " \ New-Item -Path ~\vimfiles -Name autoload -Type Directory -Force; \ Invoke-WebRequest \ -Uri 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' \ -OutFile ~\vimfiles\autoload\plug.vim \ " autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif`