formatting
This commit is contained in:
parent
8d02802194
commit
edd801a9ef
|
@ -1,51 +1,51 @@
|
|||
if exists("+showtabline")
|
||||
|
||||
" Rename tabs to show tab number.
|
||||
" based on:
|
||||
" http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function
|
||||
" Rename tabs to show tab number.
|
||||
" based on:
|
||||
" http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function
|
||||
|
||||
function! MyTabLine()
|
||||
function! MyTabLine()
|
||||
let s = ''
|
||||
let t = tabpagenr()
|
||||
let i = 1
|
||||
while i <= tabpagenr('$')
|
||||
let buflist = tabpagebuflist(i)
|
||||
let winnr = tabpagewinnr(i)
|
||||
let s .= '%' . i . 'T'
|
||||
let s .= (i == t ? '%1*' : '%2*')
|
||||
let buflist = tabpagebuflist(i)
|
||||
let winnr = tabpagewinnr(i)
|
||||
let s .= '%' . i . 'T'
|
||||
let s .= (i == t ? '%1*' : '%2*')
|
||||
|
||||
let s .= (i == t ? '%#TabNumSel#' : '%#TabNum#')
|
||||
let s .= ' ' . i
|
||||
let s .= '%#TabSeparator#:'
|
||||
let s .= (i == t ? '%#TabLineItemSel#' : '%#TabLineItem#')
|
||||
let s .= (i == t ? '%#TabNumSel#' : '%#TabNum#')
|
||||
let s .= ' ' . i
|
||||
let s .= '%#TabSeparator#:'
|
||||
let s .= (i == t ? '%#TabLineItemSel#' : '%#TabLineItem#')
|
||||
|
||||
let bufnr = buflist[winnr - 1]
|
||||
let file = bufname(bufnr)
|
||||
let buftype = getbufvar(bufnr, '&buftype')
|
||||
let bufnr = buflist[winnr - 1]
|
||||
let file = bufname(bufnr)
|
||||
let buftype = getbufvar(bufnr, '&buftype')
|
||||
|
||||
if buftype == 'help'
|
||||
let file = 'help:' . fnamemodify(file, ':t:r')
|
||||
if buftype == 'help'
|
||||
let file = 'help:' . fnamemodify(file, ':t:r')
|
||||
|
||||
elseif buftype == 'quickfix'
|
||||
let file = 'quickfix'
|
||||
|
||||
elseif buftype == 'nofile'
|
||||
if file =~ '\/.'
|
||||
let file = substitute(file, '.*\/\ze.', '', '')
|
||||
endif
|
||||
|
||||
else
|
||||
let file = pathshorten(fnamemodify(file, ':p:~:.'))
|
||||
elseif buftype == 'quickfix'
|
||||
let file = 'quickfix'
|
||||
|
||||
elseif buftype == 'nofile'
|
||||
if file =~ '\/.'
|
||||
let file = substitute(file, '.*\/\ze.', '', '')
|
||||
endif
|
||||
|
||||
if file == ''
|
||||
let file = "''"
|
||||
endif
|
||||
else
|
||||
let file = pathshorten(fnamemodify(file, ':p:~:.'))
|
||||
|
||||
let s .= file . ' %#mNoise# '
|
||||
endif
|
||||
|
||||
let i = i + 1
|
||||
if file == ''
|
||||
let file = "''"
|
||||
endif
|
||||
|
||||
let s .= file . ' %#mNoise# '
|
||||
|
||||
let i = i + 1
|
||||
|
||||
endwhile
|
||||
|
||||
|
@ -57,15 +57,15 @@ function! MyTabLine()
|
|||
|
||||
return s
|
||||
|
||||
endfunction
|
||||
endfunction
|
||||
|
||||
highlight def link TabNum Comment
|
||||
highlight def link TabNumSel String
|
||||
highlight def link TabSeparator Comment
|
||||
highlight def link TabLineItem Comment
|
||||
highlight def link TabLineItemSel String
|
||||
highlight def link TabNum Comment
|
||||
highlight def link TabNumSel String
|
||||
highlight def link TabSeparator Comment
|
||||
highlight def link TabLineItem Comment
|
||||
highlight def link TabLineItemSel String
|
||||
|
||||
set showtabline=2
|
||||
set tabline=%!MyTabLine()
|
||||
set showtabline=2
|
||||
set tabline=%!MyTabLine()
|
||||
|
||||
endif " exists("+showtabline")
|
||||
|
|
Loading…
Reference in New Issue