mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 15:59:23 +08:00
parent
d372b5bc46
commit
dc7d991007
|
@ -118,7 +118,15 @@ function! airline#extensions#tabline#tabs#map_keys()
|
|||
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i)
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) abort
|
||||
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
|
||||
try
|
||||
return airline#extensions#formatters#{formatter}#format(a:nr, a:i)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/ " catch E117, unknown function
|
||||
" Function not found
|
||||
return call(formatter, [a:nr, a:i])
|
||||
catch
|
||||
" something went wrong, return an empty string
|
||||
return ""
|
||||
endtry
|
||||
endfunction
|
||||
|
|
|
@ -809,6 +809,13 @@ with the middle mouse button to delete that buffer.
|
|||
|
||||
Note: last option can be used to specify a different formatter for
|
||||
displaying the numbers. By default tabline/formatter/tabnr.vim is used
|
||||
The argument of that setting should either be a filename that exists
|
||||
autoload/airline/extensions/tabline/formatter/ (without .vim extension)
|
||||
and needs to provide a format() function. Alternatively you can use a
|
||||
custom function name, that is defined e.g. in your .vimrc file. In any
|
||||
case, the function needs to take 2 arguments, tab_nr_type and tabpage
|
||||
number.
|
||||
For an example, have a look at the default tabline/formatter/tabnr.vim
|
||||
<
|
||||
* enable/disable displaying tab number in tabs mode. >
|
||||
let g:airline#extensions#tabline#show_tab_nr = 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user