Set bufname for [Scratch] (buftype = nofile) or [No Name] (otherwise)

This commit is contained in:
yasuda 2021-04-14 15:30:03 +09:00
parent ed60e1d369
commit bc5945de65

View File

@ -34,6 +34,9 @@ function! airline#extensions#fugitiveline#bufname()
let fmod = s:ModifierFlags()
if empty(b:fugitive_name)
if empty(bufname('%'))
return &buftype ==# 'nofile' ? '[Scratch]' : '[No Name]'
endif
return fnamemodify(bufname('%'), fmod)
else
return fnamemodify(b:fugitive_name, fmod). " [git]"