Compare commits

...

2 commits

Author SHA1 Message Date
cddb5fa725 feat(ui): native tabline + fixed-width signcolumn
Some checks failed
test / startup (macos-latest) (push) Has been cancelled
test / startup (ubuntu-latest) (push) Has been cancelled
test / shellcheck (push) Has been cancelled
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)
2026-04-27 18:08:40 +08:00
28e4ed3794 fix(ui): drop noisy colorcolumn, polish highlights, warn on missing colorscheme
The full-column ColorColumn was visually overwhelming on every line, especially
with default vim's LightRed (kicked in silently when solarized8 wasn't installed).
Replace it with an OverLength match that only highlights characters past the
buffer's textwidth.

- editing.vim: OverLength matchadd, refreshed on FileType/BufWinEnter/OptionSet
- languages.vim: drop colorcolumn from per-filetype autocmds (textwidth still set)
- ui.vim: VertSplit/CursorLine/CursorLineNr/SignColumn override via ColorScheme
  autocmd; fillchars for vert and eob; timer-based warning if solarized8 missing
2026-04-27 18:08:28 +08:00
4 changed files with 105 additions and 14 deletions

View file

@ -178,13 +178,8 @@ set shortmess+=cI
if g:is_tty if g:is_tty
set signcolumn=auto set signcolumn=auto
set synmaxcol=120 set synmaxcol=120
else
if has("patch-8.1.1564")
set signcolumn=number
else
set signcolumn=yes
endif
endif endif
" non-TTY signcolumn is set in ui.vim (=yes, fixed-width to prevent jitter)
" ── Project-Local Config ──────────────────────────────────────────────────── " ── Project-Local Config ────────────────────────────────────────────────────

View file

@ -44,3 +44,26 @@ augroup ChopstickSearchHL
autocmd! autocmd!
autocmd CursorHold * if get(v:, 'hlsearch', 0) | let v:hlsearch = 0 | endif autocmd CursorHold * if get(v:, 'hlsearch', 0) | let v:hlsearch = 0 | endif
augroup END augroup END
" ── Overlength Highlight (only chars past textwidth, not the whole column) ─
function! s:OverLengthApply() abort
if exists('w:overlength_match')
silent! call matchdelete(w:overlength_match)
unlet w:overlength_match
endif
if &textwidth <= 0 || &buftype !=# '' | return | endif
let w:overlength_match = matchadd('OverLength', '\%>' . &textwidth . 'v.\+', -1)
endfunction
function! s:OverLengthDefineHL() abort
hi default OverLength ctermbg=52 ctermfg=NONE guibg=#3a1f1f guifg=NONE
endfunction
augroup ChopstickOverLength
autocmd!
autocmd ColorScheme * call s:OverLengthDefineHL()
autocmd OptionSet textwidth call s:OverLengthApply()
autocmd BufWinEnter,WinEnter,FileType * call s:OverLengthApply()
augroup END
call s:OverLengthDefineHL()

View file

@ -47,23 +47,23 @@ augroup ChopstickFiletype
\ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif \ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
autocmd FileType python autocmd FileType python
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=88 colorcolumn=+1 \ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=88
autocmd FileType javascript,typescript autocmd FileType javascript,typescript
\ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=100 colorcolumn=+1 \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=100
autocmd FileType go autocmd FileType go
\ setlocal noexpandtab shiftwidth=4 tabstop=4 textwidth=120 colorcolumn=+1 \ setlocal noexpandtab shiftwidth=4 tabstop=4 textwidth=120
autocmd FileType rust autocmd FileType rust
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=100 colorcolumn=+1 \ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=100
autocmd FileType c,cpp autocmd FileType c,cpp
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=80 colorcolumn=+1 \ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=80
autocmd FileType html,css autocmd FileType html,css
\ setlocal expandtab shiftwidth=2 tabstop=2 \ setlocal expandtab shiftwidth=2 tabstop=2
autocmd FileType yaml autocmd FileType yaml
\ setlocal expandtab shiftwidth=2 tabstop=2 \ setlocal expandtab shiftwidth=2 tabstop=2
autocmd FileType markdown autocmd FileType markdown
\ setlocal wrap linebreak spell textwidth=0 colorcolumn=0 conceallevel=2 \ setlocal wrap linebreak spell textwidth=0 conceallevel=2
autocmd FileType sh autocmd FileType sh
\ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=80 colorcolumn=+1 \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=80
autocmd FileType make autocmd FileType make
\ setlocal noexpandtab shiftwidth=8 tabstop=8 \ setlocal noexpandtab shiftwidth=8 tabstop=8
autocmd FileType json autocmd FileType json

View file

@ -10,16 +10,49 @@ endif
set background=dark set background=dark
function! s:WarnSolarized8Missing(...) abort
echohl WarningMsg
echom 'chopsticks: solarized8 not installed — run :PlugInstall'
echohl None
endfunction
if !g:is_tty if !g:is_tty
try try
colorscheme solarized8 colorscheme solarized8
catch catch /^Vim\%((\a\+)\)\=:E185/
colorscheme default colorscheme default
if has('timers')
call timer_start(500, function('s:WarnSolarized8Missing'))
else
augroup ChopstickColorschemeWarn
autocmd!
autocmd VimEnter * call s:WarnSolarized8Missing()
augroup END
endif
endtry endtry
else else
colorscheme default colorscheme default
endif endif
" ── Window separators, fillchars, cursorline visibility ────────────────────
if !g:is_tty
set fillchars+=vert:│,eob:\
endif
function! s:UIPolish() abort
hi VertSplit ctermbg=234 ctermfg=240 guibg=#002b36 guifg=#586e75 cterm=NONE gui=NONE
hi CursorLine ctermbg=235 guibg=#0c4452 cterm=NONE gui=NONE
hi CursorLineNr ctermbg=235 ctermfg=136 guibg=#0c4452 guifg=#b58900 cterm=bold gui=bold
hi SignColumn ctermbg=234 guibg=#002b36
endfunction
augroup ChopstickUIPolish
autocmd!
autocmd ColorScheme * call s:UIPolish()
augroup END
if !g:is_tty | call s:UIPolish() | endif
if has("gui_running") if has("gui_running")
if has("gui_gtk2") || has("gui_gtk3") if has("gui_gtk2") || has("gui_gtk3")
set guifont=Hack\ 12,Source\ Code\ Pro\ 12,Monospace\ 12 set guifont=Hack\ 12,Source\ Code\ Pro\ 12,Monospace\ 12
@ -151,3 +184,43 @@ set statusline=%!SLBuild()
if g:is_tty if g:is_tty
set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%) set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)
endif 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