fix: comprehensive bug audit — 14 fixes for performance and usability

Critical bugs:
- Statusline colors never applied on startup (SLDefineColors called after colorscheme)
- noremap 0 ^ broke operator-pending mode (d0, c0, y0 all wrong)
- Two Python LSPs running simultaneously (pyright requires Node.js)
- asyncomplete_auto_completeopt=1 overriding completeopt settings
- ALE/vim-lsp diagnostic overlap (tsserver, gopls duplicated)
- Ctrl-s in insert mode shifted cursor right by one
- Startify buftype= clearing made buffer writable

Performance & usability:
- Switch to vim-solarized8 (proper termguicolors, maintained)
- Add ale_disable_lsp=1 for clean ALE/vim-lsp coexistence
- Remove redundant gofmt from Go fixers (goimports is superset)
- Add isort --profile black for formatter compatibility
- Remove dead godef references (unmaintained since 2020)
- Set lazyredraw globally, tw=0 default
- Remove vestigial coc-settings.json symlink from install.sh
This commit is contained in:
m1ngsama 2026-04-21 23:28:59 +08:00
parent 4fb20177ef
commit 575ff2c489
3 changed files with 22 additions and 40 deletions

48
.vimrc
View file

@ -54,7 +54,7 @@ set splitright
set backspace=indent,eol,start set backspace=indent,eol,start
set autoread set autoread
set cmdheight=1 set cmdheight=1
set hid set hidden
set whichwrap+=<,>,h,l set whichwrap+=<,>,h,l
set magic set magic
set showmatch set showmatch
@ -62,7 +62,6 @@ set mat=2
set noerrorbells set noerrorbells
set novisualbell set novisualbell
set t_vb= set t_vb=
set tm=500
set ttimeout set ttimeout
set ttimeoutlen=10 set ttimeoutlen=10
@ -142,7 +141,7 @@ Plug 'previm/previm'
" ── UI ──────────────────────────────────────────────────────────────────────── " ── UI ────────────────────────────────────────────────────────────────────────
Plug 'mbbill/undotree' Plug 'mbbill/undotree'
Plug 'mhinz/vim-startify' Plug 'mhinz/vim-startify'
Plug 'altercation/vim-colors-solarized' Plug 'lifepillar/vim-solarized8'
if !g:is_tty if !g:is_tty
Plug 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
endif endif
@ -160,7 +159,6 @@ call plug#end()
" ============================================================================ " ============================================================================
if g:has_true_color && has('termguicolors') && !g:is_tty if g:has_true_color && has('termguicolors') && !g:is_tty
" Required for true color inside tmux
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors set termguicolors
@ -168,11 +166,9 @@ endif
set background=dark set background=dark
if &t_Co >= 256 && !g:is_tty if !g:is_tty
try try
" 256-color approximation — works on any terminal, no palette setup needed colorscheme solarized8
let g:solarized_termcolors = 256
colorscheme solarized
catch catch
colorscheme default colorscheme default
endtry endtry
@ -203,7 +199,7 @@ set smarttab
set shiftwidth=4 set shiftwidth=4
set tabstop=4 set tabstop=4
set lbr set lbr
set tw=500 set tw=0
set autoindent set autoindent
set smartindent set smartindent
@ -248,8 +244,8 @@ nnoremap <leader>cd :lcd %:p:h<cr>:pwd<cr>
nnoremap <leader>e :Explore<CR> nnoremap <leader>e :Explore<CR>
nnoremap <leader>E :Vexplore<CR> nnoremap <leader>E :Vexplore<CR>
" Remap 0 to first non-blank (all modes intentional) " Remap 0 to first non-blank
noremap 0 ^ nnoremap 0 ^
" Reselect last paste " Reselect last paste
nnoremap gV `[v`] nnoremap gV `[v`]
@ -300,7 +296,7 @@ vnoremap // y/\V<C-r>=escape(@",'/\')<CR><CR>
" Save from any mode " Save from any mode
nnoremap <silent> <C-s> :w<CR> nnoremap <silent> <C-s> :w<CR>
inoremap <silent> <C-s> <Esc>:w<CR>a inoremap <silent> <C-s> <C-o>:w<CR>
" Scroll keeping cursor centred " Scroll keeping cursor centred
nnoremap <C-d> <C-d>zz nnoremap <C-d> <C-d>zz
@ -419,11 +415,13 @@ let g:gitgutter_sign_modified_removed = '~'
" => ALE (async linting + format-on-save) " => ALE (async linting + format-on-save)
" ============================================================================ " ============================================================================
let g:ale_disable_lsp = 1
let g:ale_linters = { let g:ale_linters = {
\ 'python': ['flake8', 'pylint'], \ 'python': ['flake8', 'pylint'],
\ 'javascript': ['eslint'], \ 'javascript': ['eslint'],
\ 'typescript': ['eslint', 'tsserver'], \ 'typescript': ['eslint'],
\ 'go': ['gopls', 'staticcheck'], \ 'go': ['staticcheck'],
\ 'rust': ['cargo'], \ 'rust': ['cargo'],
\ 'c': ['cc'], \ 'c': ['cc'],
\ 'sh': ['shellcheck'], \ 'sh': ['shellcheck'],
@ -440,7 +438,7 @@ let g:ale_fixers = {
\ 'python': ['black', 'isort'], \ 'python': ['black', 'isort'],
\ 'javascript': ['prettier', 'eslint'], \ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'eslint'], \ 'typescript': ['prettier', 'eslint'],
\ 'go': ['gofmt', 'goimports'], \ 'go': ['goimports'],
\ 'rust': ['rustfmt'], \ 'rust': ['rustfmt'],
\ 'c': ['clang-format'], \ 'c': ['clang-format'],
\ 'json': ['prettier'], \ 'json': ['prettier'],
@ -454,6 +452,7 @@ let g:ale_fixers = {
\} \}
let g:ale_fix_on_save = 1 let g:ale_fix_on_save = 1
let g:ale_python_isort_options = '--profile black'
let g:ale_sign_error = 'X' let g:ale_sign_error = 'X'
let g:ale_sign_warning = '!' let g:ale_sign_warning = '!'
let g:ale_lint_on_text_changed = 'normal' let g:ale_lint_on_text_changed = 'normal'
@ -470,12 +469,10 @@ endif
" => vim-go " => vim-go
" ============================================================================ " ============================================================================
" vim-lsp (gopls) handles all Go intelligence; disable vim-go's own LSP layer " vim-lsp (gopls) handles all Go intelligence; vim-go is for syntax only
let g:go_gopls_enabled = 0 let g:go_gopls_enabled = 0
let g:go_code_completion_enabled = 0 let g:go_code_completion_enabled = 0
let g:go_def_mode = 'godef' let g:go_fmt_autosave = 0
let g:go_info_mode = 'godef'
let g:go_fmt_autosave = 0 " ALE handles format-on-save
let g:go_imports_autosave = 0 let g:go_imports_autosave = 0
let g:go_highlight_types = 1 let g:go_highlight_types = 1
let g:go_highlight_fields = 1 let g:go_highlight_fields = 1
@ -486,7 +483,7 @@ let g:go_highlight_function_calls = 1
" => vim-lsp (primary LSP backend — pure VimScript, no Node.js) " => vim-lsp (primary LSP backend — pure VimScript, no Node.js)
" ============================================================================ " ============================================================================
let g:lsp_settings_filetype_python = ['pylsp', 'pyright-langserver'] let g:lsp_settings_filetype_python = ['pylsp']
let g:lsp_settings_filetype_go = ['gopls'] let g:lsp_settings_filetype_go = ['gopls']
let g:lsp_settings_filetype_rust = ['rust-analyzer'] let g:lsp_settings_filetype_rust = ['rust-analyzer']
let g:lsp_settings_filetype_typescript = ['typescript-language-server'] let g:lsp_settings_filetype_typescript = ['typescript-language-server']
@ -520,7 +517,7 @@ else
endif endif
set pumheight=15 set pumheight=15
let g:asyncomplete_auto_popup = 1 let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 1 let g:asyncomplete_auto_completeopt = 0
let g:asyncomplete_popup_delay = 200 let g:asyncomplete_popup_delay = 200
" Completion popup navigation " Completion popup navigation
@ -691,10 +688,6 @@ if exists('g:plugs["vim-startify"]')
augroup END augroup END
endif endif
augroup ChopstickStartify
autocmd!
autocmd User Startified setlocal buftype=
augroup END
endif endif
" ============================================================================ " ============================================================================
@ -730,6 +723,7 @@ augroup SLColors
autocmd! autocmd!
autocmd ColorScheme * call s:SLDefineColors() autocmd ColorScheme * call s:SLDefineColors()
augroup END augroup END
call s:SLDefineColors()
" Current mode → [label, highlight-group] " Current mode → [label, highlight-group]
function! SLMode() abort function! SLMode() abort
@ -880,14 +874,14 @@ augroup END
set synmaxcol=200 set synmaxcol=200
set ttyfast set ttyfast
set complete-=i " don't scan included files — makes Ctrl+n/p much faster set lazyredraw
set complete-=i
set updatetime=300 set updatetime=300
set shortmess+=c set shortmess+=c
if g:is_tty if g:is_tty
set signcolumn=auto set signcolumn=auto
set synmaxcol=120 set synmaxcol=120
set lazyredraw
else else
if has("patch-8.1.1564") if has("patch-8.1.1564")
set signcolumn=number set signcolumn=number

View file

@ -378,7 +378,7 @@ linting to prevent stalling.
- **vim-easymotion**`s` + 2 chars to jump anywhere - **vim-easymotion**`s` + 2 chars to jump anywhere
### UI ### UI
- **vim-colors-solarized** — color scheme - **vim-solarized8** — color scheme (truecolor support)
- **undotree** — visual undo branch history - **undotree** — visual undo branch history
- **vim-startify** — startup dashboard and session list - **vim-startify** — startup dashboard and session list
- **indentLine** — indent guides (non-TTY) - **indentLine** — indent guides (non-TTY)

View file

@ -380,18 +380,6 @@ else
fi fi
mkdir -p "$HOME/.vim" mkdir -p "$HOME/.vim"
COC_CFG="$HOME/.vim/coc-settings.json"
if [ -f "$COC_CFG" ] && [ ! -L "$COC_CFG" ]; then
TS=$(date +%Y%m%d_%H%M%S)
warn "Backing up existing coc-settings.json → $COC_CFG.backup.$TS"
mv "$COC_CFG" "$COC_CFG.backup.$TS"
fi
ln -sf "$SCRIPT_DIR/coc-settings.json" "$COC_CFG"
if [[ -L "$COC_CFG" ]]; then
ok "$HOME/.vim/coc-settings.json → $SCRIPT_DIR/coc-settings.json"
else
warn "coc-settings.json symlink failed (non-fatal)"
fi
# ============================================================================ # ============================================================================
# 3. vim-plug + Plugins # 3. vim-plug + Plugins