Skip to content

Commit

Permalink
Cleanup commits list code and recommend running status after update.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jul 20, 2018
1 parent 0a0d149 commit cb4f8ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ endif
" Define user commands for updating/cleaning the plugins.
" Each of them loads minpac, reloads .vimrc to register the
" information of plugins, then performs the task.
command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update()
command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update() | call minpac#status()
command! PackClean packadd minpac | source $MYVIMRC | call minpac#clean()
command! PackStatus packadd minpac | source $MYVIMRC | call minpac#status()
```
Expand Down Expand Up @@ -181,7 +181,7 @@ call minpac#update()
" To uninstall unused plugins:
call minpac#clean()
" To see plugins s tatus:
" To see plugins status:
call minpac#status()
```

Expand Down
19 changes: 5 additions & 14 deletions autoload/minpac/impl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -460,23 +460,14 @@ function! minpac#impl#status()
\ '--color=never', '--pretty=format:%h %s (%cr)', 'HEAD...HEAD@{1}'
\ ])

let l:commits = filter(l:commits[1], {-> v:val !=? '' })
let l:plugin.lines = filter(l:commits[1], {-> v:val !=? '' })

" Show installed status only when the plugin is installed for the first time
if has_key(l:pluginfo, 'installed') && l:pluginfo.installed ==? 0
let l:plugin.status = 'Installed'
elseif !l:update_ran
if !l:update_ran
let l:plugin.status = 'OK'
endif

" Fetching log on non-updated plugin returns fatal error, so make sure
" to handle that case properly
if len(l:commits) > 0 && l:commits[0] !~? 'fatal'
let l:plugin.lines = l:commits
endif

if get(l:pluginfo, 'revision') !=? '' && l:pluginfo.revision !=# s:get_plugin_revision(l:name)
elseif len(l:plugin.lines) > 0
let l:plugin.status = 'Updated'
elseif has_key(l:pluginfo, 'installed') && l:pluginfo.installed ==? 0
let l:plugin.status = 'Installed'
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion doc/minpac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Load minpac on demand
" Define user commands for updating/cleaning the plugins.
" Each of them loads minpac, reloads .vimrc to register the
" information of plugins, then performs the task.
command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update()
command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update() | call minpac#status()
command! PackClean packadd minpac | source $MYVIMRC | call minpac#clean()
<
Note that your .vimrc must be reloadable to use this. E.g.:
Expand Down

0 comments on commit cb4f8ff

Please sign in to comment.