1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00
SpaceVim/autoload/airline/extensions/tabline/formatters/spacevim.vim

33 lines
1.1 KiB
VimL
Raw Normal View History

2017-03-19 20:20:33 +08:00
"=============================================================================
" spacevim.vim --- buffer name formatter for airline
2023-03-26 13:44:47 +08:00
" Copyright (c) 2016-2023 Wang Shidong & Contributors
2022-03-27 13:38:54 +08:00
" Author: Wang Shidong < wsdjeg@outlook.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)
if g:spacevim_enable_tabline_ft_icon || get(g:, 'spacevim_enable_tabline_filetype_icon', 0)
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: