Created
August 29, 2010 22:55
-
-
Save hotoo/556783 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function! Jump2NextDiffText(dir) | |
| if a:dir=="prev" | |
| exec "normal [c" | |
| elseif a:dir=="next" | |
| exec "normal ]c" | |
| endif | |
| if synIDattr(diff_hlID(".", col(".")), "name")=="DiffChange" | |
| let line=line(".") | |
| let cols=col("$")-1 | |
| let idx=1 | |
| while idx<=cols | |
| if synIDattr(diff_hlID(line, idx), "name")=="DiffText" | |
| call setpos(".", [0,line,idx]) | |
| echo line.",".idx.",".cols | |
| break | |
| else | |
| let idx = idx+1 | |
| endif | |
| endwhile | |
| endif | |
| endfunction | |
| if &diff | |
| nmap <F7> :call Jump2PrevDiffText("prev")<cr> | |
| nmap <F8> :call Jump2NextDiffText("next")<cr> | |
| else | |
| map <F7> :cp<cr> | |
| map <F8> :cn<cr> | |
| endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment