Coder Social home page Coder Social logo

semanser / vim-outdated-plugins Goto Github PK

View Code? Open in Web Editor NEW
51.0 4.0 4.0 37 KB

๐Ÿ”„ Async Vim/Neovim plugin for showing the number of your outdated plugins

Vim Script 100.00%
vim vim-plugin vim-plug outdated-plugins async-vim vim-support neovim

vim-outdated-plugins's Introduction

Vim support Vim support GitHub release

vim-outdated-plugins

Async plugin for showing number of your outdated plugins.

What it does?

This plugin automatically checks if any of your plugins are outdated and display a message about that.

To use this plugin make sure you have git installed.

Installation

Plug 'semanser/vim-outdated-plugins'

Configuration

" Do not show any message if all plugins are up to date. 0 by default
let g:outdated_plugins_silent_mode = 1

Screenshots

Simple message text message under the status bar.

alt text alt text

OS

  • macOS
  • Linux
  • Windows

Plugin Managers:

  • vim-plug
  • Vundle
  • Pathogen
  • dein.vim
  • NeoBundle
  • VAM

Notificatation methods

  • Basic echo
  • Status line variable

vim-outdated-plugins's People

Contributors

semanser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vim-outdated-plugins's Issues

Do not rely on English return string of `git status -uno`

$ git status -uno returns if the locale language is e.g. German

:!git status -uno
Auf Branch master
Ihr Branch ist auf demselben Stand wie 'origin/master'.

nichts zu committen (benutzen Sie die Option -u, um unversionierte Dateien anzuzeigen) 

The current regexif (join(a:data) =~ "is behind") does not catch this .

IMHO it is better to use git to return the actual number of commits behind upstream on the current branch. This does for example following command

$ git rev-list HEAD..origin --count

(from https://stackoverflow.com/questions/29035858/git-show-number-of-commits-behind-upstream#comment79656552_29039305)

The correspending change to plugin/vim-outdated-plugins.vim would be

โฏ git diff
diff --git a/plugin/vim-outdated-plugins.vim b/plugin/vim-outdated-plugins.vim
index 8d12f4d..0cb843f 100644
--- a/plugin/vim-outdated-plugins.vim
+++ b/plugin/vim-outdated-plugins.vim
@@ -1,5 +1,5 @@
 function! s:JobHandler(job_id, data, event) dict
-  if (str2nr(join(a:data)) =~ "is behind")
+  if (str2nr(join(a:data)) != 0)
     let g:pluginsToUpdate += 1
   endif
 endfunction
@@ -22,7 +22,7 @@ function! CheckForUpdates()

   " TODO check only activated plugins and not all downloaded
   for key in keys(g:plugs)
-    let job = async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update && git status -uno"], s:callbacks)
+    let job = async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update > /dev/null && git rev-list HEAD..origin --count"], s:callbacks)
   endfor
 endfunction

Improve performance

Hi. This plugin is awesome. Thank you man. The only issue with it for me is that it slows down (just a little bit) my nvim during startup. So, it would be really cool to enhance that somehow.

I wasn't sure what will be the best way to demonstrate this issue, so I've recorded startup process of my nvim with this plugin and without.

With Plugin:
with plugin

Without Plugin:
without plugin

Please note how long it takes vim to show startup page after I hit enter

Do not show any message if plugins are up-to-date

Currently, if all plugins are up to date - the plugin will show "All plugins up-to-date" message on vim startup. There is big disadvantage in such approach - if any other plugin will have any errors - current plugin will override that message. E.g. recently I had a problem with one plugin, which was posting it's error in the same line as vim-outdated and it was almost impossible to note this error.

Also, personally I don't care much if all my plugins are up to date. I would like to be informed only if plugins are outdated - so I can decide what to do with that.

Display message only once after all jobs are finished

I am using vim8 and have configured a minimal setup:

~/.vim
โฏ tree -L 3
.
โ”œโ”€โ”€ autoload
โ”‚ย ย  โ””โ”€โ”€ plug.vim
โ”œโ”€โ”€ plugged
โ”‚ย ย  โ”œโ”€โ”€ vim-easy-align
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ EXAMPLES.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ README.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ autoload
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ doc
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ plugin
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ test
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ zip
โ”‚ย ย  โ””โ”€โ”€ vim-outdated-plugins
โ”‚ย ย      โ”œโ”€โ”€ README.md
โ”‚ย ย      โ”œโ”€โ”€ autoload
โ”‚ย ย      โ”œโ”€โ”€ images
โ”‚ย ย      โ””โ”€โ”€ plugin
โ””โ”€โ”€ vimrc

11 directories, 6 files
~/.vim
โฏ cat vimrc
source $VIMRUNTIME/defaults.vim

call plug#begin('~/.vim/plugged')

Plug 'junegunn/vim-easy-align'
Plug 'semanser/vim-outdated-plugins'

call plug#end()

When I start vim and run :messages, I see that vim-outdated-plugins has emitted two times the message:

Messages maintainer: Bram Moolenaar <[email protected]>
All plugins up-to-date
All plugins up-to-date

I would prefer only to get a single message when all checks are done.

I have come up with a solution which works for me but I am not sure if it is implemented job-safe : I mean: I remove a job id from a dict in a callback which I am not sure could lead to a collision.

~/.vim/plugged/vim-outdated-plugins master*
โฏ g diff
diff --git a/plugin/vim-outdated-plugins.vim b/plugin/vim-outdated-plugins.vim
index 8d12f4d..5e86b18 100644
--- a/plugin/vim-outdated-plugins.vim
+++ b/plugin/vim-outdated-plugins.vim
@@ -1,14 +1,17 @@
 function! s:JobHandler(job_id, data, event) dict
-  if (join(a:data) =~ "is behind")
+  if (str2nr(join(a:data)) != 0)
     let g:pluginsToUpdate += 1
   endif
 endfunction

 function! s:CalculateUpdates(job_id, data, event) dict
-  if g:pluginsToUpdate > 0
-    echom 'Plugins to update: ' . g:pluginsToUpdate
-  else
-    echom 'All plugins up-to-date'
+  call remove(g:check_for_updates_jobids, a:job_id) " Question: lock required?
+  if len(g:check_for_updates_jobids) == 0
+    if g:pluginsToUpdate > 0
+      echom 'Plugins to update: ' . g:pluginsToUpdate
+    else
+      echom 'All plugins up-to-date'
+    endif
   endif
 endfunction

@@ -21,8 +24,9 @@ function! CheckForUpdates()
   let g:pluginsToUpdate = 0

   " TODO check only activated plugins and not all downloaded
+  let g:check_for_updates_jobids = {}
   for key in keys(g:plugs)
-    let job = async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update && git status -uno"], s:callbacks)
+    let g:check_for_updates_jobids[async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update > /dev/null && git rev-list HEAD..origin --count"], s:callbacks)] = key
   endfor
 endfunction

Another issue which I think has to be taken into account is when the git command fails.

BTW Issue #11 should easily be resolved by simply removing the lines

-  else
-    echom 'All plugins up-to-date'

Check if vim-plug itself has an update

Hi,

Looks like a nice plugin. This is really just a feature suggestion. Personally, I don't rmember to do PlugUpgrade very often. It's probably not a big deal, since it's not updated too often, but it would be nice to echo something about that as well maybe... if it doesn't make the message too long.

Is is possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.