Created
May 18, 2012 08:08
-
-
Save dahu/2723903 to your computer and use it in GitHub Desktop.
Diffalicious - Compare two mouse-selected texts in Vim
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
" Diffalicious - Compare two mouse-selected texts in Vim | |
" Barry Arthur, 2012 5 18 | |
let s:second_window_text = "Select text to compare with other window and press <enter> here." | |
function! Diffalicious() | |
tabnew | |
call DiffPasteIt() | |
botright vnew | |
call setline(1, s:second_window_text) | |
nnoremap <buffer> <cr> :call DiffPartTheSecond()<cr> | |
endfunction | |
function! DiffPasteIt() | |
put! * | |
$ delete _ | |
set buftype=nofile | |
diffthis | |
endfunction | |
function! DiffPartTheSecond() | |
if getline(1) != s:second_window_text | |
echom "This doesn't look like a Diffalicious tab. Aborting cowardly." | |
return | |
endif | |
% delete _ | |
call DiffPasteIt() | |
endfunction | |
nnoremap <leader>D :call Diffalicious()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment