Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
159 lines
5.2 KiB
VimL
159 lines
5.2 KiB
VimL
" MIT License. Copyright (c) 2016-2019 Kevin Sapper et al.
|
|
" Plugin: https://github.com/szw/vim-ctrlspace
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
scriptencoding utf-8
|
|
|
|
let s:current_bufnr = -1
|
|
let s:current_modified = 0
|
|
let s:current_tabnr = -1
|
|
let s:current_tabline = ''
|
|
let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod']
|
|
|
|
function! airline#extensions#tabline#ctrlspace#off()
|
|
augroup airline_tabline_ctrlspace
|
|
autocmd!
|
|
augroup END
|
|
endfunction
|
|
|
|
function! airline#extensions#tabline#ctrlspace#on()
|
|
augroup airline_tabline_ctrlspace
|
|
autocmd!
|
|
autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate()
|
|
augroup END
|
|
endfunction
|
|
|
|
function! airline#extensions#tabline#ctrlspace#invalidate()
|
|
let s:current_bufnr = -1
|
|
let s:current_tabnr = -1
|
|
endfunction
|
|
|
|
function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pull_right)
|
|
let pos_extension = (a:pull_right ? '_right' : '')
|
|
let buffer_list = ctrlspace#api#BufferList(a:cur_tab)
|
|
|
|
" add by tenfy(tenfyzhong@qq.com)
|
|
" if the current buffer no in the buffer list
|
|
" return false and no redraw tabline.
|
|
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
|
|
let bufnr_list = map(copy(buffer_list), 'v:val["index"]')
|
|
if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr
|
|
return 0
|
|
endif
|
|
|
|
let s:current_modified = getbufvar(a:cur_buf, '&modified')
|
|
|
|
for buffer in buffer_list
|
|
let group = 'airline_tab'
|
|
\ .s:highlight_groups[(4 * buffer.modified) + (2 * buffer.visible) + (a:cur_buf == buffer.index)]
|
|
\ .pos_extension
|
|
|
|
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
|
|
|
|
if has("tablineat")
|
|
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
|
|
endif
|
|
|
|
call a:builder.add_section_spaced(group, buf_name)
|
|
endfor
|
|
|
|
" add by tenfy(tenfyzhong@qq.com)
|
|
" if the selected buffer was updated
|
|
" return true
|
|
return 1
|
|
endfunction
|
|
|
|
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pull_right)
|
|
let pos_extension = (a:pull_right ? '_right' : '')
|
|
let tab_list = ctrlspace#api#TabList()
|
|
|
|
for tab in tab_list
|
|
let group = 'airline_tab'
|
|
\ .s:highlight_groups[(4 * tab.modified) + (3 * tab.current)]
|
|
\ .pos_extension
|
|
|
|
if get(g:, 'airline#extensions#tabline#ctrlspace_show_tab_nr', 0) == 0
|
|
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
|
|
else
|
|
call a:builder.add_section_spaced(group, '%'.(tab.index).'T'.(tab.index).(g:airline_symbols.space).(tab.title).ctrlspace#api#TabBuffersNumber(tab.index).'%T')
|
|
endif
|
|
endfor
|
|
endfunction
|
|
|
|
function! airline#extensions#tabline#ctrlspace#get()
|
|
let cur_buf = bufnr('%')
|
|
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
|
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
|
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
|
|
|
|
try
|
|
call airline#extensions#tabline#tabs#map_keys()
|
|
endtry
|
|
|
|
let cur_tab = tabpagenr()
|
|
|
|
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr
|
|
if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified
|
|
return s:current_tabline
|
|
endif
|
|
endif
|
|
|
|
let builder = airline#extensions#tabline#new_builder()
|
|
|
|
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
|
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
|
|
|
let AppendBuffers = function('airline#extensions#tabline#ctrlspace#add_buffer_section', [builder, cur_tab, cur_buf])
|
|
let AppendTabs = function('airline#extensions#tabline#ctrlspace#add_tab_section', [builder])
|
|
let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder)
|
|
|
|
" <= 1: |{Tabs} <tab|
|
|
" == 2: |{Buffers} <buffers|
|
|
" == 3: |buffers> {Buffers} {Tabs} <tabs|
|
|
let showing_mode = (2 * show_buffers) + (show_tabs)
|
|
let ignore_update = 0
|
|
|
|
" Add left tabline content
|
|
if showing_mode <= 1 " Tabs only mode
|
|
call AppendTabs(0)
|
|
elseif showing_mode == 2 " Buffers only mode
|
|
let ignore_update = !AppendBuffers(0)
|
|
else
|
|
if !switch_buffers_and_tabs
|
|
call AppendLabel(buffer_label)
|
|
let ignore_update = !AppendBuffers(0)
|
|
else
|
|
call AppendLabel(tab_label)
|
|
call AppendTabs(0)
|
|
endif
|
|
endif
|
|
|
|
if ignore_update | return s:current_tabline | endif
|
|
|
|
call builder.add_section('airline_tabfill', '')
|
|
call builder.split()
|
|
call builder.add_section('airline_tabfill', '')
|
|
|
|
" Add right tabline content
|
|
if showing_mode <= 1 " Tabs only mode
|
|
call AppendLabel(tab_label)
|
|
elseif showing_mode == 2 " Buffers only mode
|
|
call AppendLabel(buffer_label)
|
|
else
|
|
if !switch_buffers_and_tabs
|
|
call AppendTabs(1)
|
|
call AppendLabel(tab_label)
|
|
else
|
|
let ignore_update = AppendBuffers(1)
|
|
call AppendLabel(buffer_label)
|
|
endif
|
|
endif
|
|
|
|
if ignore_update | return s:current_tabline | endif
|
|
|
|
let s:current_bufnr = cur_buf
|
|
let s:current_tabnr = cur_tab
|
|
let s:current_tabline = builder.build()
|
|
return s:current_tabline
|
|
endfunction
|