nnoremap [fugitive] nmap g [fugitive] nnoremap [fugitive] :Git nnoremap [fugitive]s :Gstatus nnoremap [fugitive]c :Gcommit nnoremap [fugitive]C :Git commit --amend nnoremap [fugitive]g :Ggrep nnoremap [fugitive]l :Glog nnoremap [fugitive]e :Gedit nnoremap [fugitive]v :Gvsplit nnoremap [fugitive]t :Gtabedit nnoremap [fugitive]re :Gread nnoremap [fugitive]w :Gwrite nnoremap [fugitive]d :Gdiff nnoremap [fugitive]D :Gdiff master nnoremap [fugitive]mv :Gmove nnoremap [fugitive]rm :Gremove nnoremap [fugitive]b :Gblame -w nnoremap [fugitive]B :Gblame -w -C -C nnoremap [fugitive]ms :call Genki_echo_commit_message() augroup vimrc_vim-figitive autocmd! " Because my vim lose .git/tags on occasion... autocmd BufEnter * call fugitive#detect(expand(':p')) augroup END function! Genki_echo_commit_message() let dir = getcwd() try execute 'lcd' fugitive#extract_git_dir('%') let s:commit_message = system('git log --format=format:"%s (%ad %an)" --date=short -n1 ' . fugitive#buffer().commit()) echo split(s:commit_message, "\n")[0] catch finally execute 'lcd' dir endtry endfunction function! Fugitive_open_pull_request() let buf = fugitive#buffer() if buf.type() ==# 'commit' let rev = fugitive#buffer().rev() else " maybe in blame mode let rev = matchstr(getline('.'),'\x\+') endif let revision_minimum_required_chars = 6 if strchars(rev) < revision_minimum_required_chars echoerr 'Use this in either blame or commit view' return endif call system('git prbrowse ' . rev . ' &') " run in background because it can be slow echo 'Opening pull request...' endfunction command! Gprbrowse call Fugitive_open_pull_request()