diff --git a/vimrc b/vimrc index 2ab05c6..63c9106 100644 --- a/vimrc +++ b/vimrc @@ -294,6 +294,30 @@ function! s:hex(...) endfunction command! -nargs=* Hex call hex() +function! s:uncommitted(...) + if a:0 + let l:commit = a:1 + else + let l:commit = "HEAD" + end + let l:filetype = &filetype + below new + set modifiable + exec "r!git show ".l:commit.":./#" + 1,1del + au BufUnload diffoff! + let &filetype = l:filetype + silent exec "file ยง".expand("#:t")."@".l:commit + set buftype=nofile + set bufhidden=delete + set nomodifiable + diffthis + exec "normal \k" + diffthis + set foldlevel=999 +endfun +command! -nargs=? Uncommitted call uncommitted() + function! s:unsaved() if &mod let l:filetype = &filetype