From fc66298acd36e3feba1de8cf5009ca22d0513a2d Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 26 Feb 2017 00:11:08 +0800 Subject: [PATCH] Add messletters api --- autoload/SpaceVim/api/messletters.vim | 21 +++++++++++++++++++ .../tabline/formatters/spacevim.vim | 4 ++++ config/plugins/gruvbox.vim | 2 +- config/plugins/vim-airline.vim | 10 +++++++-- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 autoload/SpaceVim/api/messletters.vim create mode 100644 autoload/airline/extensions/tabline/formatters/spacevim.vim diff --git a/autoload/SpaceVim/api/messletters.vim b/autoload/SpaceVim/api/messletters.vim new file mode 100644 index 000000000..6a4547d28 --- /dev/null +++ b/autoload/SpaceVim/api/messletters.vim @@ -0,0 +1,21 @@ +scriptencoding utf-8 +let s:chars = {} +" type : +" 0: 1 ➛ ➊ +" 1: 1 ➛ ➀ +" 2: 1 ➛ ⓵ +function! s:bubble_num(num, type) abort + let list = [] + call add(list,['➊', '➋', '➌', '➍', '➎', '➏', '➐', '➑', '➒', '➓']) + call add(list,['➀', '➁', '➂', '➃', '➄', '➅', '➆', '➇', '➈', '➉']) + call add(list,['⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾']) + return list[a:type][a:num-1] +endfunction + +let s:chars['bubble_num'] = function('s:bubble_num') + + +function! SpaceVim#api#messletters#get() abort + return deepcopy(s:chars) +endfunction + diff --git a/autoload/airline/extensions/tabline/formatters/spacevim.vim b/autoload/airline/extensions/tabline/formatters/spacevim.vim new file mode 100644 index 000000000..fa1c88b8b --- /dev/null +++ b/autoload/airline/extensions/tabline/formatters/spacevim.vim @@ -0,0 +1,4 @@ +function! airline#extensions#tabline#formatters#spacevim#format(bufnr, buffers) + let id = SpaceVim#api#messletters#get().bubble_num(a:bufnr, 0) + return fnamemodify(bufname(a:bufnr), id . ':t') +endfunction diff --git a/config/plugins/gruvbox.vim b/config/plugins/gruvbox.vim index cdd874cdf..90bf52df2 100644 --- a/config/plugins/gruvbox.vim +++ b/config/plugins/gruvbox.vim @@ -1 +1 @@ -let g:gruvbox_italic = 1 +let g:gruvbox_italic = 0 diff --git a/config/plugins/vim-airline.vim b/config/plugins/vim-airline.vim index f886ef84e..e5ff53bec 100644 --- a/config/plugins/vim-airline.vim +++ b/config/plugins/vim-airline.vim @@ -5,8 +5,14 @@ let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tmuxline#enabled = 1 let g:Powerline_sybols = 'unicode' let g:airline#extensions#tabline#buffer_idx_mode = 1 -let g:airline#extensions#tabline#buffer_nr_show = 1 -let g:airline#extensions#tabline#buffer_nr_format = '%s:' +let g:airline#extensions#tabline#buffer_idx_format = {} +for i in range(9) + call extend(g:airline#extensions#tabline#buffer_idx_format, {i : SpaceVim#api#import('messletters').bubble_num(i, 1). ' '}) +endfor +unlet i +let g:airline#extensions#tabline#formatter = 'spacevim' +"let g:airline#extensions#tabline#buffer_nr_show = 1 +"let g:airline#extensions#tabline#buffer_nr_format = '%s:' let g:airline#extensions#tabline#fnamemod = ':t' let g:airline#extensions#tabline#fnamecollapse = 1 let g:airline#extensions#tabline#fnametruncate = 0