From 6bab1a0c398a9a6aaef607a5361709393eba79ac Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 25 Jul 2018 16:16:38 -0400 Subject: [PATCH] Map p to jump to file in preview window Closes https://github.com/tpope/vim-fugitive/issues/1047 --- autoload/fugitive.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index f7e3f0f..b2426f3 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3010,6 +3010,7 @@ function! fugitive#MapJumps(...) abort nnoremap o :exe GF("split") nnoremap S :exe GF("vsplit") nnoremap O :exe GF("tabedit") + nnoremap p :exe GF("pedit") nnoremap - :exe Edit('edit',0,'',NavigateUp(v:count1)) if getline(1) =~# '^tree \x\{40\}$' && empty(getline(2))call search('^'.escape(expand('#:t'),'.*[]~\').'/\=$','wc')endif nnoremap P :exe Edit('edit',0,'',ContainingCommit().'^'.v:count1.Relative(':')) nnoremap ~ :exe Edit('edit',0,'',ContainingCommit().'~'.v:count1.Relative(':')) @@ -3214,7 +3215,11 @@ function! s:GF(mode) abort catch /^fugitive:/ return 'echoerr v:errmsg' endtry - if len(results) + if len(results) > 1 && a:mode ==# 'pedit' + return a:mode . + \ ' +' . join(map(results[1:-1], 'escape(v:val, " ")'), '\|') . ' ' . + \ s:fnameescape(s:Generate(results[0])) + elseif len(results) return s:Edit(a:mode, 0, '', results[0]).join(map(results[1:-1], '"|".v:val'), '') else return ''