Skip to content

Commit 2a1807f

Browse files
committed
feat(minpac): :PackReinstall
1 parent 5240682 commit 2a1807f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

autoload/aceforeverd/plugin.vim

+16-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ function! s:pack_open_dir(name) abort
3232
exe 'edit' dir
3333
endfunction
3434

35+
function! s:pack_reinstall(name) abort
36+
let canonical_name = substitute(a:name, '\(^\s*\|\s*$\)', '', 'g')
37+
let dir = minpac#getpluginfo(canonical_name).dir
38+
call delete(dir, 'rf')
39+
call minpac#update(a:name)
40+
endfunction
41+
3542
function! s:pre_cmds() abort
3643
" tiny wrapper for :packadd
3744
" good thing is use :PackAdd! to ignore any errors and do not terminate,
@@ -54,14 +61,22 @@ function! s:pre_cmds() abort
5461
\ call aceforeverd#plugin#init() | call <SID>pack_open_dir(<q-args>)
5562

5663
command! -nargs=1 -complete=custom,PackList PackOpenUrl
57-
\ call plugin_browse#open_uri(minpac#getpluginfo(substitute(<q-args>, '\(^\s*\|\s*$\)', '', 'g')).url)
64+
\ call aceforeverd#plugin#init() | call aceforeverd#keymap#browse#open_uri(minpac#getpluginfo(substitute(<q-args>, '\(^\s*\|\s*$\)', '', 'g')).url)
65+
66+
command! -nargs=1 -complete=custom,PackList PackReinstall
67+
\ call aceforeverd#plugin#init() | call <sid>pack_reinstall(<q-args>)
5868
endfunction
5969

6070
function! s:plugin_add(...) abort
6171
call call('minpac#add', a:000)
6272
endfunction
6373

6474
function! aceforeverd#plugin#init() abort
75+
if get(g:, 'initialized_minpac', 0) != 0
76+
return
77+
endif
78+
let g:initialized_minpac = 1
79+
6580
if has('nvim')
6681
let s:pack_path = stdpath('data') . '/site/'
6782
else

0 commit comments

Comments
 (0)