mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-10 19:10:59 +08:00
Compare commits
2 commits
4fd9a09948
...
cddb5fa725
| Author | SHA1 | Date | |
|---|---|---|---|
| cddb5fa725 | |||
| 28e4ed3794 |
4 changed files with 105 additions and 14 deletions
|
|
@ -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 ────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue