Skip to content

Commit 43f18ab

Browse files
committed
Support netrw buffers with blank buffer names
Resolves: #2179
1 parent 5f0d280 commit 43f18ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugin/fugitive.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function! FugitiveGitDir(...) abort
2323
return g:fugitive_event
2424
endif
2525
let dir = get(b:, 'git_dir', '')
26-
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
26+
if empty(dir) && (empty(bufname('')) && &filetype !=# 'netrw' || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
2727
return FugitiveExtractGitDir(getcwd())
2828
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && &buftype =~# '^\%(nowrite\)\=$'
2929
let b:git_dir = FugitiveExtractGitDir(bufnr(''))
@@ -425,6 +425,9 @@ function! FugitiveExtractGitDir(path) abort
425425
return get(a:path, 'fugitive_dir', get(a:path, 'git_dir', ''))
426426
elseif type(a:path) == type(0)
427427
let path = s:Slash(a:path > 0 ? bufname(a:path) : bufname(''))
428+
if getbufvar(a:path, '&filetype') ==# 'netrw'
429+
let path = s:Slash(getbufvar(a:path, 'netrw_curdir', path))
430+
endif
428431
else
429432
let path = s:Slash(a:path)
430433
endif

0 commit comments

Comments
 (0)