Vim without plugins still great, but this is not the best way to enjoy it wholly. Thing that bores time to time, nevertheless, is installing them: getting plugins manager when what really expected is just pasting .vimrc
anywhere. Why can't I just git-clone them all myself? GetPlugs
function does exactly that. You define a list of URLs to plug repositories. They'll be cloned to .vim/pack/plugins/all
directory or skipped if there is already something. After that, symbolic link for each one created inside .vim/pack/plugins/start
which is a place where vim is looking for native packs. When you decided to get up to date code, simply add the bang sign, so GetPlugs!
:
command! -bang GetPlugs call s:GetPlugs(<bang>0)
function! s:GetPlugs(upgrade)
let l:plugs_dir = $HOME . '/.vim/pack/plugins/all/'
let l:start_dir = $HOME . '/.vim/pack/plugins/start'
call system('mkdir -p ' . l:plugs_dir . ' ' . l:start_dir)
for l:repo in split(s:repos)
let l:plug_name = split(l:repo,'\/')[-1]
let l:dest = l:plugs_dir . l:plug_name
if empty(glob(l:dest))
echo '>> Clone: ' . l:dest
echo system('git clone --depth 1 ' . shellescape(l:repo) . ' ' . l:dest)
echo system('ln -vs ../all/' . l:plug_name . ' ' . l:start_dir)
elseif a:upgrade
echo '>> Pull: ' . l:dest
echo system('git -C ' . shellescape(l:dest) . ' pull --rebase --verbose')
else
echo '>> Skip: ' . l:dest
end
endfor
endfunction
let s:repos = "
\ https://github.com/prabirshrestha/asyncomplete-file.vim
\ https://github.com/prabirshrestha/asyncomplete-lsp.vim
\ https://github.com/yami-beta/asyncomplete-omni.vim
\ https://github.com/prabirshrestha/asyncomplete.vim
\ https://github.com/jiangmiao/auto-pairs
\ https://github.com/bakpakin/fennel.vim
\ https://github.com/rafamadriz/friendly-snippets
\ https://github.com/haya14busa/incsearch.vim
\ https://github.com/lotabout/skim
\ https://github.com/tweekmonster/startuptime.vim
\ https://github.com/wellle/targets.vim
\ https://github.com/tpope/vim-commentary
\ https://github.com/prabirshrestha/vim-lsp
\ https://github.com/mattn/vim-lsp-settings
\ https://github.com/tpope/vim-repeat
\ https://github.com/justinmk/vim-sneak
\ https://github.com/tpope/vim-surround
\ https://github.com/tpope/vim-unimpaired
\ https://github.com/tpope/vim-vinegar
\ https://github.com/hrsh7th/vim-vsnip
\ https://github.com/hrsh7th/vim-vsnip-integ
\ https://github.com/lyokha/vim-xkbswitch
\ "
Here you can find whole .vimrc
file.