Last active
December 12, 2015 00:08
-
-
Save anantpatil/4681264 to your computer and use it in GitHub Desktop.
A script to cycle through all the modified files in subversion repository to see the diffs in gvim. Tested with subversion 1.6. Depending on the version of subversion, you may need to modify cut command to get the exact file name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Author: Anant Patil ([email protected]) | |
# | |
# Make a list of all the modified files in local subversion repository | |
# in current directory. Cycle throuh all the files and ask if you want | |
# to see the diff. | |
# | |
# Uses svnvimdiff command created by Geoff Buchan which can be found at | |
# https://github.com/vim-scripts/svnvimdiff/blob/master/svnvimdiff | |
# | |
svn st | | |
grep "^M" | | |
cut -c9- | | |
while read file; | |
do | |
echo -ne "View diff of $file? (y/n)\n" | |
# -s option for echo off | |
# read from stdin otherwise reads from the file in | |
# loop i.e. gets the new line from file in i | |
read -s -n 1 answer <&1 | |
case $answer in | |
[Yy] ) svnvimdiff -g $file | |
;; | |
* ) ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to always see the diffs in gvim opened in maximum possible size to fit the screen. For that I have modified svnvimdiff script to take "~/.gvimfullscreenrc" file as RC file instead of ~/.vimrc.
svnvimdiff before change:
if [[ $1 == "-g" ]] ; then
vimdiff="gvimdiff -f"
shift 1
fi
After changes:
if [[ $1 == "-g" ]] ; then
Make it a full screen diff
vimdiff="gvimdiff -f -U ~/.gvimfullscreenrc"
shift 1
fi
Added following lines to ~/.vimrc to make it open in max. possible size and created ~.gvimfullscreenrc:
" The following lines are added so that gvim opens in max possible size
" on a given screen. This helps in diff commands (svnvimdiff) so that we
" can see the diff on whole screen
if has('gui_running')
set lines=1024
set columns=256
endif