diff --git a/modules/editing.vim b/modules/editing.vim index cf905c4..8f91559 100644 --- a/modules/editing.vim +++ b/modules/editing.vim @@ -44,3 +44,26 @@ augroup ChopstickSearchHL autocmd! autocmd CursorHold * if get(v:, 'hlsearch', 0) | let v:hlsearch = 0 | endif 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() diff --git a/modules/languages.vim b/modules/languages.vim index 6d9aa17..055c55d 100644 --- a/modules/languages.vim +++ b/modules/languages.vim @@ -47,23 +47,23 @@ augroup ChopstickFiletype \ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 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 - \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=100 colorcolumn=+1 + \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=100 autocmd FileType go - \ setlocal noexpandtab shiftwidth=4 tabstop=4 textwidth=120 colorcolumn=+1 + \ setlocal noexpandtab shiftwidth=4 tabstop=4 textwidth=120 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 - \ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=80 colorcolumn=+1 + \ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=80 autocmd FileType html,css \ setlocal expandtab shiftwidth=2 tabstop=2 autocmd FileType yaml \ setlocal expandtab shiftwidth=2 tabstop=2 autocmd FileType markdown - \ setlocal wrap linebreak spell textwidth=0 colorcolumn=0 conceallevel=2 + \ setlocal wrap linebreak spell textwidth=0 conceallevel=2 autocmd FileType sh - \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=80 colorcolumn=+1 + \ setlocal expandtab shiftwidth=2 tabstop=2 textwidth=80 autocmd FileType make \ setlocal noexpandtab shiftwidth=8 tabstop=8 autocmd FileType json diff --git a/modules/ui.vim b/modules/ui.vim index 4c3543c..d8584fe 100644 --- a/modules/ui.vim +++ b/modules/ui.vim @@ -10,16 +10,49 @@ endif set background=dark +function! s:WarnSolarized8Missing(...) abort + echohl WarningMsg + echom 'chopsticks: solarized8 not installed — run :PlugInstall' + echohl None +endfunction + if !g:is_tty try colorscheme solarized8 - catch + catch /^Vim\%((\a\+)\)\=:E185/ 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 else colorscheme default 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_gtk2") || has("gui_gtk3") set guifont=Hack\ 12,Source\ Code\ Pro\ 12,Monospace\ 12