From 1937bc3cd9de9b9f243903d7edc534b744540ca1 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 1 Sep 2019 20:47:49 -0500 Subject: [PATCH] Experimental support for blank buffers --- plugin/fugitive.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index c0773b9..7103643 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -9,8 +9,13 @@ endif let g:loaded_fugitive = 1 function! FugitiveGitDir(...) abort - if !a:0 || a:1 ==# -1 - return get(b:, 'git_dir', '') + if !a:0 || type(a:1) == type(0) && a:1 < 0 + let dir = get(b:, 'git_dir', '') + if empty(dir) && get(g:, 'fugitive_blank_buffer_2019_alpha') && strftime('%Y') == 2019 && + \ (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$') + return FugitiveExtractGitDir(getcwd()) + endif + return dir elseif type(a:1) == type(0) return getbufvar(a:1, 'git_dir') elseif type(a:1) == type('')