Created
March 31, 2020 13:32
-
-
Save veirus/b17bd160cefbcab7b288b879b439f8fd to your computer and use it in GitHub Desktop.
Quick add plugin from Github to your *.vimrc* or wherever you keep your plugins. Also minpac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! -nargs=+ -bar Plug call minpac#add(<args>) | |
" quick add plugins for a minpac {{{1 | |
function! AddPacFromCb(arg) abort | |
if v:version >= 801 || (v:version == 800 && has("patch1630")) | |
let l:cb = trim(@+) | |
else | |
" do oldschool way to trim all spaces and whatnot | |
let l:cb = substitute(@+,'\v^\s*(.{-})\s*\n$','\1','') | |
endif | |
let l:cb = substitute(l:cb, '\v^https://github.com/','','') | |
if a:arg | |
put = 'Plug ''' . l:cb . '''' | |
else | |
" without the `Plug` command | |
put = 'call minpac#add(''' . l:cb . ''')' | |
endif | |
endfunction | |
nnoremap <leader>v :call AddPacFromCb(1)<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment