10 years ago
Relies on vim-fugitive. Maps <leader>gp
to "git push." When editing a git commit message, performs :Gwrite
to finish the message then :Git push
es to the remote. Otherwise, simply :Git push
es.
function! WriteAndPush() if expand('%') == "COMMIT_EDITMSG" || expand('%:h') == "COMMIT_EDITMSG" :Gwrite :Git push else :Git push endif endfunction nnoremap <leader>gp :call WriteAndPush()<CR>
Pierre Penninckx 10 years ago
I would also clearly recommend tpope's awesome https://github.com/tpope/vim-fugitive.