Skip to content

Commit

Permalink
:GitCatFile
Browse files Browse the repository at this point in the history
  • Loading branch information
motemen committed Jun 18, 2008
1 parent f357e2a commit e82c4b2
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions plugin/git.vim
Expand Up @@ -117,6 +117,19 @@ function! GitCheckout(args)
call GitDoCommand('checkout ' . a:args)
endfunction

" Show commit, tree, blobs.
function! GitCatFile(file)
let file = s:Expand(a:file)
"let file_type = system('git cat-file -t ' . file)
let git_output = system('git cat-file -p ' . file)
if !strlen(git_output)
echo "No output from git command"
return
endif

call <SID>OpenGitBuffer(git_output)
endfunction

function! GitDoCommand(args)
let git_output = system('git ' . a:args)
let git_output = substitute(git_output, '\n*$', '', '')
Expand Down Expand Up @@ -200,10 +213,11 @@ endfunction

command! -nargs=1 -complete=customlist,ListGitCommits GitCheckout call GitCheckout(<q-args>)
command! -nargs=* -complete=customlist,ListGitCommits GitDiff call GitDiff(<q-args>)
command! GitStatus call GitStatus()
command! -nargs=? GitAdd call GitAdd(<q-args>)
command! GitLog call GitLog()
command! GitCommit call GitCommit()
command! -nargs=+ Git call GitDoCommand(<q-args>)
command! GitStatus call GitStatus()
command! -nargs=? GitAdd call GitAdd(<q-args>)
command! GitLog call GitLog()
command! GitCommit call GitCommit()
command! -nargs=1 GitCatFile call GitCatFile(<q-args>)
command! -nargs=+ Git call GitDoCommand(<q-args>)
command! GitVimDiffMerge call GitVimDiffMerge()
command! GitVimDiffMergeDone call GitVimDiffMergeDone()

0 comments on commit e82c4b2

Please sign in to comment.