Use vimdiff to replace the default 'svn diff'

Source: Internet
Author: User
Step 1 of manual configuration: Configure. vimrc

Objective: vimdiff can automatically wrap a long line of information in wrap.

" ~/.vimrc"BEGIN for vimdifffunc Wrap()  set wrapendfuncmap <F10> :call Wrap()<CR><C-W><C-W> :call Wrap()<CR><C-W><C-W>imap <F10> <ESC>:call Wrap()<C-W><C-W> :call Wrap()<C-W><C-W>"END for vimdiff

Step 2: Configure ~ /. Subversion/config

Purpose: Replace the default SVN diff comparison tool with a custom script. If it is uncomfortable, change it back.

### Set diff-cmd to the absolute path of your 'diff' program.###   Subversion's internal diff implementation.# diff-cmd = diff_program (diff, gdiff, etc.)diff-cmd = /home/xiwang/usr/local/bin/diffwrap.sh

Step 3: Create/edit diffwrap. Sh

Objective: To implement the diffwrap. Sh script so that the vimdiff command can be correctly executed when the 'svn diff' command is executed.

#!/bin/bash# diffwrap.sh# ---BEGIN--- change#shift 5#vimdiff "$@"DIFF="vimdiff"LEFT=${6}RIGHT=${7}$DIFF $LEFT $RIGHT# ----END---- change

The script can be upgraded to control which diff command to use through the Environment Variable diff. For example, if you want to use vimdiff, you can directly run the command: Export diff = vimdiff:

#!/bin/bash# @input environment DIFF='diff'|'vimdiff'# ---BEGIN--- change# DIFF="diff"# LEFT=${6}# RIGHT=${7}## $DIFF "$LEFT" "$RIGHT"if [ x"$DIFF" == x"" ]; then    DIFF="diff"; export DIFFfiLEFT=${6}RIGHT=${7}case "$DIFF" in    "vimdiff")        ;;    "diff")        OPTS="-Nu"        ;;esac$DIFF "$LEFT" "$RIGHT" $OPTS# ----END---- change

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.