mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 01:10:05 +08:00
Add support for mouse click on tabline (#3695)
This commit is contained in:
parent
0c5ca6ba66
commit
eb75112aec
@ -174,6 +174,7 @@ function! SpaceVim#layers#core#tabline#get() abort
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
let s:shown_items = shown_items
|
||||||
let t = ''
|
let t = ''
|
||||||
if current_tabnr == shown_items[0].tabnr
|
if current_tabnr == shown_items[0].tabnr
|
||||||
if getbufvar(shown_items[0].bufnr, '&modified', 0)
|
if getbufvar(shown_items[0].bufnr, '&modified', 0)
|
||||||
@ -184,7 +185,13 @@ function! SpaceVim#layers#core#tabline#get() abort
|
|||||||
else
|
else
|
||||||
let t = '%#SpaceVim_tabline_b# '
|
let t = '%#SpaceVim_tabline_b# '
|
||||||
endif
|
endif
|
||||||
|
let index = 1
|
||||||
for item in shown_items
|
for item in shown_items
|
||||||
|
if has('tablineat')
|
||||||
|
let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@'
|
||||||
|
endif
|
||||||
|
let t .= s:wrap_id(index)
|
||||||
|
let index += 1
|
||||||
let t .= item.bufname
|
let t .= item.bufname
|
||||||
if item.tabnr == current_tabnr - 1
|
if item.tabnr == current_tabnr - 1
|
||||||
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . '%#SpaceVim_tabline_a# '
|
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . '%#SpaceVim_tabline_a# '
|
||||||
@ -385,11 +392,10 @@ endfunction
|
|||||||
function! SpaceVim#layers#core#tabline#jump(id, ...) abort
|
function! SpaceVim#layers#core#tabline#jump(id, ...) abort
|
||||||
if len(s:shown_items) >= a:id
|
if len(s:shown_items) >= a:id
|
||||||
let item = s:shown_items[a:id - 1]
|
let item = s:shown_items[a:id - 1]
|
||||||
let mouse = get(a:000, 2, '')
|
let mouse = get(a:000, 1, '')
|
||||||
if tabpagenr('$') > 1
|
if tabpagenr('$') > 1
|
||||||
if mouse ==# 'm'
|
if mouse ==# 'm'
|
||||||
exe 'tabnext' . item.tabnr
|
exe 'tabclose ' . item.tabnr
|
||||||
quit
|
|
||||||
elseif mouse ==# 'l'
|
elseif mouse ==# 'l'
|
||||||
exe 'tabnext' . item.tabnr
|
exe 'tabnext' . item.tabnr
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user