better handling of blank buffers.
This commit is contained in:
parent
ffcdd3b1a3
commit
fbdf39c403
@ -29,9 +29,9 @@ function! airline#extensions#tabline#get()
|
|||||||
for nr in range(1, bufnr('$'))
|
for nr in range(1, bufnr('$'))
|
||||||
if buflisted(nr) && bufexists(nr)
|
if buflisted(nr) && bufexists(nr)
|
||||||
if cur == nr
|
if cur == nr
|
||||||
call b.add_section('airline_tablinesel', '%( %{fnamemodify(bufname('.nr.'),"'.s:fmod.'")} %)')
|
call b.add_section('airline_tablinesel', '%( %{airline#extensions#tabline#get_buffer_name('.nr.')} %)')
|
||||||
else
|
else
|
||||||
call b.add_section('airline_tabline', '%( %{fnamemodify(bufname('.nr.'),"'.s:fmod.'")} %)')
|
call b.add_section('airline_tabline', '%( %{airline#extensions#tabline#get_buffer_name('.nr.')} %)')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -59,6 +59,14 @@ endfunction
|
|||||||
function! airline#extensions#tabline#title(n)
|
function! airline#extensions#tabline#title(n)
|
||||||
let buflist = tabpagebuflist(a:n)
|
let buflist = tabpagebuflist(a:n)
|
||||||
let winnr = tabpagewinnr(a:n)
|
let winnr = tabpagewinnr(a:n)
|
||||||
return fnamemodify(bufname(buflist[winnr - 1]), s:fmod)
|
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||||
|
let name = bufname(a:nr)
|
||||||
|
if empty(name)
|
||||||
|
return '[No Name]'
|
||||||
|
endif
|
||||||
|
return fnamemodify(name, s:fmod)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user