Skip to content

Instantly share code, notes, and snippets.

@SethMilliken
Created October 12, 2011 22:50
Show Gist options
  • Save SethMilliken/1282876 to your computer and use it in GitHub Desktop.
Save SethMilliken/1282876 to your computer and use it in GitHub Desktop.
command! -nargs=* Checkin :call Checkin(<q-args>)
function! Checkin(...) " {{{
let message = a:000[0]
let g:last_commit_message = message
if CheckinCheckup()
call Herenow()
if len(message) > 0
exe ":Gcommit % -m\"" . message . "\""
else
exe ":Gcommit -v %" | wincmd T
endif
endif
endfunction
" }}}
function! CheckinCheckup(...) " {{{
let show_prompt = len(a:000) > 0
if exists(":Gcommit")
if show_prompt
call feedkeys(":Checkin ")
else
return 1
endif
else
let currentfile = (len(expand("%:p")) > 0) ? expand("%") : "Unsaved buffer"
echo currentfile . " is not in a recognized vcs work tree."
return 0
endif
endfunction
" }}}
command! Herenow :call Herenow()
function! Herenow() " {{{
exec ":lcd " . expand("%:p:h")
echo "cwd now: " . getcwd()
endfunction
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment