Use ternary-operator

This commit is contained in:
Hana Shiro 2018-06-02 13:02:49 +08:00
parent 08570b6dcb
commit 92bf1b0b39

View File

@ -26,16 +26,14 @@ function! airline#extensions#tabline#ctrlspace#invalidate()
endfunction endfunction
function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos) function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos)
if a:pos == 0 let pos_extension = (a:pos == 0)
let pos_extension = '' \ ? ''
else \ : '_right'
let pos_extension = '_right'
endif
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab) let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
" add by tenfy(tenfyzhong@qq.com) " add by tenfy(tenfyzhong@qq.com)
" if the current buffer no in the buffer list " if the current buffer no in the buffer list
" return false and no redraw tabline. " return false and no redraw tabline.
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update. " Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]') let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]')
if index(bufnr_list, a:cur_buf) == -1 if index(bufnr_list, a:cur_buf) == -1
@ -74,11 +72,9 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
endfunction endfunction
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos) function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
if a:pos == 0 let pos_extension = (a:pos == 0)
let pos_extension = '' \ ? ''
else \ : '_right'
let pos_extension = '_right'
endif
for tab in s:tab_list for tab in s:tab_list
if tab.current if tab.current