From 4ea84b29eb0f1f95bb7f6fb6a0213689eaf981d6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 19 Mar 2021 00:51:44 -0400 Subject: [PATCH] Default coo to identifier under cursor in temp buffers I initially intended to do a :Git branch specific version of this, but `:Git checkout bad-argument --` is mostly harmless, so hack it for now. Closes https://github.com/tpope/vim-fugitive/issues/1572 --- autoload/fugitive.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index a7aa671..99b4732 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -6099,7 +6099,7 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'co', ':Git checkout') call s:Map('n', 'co', ':Git checkout') - call s:Map('n', 'coo', ':Git checkout =SquashArgument() --') + call s:Map('n', 'coo', ':Git checkout =substitute(SquashArgument(),"^$",get(TempState(),"filetype","") ==# "git" ? expand("") : "","") --') call s:Map('n', 'co?', ':help fugitive_co', '') call s:Map('n', 'cb', ':Git branch')