In my .subversion/config
file, I have set diff-cmd
as a script which invokes vimdiff
to view the changes.
Following is my problem:
I am viewing diff between two svn URLS, which have 10 files modified. The svn diff url1 url2
command would open the diff of first file. Issuing :qa in vim would show the diff of second file. Now, is there a way to quit vim altogether, aborting further viewing of diffs (other than running :qa for remaining 8 times)?
Update: Following is my script:
#!/bin/sh
# use vimdiff to view diffs
DIFF="/usr/bin/vimdiff -o"
NUM=$# # number of arguments
LEFT=${6} # old file
RIGHT=${7} # new file
L_TITLE=${3} # actual name and revision of old file
R_TITLE=${5} # actual name and revision of new file
ST="${L_TITLE}"
# get the file name
NAME=`echo $ST | tr -s ' ' '\n' | head -1`
L_BRANCH=`echo $L_TITLE | tr -s ' ' '\n' | head -2 | tail -1`
R_BRANCH=`echo $R_TITLE | tr -s ' ' '\n' | head -2 | tail -1`
# get the old and new revision numbers
L_REV=`echo $L_TITLE | tr -s '(' '\n' | cut -d ')' -f1 | tail -1 | tr -s ' ' '_' `
R_REV=`echo $R_TITLE | tr -s '(' '\n' | cut -d ')' -f1 | tail -1 | tr -s ' ' '_' `
L_REV=`echo "${L_BRANCH}__${L_REV}"`
R_REV=`echo "${R_BRANCH}__${R_REV}"`
# invoke vim
$DIFF $LEFT $RIGHT -c "setl stl=$NAME%20{'$L_REV'} | wincmd W | setl stl=$NAME%20{'$R_REV'}"
What is vimdiff? Vimdiff is a Linux command that can edit two, three, or four versions of a file with Vim and show their differences.
Since Vim(diff) is invoked sequentially with pairs of files (by Subversion), the exit status of Vim would be a good way to indicate that the whole process is to be aborted. The :cquit
command exits with an error code. If the surrounding executable already aborts the loop on error, you're done. Otherwise, that would have to be modified. As you seem to have an additional wrapper script around vimdiff
, that one must not swallow Vim's exit status (and it looks like it doesn't).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With