2017-03-19 20:20:33 +08:00
|
|
|
"=============================================================================
|
|
|
|
" spacevim.vim --- buffer name formatter for airline
|
2021-09-19 22:23:23 +08:00
|
|
|
" Copyright (c) 2016-2021 Wang Shidong & Contributors
|
2018-02-19 22:07:04 +08:00
|
|
|
" Author: Wang Shidong < wsdjeg at 163.com >
|
2017-03-19 20:20:33 +08:00
|
|
|
" URL: https://spacevim.org
|
2018-02-15 22:25:03 +08:00
|
|
|
" License: GPLv3
|
2017-03-19 20:20:33 +08:00
|
|
|
"=============================================================================
|
|
|
|
|
2017-02-26 20:38:49 +08:00
|
|
|
" @vimlint(EVL103, 1, a:buffers)
|
2017-02-26 10:14:28 +08:00
|
|
|
function! airline#extensions#tabline#formatters#spacevim#format(bufnr, buffers) abort
|
2017-03-10 20:36:26 +08:00
|
|
|
let g:_spacevim_list_buffers = a:buffers
|
2017-03-09 21:24:22 +08:00
|
|
|
" unique_tail_improved
|
2017-03-06 23:26:26 +08:00
|
|
|
let id = SpaceVim#api#messletters#get().bubble_num(a:bufnr, g:spacevim_buffer_index_type) . ' '
|
2017-03-09 21:24:22 +08:00
|
|
|
let fn = airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)
|
2019-06-02 11:59:43 +08:00
|
|
|
if g:spacevim_enable_tabline_ft_icon || get(g:, 'spacevim_enable_tabline_filetype_icon', 0)
|
2017-03-11 20:58:58 +08:00
|
|
|
let icon = SpaceVim#api#import('file').fticon(bufname(a:bufnr))
|
2017-03-06 23:26:26 +08:00
|
|
|
if !empty(icon)
|
|
|
|
let fn = icon . ' ' . fn
|
2017-02-26 10:14:28 +08:00
|
|
|
endif
|
2017-03-06 23:26:26 +08:00
|
|
|
endif
|
|
|
|
if empty(fn)
|
|
|
|
return 'No Name'
|
|
|
|
elseif !g:airline#extensions#tabline#buffer_idx_mode
|
|
|
|
return id . fn
|
|
|
|
else
|
|
|
|
return fn
|
|
|
|
endif
|
2017-02-26 00:11:08 +08:00
|
|
|
endfunction
|
2017-02-26 20:38:49 +08:00
|
|
|
" @vimlint(EVL103, 0, a:buffers)
|
2017-03-06 23:26:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
" vim:set et sw=2:
|