mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-10 19:10:59 +08:00
feat(ui): native tabline + fixed-width signcolumn
Show all listed buffers in a tabline (current bufnr highlighted, modified
marker '+'), and reserve a permanent signcolumn so width doesn't jitter when
gitgutter/ALE/LSP signs come and go.
- ui.vim: TLBuild() + TabLine{,Sel,Fill} hl groups via ColorScheme autocmd;
set signcolumn=yes for non-TTY (overrides core.vim's previous logic)
- core.vim: drop non-TTY signcolumn branch (centralized in ui.vim)
This commit is contained in:
parent
28e4ed3794
commit
cddb5fa725
2 changed files with 41 additions and 6 deletions
|
|
@ -178,13 +178,8 @@ set shortmess+=cI
|
|||
if g:is_tty
|
||||
set signcolumn=auto
|
||||
set synmaxcol=120
|
||||
else
|
||||
if has("patch-8.1.1564")
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
endif
|
||||
" non-TTY signcolumn is set in ui.vim (=yes, fixed-width to prevent jitter)
|
||||
|
||||
" ── Project-Local Config ────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -184,3 +184,43 @@ set statusline=%!SLBuild()
|
|||
if g:is_tty
|
||||
set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)
|
||||
endif
|
||||
|
||||
" ── Tabline (native — shows listed buffers when >1, else hidden) ───────────
|
||||
|
||||
function! s:TLDefineColors() abort
|
||||
hi TabLine ctermbg=234 ctermfg=244 cterm=none guibg=#002b36 guifg=#839496 gui=none
|
||||
hi TabLineSel ctermbg=235 ctermfg=136 cterm=bold guibg=#073642 guifg=#b58900 gui=bold
|
||||
hi TabLineFill ctermbg=234 ctermfg=240 cterm=none guibg=#002b36 guifg=#586e75 gui=none
|
||||
endfunction
|
||||
|
||||
augroup TLColors
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:TLDefineColors()
|
||||
augroup END
|
||||
call s:TLDefineColors()
|
||||
|
||||
function! TLBuild() abort
|
||||
let l:s = ''
|
||||
let l:cur = bufnr('%')
|
||||
for l:b in range(1, bufnr('$'))
|
||||
if !buflisted(l:b) || getbufvar(l:b, '&buftype') !=# '' | continue | endif
|
||||
let l:hl = (l:b == l:cur) ? '%#TabLineSel#' : '%#TabLine#'
|
||||
let l:name = bufname(l:b)
|
||||
let l:name = empty(l:name) ? '[No Name]' : fnamemodify(l:name, ':t')
|
||||
let l:mod = getbufvar(l:b, '&modified') ? ' +' : ''
|
||||
let l:s .= l:hl . ' ' . l:b . ' ' . l:name . l:mod . ' '
|
||||
endfor
|
||||
let l:s .= '%#TabLineFill#%='
|
||||
return l:s
|
||||
endfunction
|
||||
|
||||
if !g:is_tty
|
||||
set showtabline=1
|
||||
set tabline=%!TLBuild()
|
||||
endif
|
||||
|
||||
" ── SignColumn: always reserve a column so width never jitters ─────────────
|
||||
|
||||
if !g:is_tty
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue