Created
October 12, 2011 22:50
-
-
Save SethMilliken/1282876 to your computer and use it in GitHub Desktop.
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
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