Skip to content

Instantly share code, notes, and snippets.

@habahut
Created January 5, 2015 19:12
Show Gist options
  • Save habahut/44ecf9c968dfd6c1fb8b to your computer and use it in GitHub Desktop.
Save habahut/44ecf9c968dfd6c1fb8b to your computer and use it in GitHub Desktop.
Diff Saved Vim
nnoremap <leader>D :DiffSaved<cr>
function! s:DiffWithSaved()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfunction
com! DiffSaved call s:DiffWithSaved()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment