Comments (20)
Hi, thanks for the suggestion. This could be an interesting addition to vim-plug.
Actually with git reflogs, this can be implemented outside of vim-plug, try this.
function! PlugDiff()
new
syn match title /^[^ ].*/
syn match date /([^)]*)$/
hi def link title Title
hi def link date Comment
for [k, v] in items(g:plugs)
execute 'cd '.substitute(v.dir, ' ', '\\ ', 'g')
let diff = system('git log --graph --pretty=format:"%h %s (%cr)" "HEAD@{0}...HEAD@{1}"')
if !empty(diff)
call append(line('$') - 1, k)
call append(line('$') - 1, map(split(diff, '\n'), '" ". v:val'))
put =
endif
cd -
endfor
endfunction
I haven't decided how I'm going to include this feature in vim-plug. Should I add :PlugDiff
command ? Or should I show it only after PlugUpdate
call like Vundle does. What do you think?
from vim-plug.
That looks really cool! I guess both having a separate PlugDiff command and having an option to display the diff after an update are useful. But I think the main use case is to do an update and then see what's new (that's how I did it with Vundle).
Just a minor comment on the current function: would be nice to strip the white space at the end of the lines, it's highlighted in my configuration.
from vim-plug.
Okay, two things:
- Add
:PlugDiff
command - Make pressing
D
in PlugUpdate window invoke PlugDiff
from vim-plug.
Sounds great!
from vim-plug.
Could you update and check if it works as expected?
from vim-plug.
Thanks for the updates! I've tried the new version: PlugDiff works as expected (shows the unmerged changes). I would rename "Updated changes" to one of "Upstream changes", or "Unmerged changes", or "Remote changes".
However, pressing D
after running PlugUpdate doesn't exactly do what's expected, as looks like it shows the diff after the changes have been merged, therefore, it's empty ("No update", which I think would sound better if it was "No updates"). One way to fix it would be running PlugDiff first when PlugUpdate is invoked, storing the output, then applying the actual updates, and then displaying the stored PlugDiff output if D
is pressed.
What do you think of changing D
to d
, as it's a bit easier to type?
from vim-plug.
Actually they are the "merged" changes from the last pull made by PlugUpdate. (Maybe the name is misleading? It doesn't work like git diff
) PlugUpdate again will naturally empty PlugDiff output.
cd ~/.vim/plugged/*
git reset --hard HEAD^^
vim +PlugUpdate
# Then hit D -> PlugUpdate -> D
Regarding D
, I chose uppercase D
because I prefer having a shortcut key that is hard to hit accidentally, not to confuse users unaware of the feature.
from vim-plug.
I'm not sure what happened last time, but now I tried it again and it worked fine :) The only thing is that it didn't reset PlugDiff after update. What I mean is:
cd ~/.vim/plugged/*
git reset --hard HEAD^^
vim +PlugUpdate
# D (shows the merged commits) -> q
# PlugDiff (shows the same commits, but at this point should show "No updates")
Another minor problem is that the diff buffer doesn't wrap lines and in a vertical split the ends of long lines get hidden.
from vim-plug.
PlugDiff (shows the same commits, but at this point should show "No updates")
No, it's intentional and I think it's better to be able to review the changes multiple times than to be able to see it just once after update. The README page currently states that PlugDiff
is for "See(ing) the updated changes from the previous PlugUpdate". (Another PlugUpdate will reset the message.)
I'm disabling line wrapping in the split. I just thought it looked better in the presence of long messages, and haven't given enough thought about that.
from vim-plug.
Ah, now I understand your intention and I agree it's nice to be able to review the changes multiple times. To make it clearer then I would suggest to rename "Updated changes" to something like "Last update".
However, there is still a problem and I think that's what confused me. If you do git reset
on a plugin and PlugUpdate, then PlugDiff correctly shows the commits merged by the last update. If now you git reset
another plugin, then run PlugDiff again without running PlugUpdate first, it shows both the already merged commits of the first plugin and not yet merged commits of the second plugin.
What do you think of having two separate commands: one which shows the changes merged by the last update (PlugDiff) and another that allows you to preview the upcoming changes before doing an update?
from vim-plug.
That's because git reset
has updated reflog of the repository (Check out the output of git reflog
). The reason the current implementation of :PlugDiff
can be so simple is that it assumes that the managed repositories are only updated by :PlugUpdate
and not directly touched by user. So it just shows the commits between HEAD and the previous reflog. In order to make :PlugDiff
precise, we have to scan through the list of reflogs and find the exact points of the pulls. But I personally don't think it's really worth it.
from vim-plug.
(And I didn't want to introduce some shell scripting for doing that because it also has to work on Windows)
from vim-plug.
Ok, I agree it's not worth it. What do you think about renaming "Updated changes" to something like "Last update"?
from vim-plug.
Okay, just a sec.
from vim-plug.
Updated. I'm not a native speaker of English, so I'm open to suggestions on messages. Thanks!
from vim-plug.
Awesome, thanks a lot! I'm not a native English speaker as well :)
from vim-plug.
I realize this has already been merged, but how about adding something along the lines of "Press 'D' to see changes" after PlugUpdate
is done, just as a hint? I'm thinking at the end of s:finish()
might be a suitable place. Just a simple a simple echo "Press..."
would suffice.
from vim-plug.
@Renstrom Ah yeah, echo
would be nice. I'll let you know when I update the code.
from vim-plug.
@Renstrom @beloglazov I've updated the code to echo the message on PlugUpdate
. Additionally, now you can see the content of a commit by pressing enter key on each line of PlugDiff
output.
from vim-plug.
Works nicely, thanks!
from vim-plug.
Related Issues (20)
- PowerShell automatic installation script. HOT 1
- [Feature Request]plugin installation declaration and plugin configuration put together HOT 2
- vim-plug buffer inside popup window HOT 4
- How to use submodules with vim-plug HOT 1
- Error when running :PlugUpgrade HOT 3
- PlugUpdate/PlugUpgrade FATAL: Could not read from remote repository HOT 1
- Activate plugin only if executable is installed HOT 1
- Vim plug and lua plugins: calling setup & config functions HOT 1
- PlugClean fails to recover when remote renamed default branch HOT 2
- How to pass configuration options (opts) to plugins? HOT 1
- PlugUpdate revert HOT 1
- (Re)load *.lua in addition to *.vim HOT 3
- Lua support? HOT 2
- Vin Plug installation problem in windows OS
- Manage the configs for each vim-plugged plugin in a separate file.
- On demand loading with user defined commands? HOT 2
- error message on opening .vimrc HOT 1
- Installation fails(?) on neovim 0.9.5 on Macos HOT 3
- Improve for https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation-of-missing-plugins HOT 1
- Running multiple commands in after update hook HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-plug.