I love vimdiff and would want to be able to somehow show the differences
between the repository and my local file(s) in vimdiff instead of plain
diff output on STDOUT.
Is anyone aware of a working solution to this problem? My initial hunch
would be to vimdiff the local file and the same file with the inverted
svn diff patch applied to it, but that is just ugly.
Richard
I use svncommand.vim and the command :SVNVimDiff
Well, there are a number of vim-scripts that facilitate working
with svn/cvs/etc repositories:
Particularly the vcscommand.vim, svncommand.vim, and svn-diff.vim
scripts look promising.
My guess would be that each offers something along the lines of
:vert new
:r! svn cat -rHEAD #
:0d
:diffthis
:wincmd p
:diffthis
-tim
> I use svncommand.vim and the command :SVNVimDiff
> http://www.vim.org/scripts/script.php?script_id=922
Thanks!
Richard
On Sep 13, 12:43 pm, "Richard Hartmann" <richih.mailingl...@gmail.com>
wrote:
> I love vimdiff and would want to be able to somehow show the differences
> between the repository and my local file(s) in vimdiff instead of plain
> diff output on STDOUT.
I use :SVNDiff -- that was already suggested -- when I am already in
vim. But I also have this function in my .bashrc and .zshrc ...
vv () {
$@ | vim -R -
}
...when there is any command output that I want to see in vim I just
prefix the command with 'vv'...
vv svn diff
vv svn log
The macro basically expands the above to
svn diff | vim -R -
svn log | vim -R -
I also have a 'v' macro that only invokes vim if the output is more
then a page. 'v' is a bit more complicated then 'vv', but you can see
it in this link...
http://www.jukie.net/~bart/conf/bash.d/S101_common_tools.sh
http://www.jukie.net/~bart/conf/zsh.d/S59_tools
-Bart
> vv () {
> $@ | vim -R -
> }
I don't know if you like to do it that way, but if you do
alias -g V='| vim -'
in you .zshrc , you can do
svn diff V
and look at the diff that way. In your case, you would probably
want to us VV, though. I use upper case so I can protect against
accidental hits of the global alias.
I will look through your shebangs, I always love to peek and steal :)
Richard
Not to steal the spotlight from the project this group is about... but
WOW, zsh surprises me all the time.
Thanks.
-Bart
The other solutions mentioned are likely to be more robust, but this
works for me:
The idea is to use 'svn diff' with the '--diff-cmd vimdiff' option. The
problem is that 'svn diff' always passes some options that vim dislikes,
namely '-u -L (name) -L (name)'. So, here's what I do to strip that bit
away.
In .bash_aliases or .bashrc or somesuch:
alias svngvimdiff="svn diff --diff-cmd gvimdiff-svn-wrapper"
An executable script named 'gvimdiff-svn-wrapper' somewhere in your $PATH:
#!/bin/bash
shift 5; /usr/bin/gvimdiff -f "$@"
From then on, 'svngvimdiff' will do what you want.
> alias svngvimdiff="svn diff --diff-cmd gvimdiff-svn-wrapper"
s/gvim/vim/g and I have _exactly_ what I wanted.
Thanks a lot!
Richard
> An executable script named 'gvimdiff-svn-wrapper' somewhere in your $PATH:
At first, I wondered why you needed to use a seperate shebang and tried to
make it work without one. Then, I gradually realized that, no matter what,
svn diff --diff-cmd
will try and execute the whole string it gets as a single command instead
of passing it onto a shell as it should, imo, do. This resulted in a
bug report [1]
against subversion. Let's see what comes from it.
Richard
[1] http://subversion.tigris.org/issues/show_bug.cgi?id=2930
> The macro basically expands the above to
>
> svn diff | vim -R -
> svn log | vim -R -
Using Windows, I get garbage when I do that. Although each
source line in the diff looks fine, the other svn output
ends with garbage (probably an LF instead of CR/LF).
Is this just a bug in svn? Is there a workaround?
Here's the output (only the bad lines) of:
svn diff -rPREV | gvim -
with the ctrl-M replaced by ^M:
Index: version.c^M
===================================================================^M
--- version.c (revision 522)^M
+++ version.c (working copy)^M
@@ -667,6 +667,8 @@^M
Index: ops.c^M
===================================================================^M
--- ops.c (revision 522)^M
+++ ops.c (working copy)^M
@@ -2477,7 +2477,7 @@^M
@@ -2534,7 +2534,9 @@^M
@@ -2579,7 +2581,9 @@^M
@@ -2598,13 +2602,22 @@^M
--
Best regards,
Bill
Vim script 1797 is similar and a bit more robust. It works for me.
http://www.vim.org/scripts/script.php?script_id=1797
--
Noah