perf: 23ms → 19ms — drop vim-unimpaired, runtime tuning

Startup: replace vim-unimpaired (2.5ms) with 2-line blank line insertion.
29 plugins now. All [q/]q, [e/]e, [x/]x mappings were already ours.

Runtime:
- ALE lint_delay=200ms, echo_delay=100ms — less thrashing during edits
- LSP virtual_text_delay=200ms, highlight_delay=200ms, echo_delay=100ms
- Disable gitgutter default mappings (map_keys=0) — we don't use them
- Merge two BufReadPre large-file autocmds into one (single getfsize)
- Remove redundant filetype detection autocmds (Vim 9.2 handles natively)
This commit is contained in:
m1ngsama 2026-04-22 00:46:00 +08:00
parent f0d4431eef
commit dbb11c9473
8 changed files with 32 additions and 36 deletions

View file

@ -14,7 +14,7 @@ curl -fsSL https://raw.githubusercontent.com/m1ngsama/chopsticks/main/get.sh | b
You SSH into a box. You need to edit code. You want LSP, fuzzy find, git integration, format-on-save — not a 20-minute setup ritual.
chopsticks gives you 30 plugins, 12 modules, and a sane config in one command. It degrades gracefully on TTY. It works the same on your MacBook and your Arch server.
chopsticks gives you 29 plugins, 12 modules, and a sane config in one command. It degrades gracefully on TTY. It works the same on your MacBook and your Arch server.
## What's in the box
@ -86,7 +86,7 @@ ALE and vim-lsp coexist cleanly (`ale_disable_lsp=1`). ALE handles linting + for
├── .vimrc thin loader
├── modules/
│ ├── env.vim TTY detection, truecolor
│ ├── plugins.vim vim-plug + 30 plugins
│ ├── plugins.vim vim-plug + 29 plugins
│ ├── core.vim settings, keymaps, performance
│ ├── ui.vim colorscheme, statusline, startify
│ ├── editing.vim easymotion, yank highlight

View file

@ -33,6 +33,11 @@ if exists('##TextYankPost') && has('timers')
augroup END
endif
" ── Blank Line Insertion (replaces vim-unimpaired) ──────────────────────────
nnoremap <silent> [<Space> :<C-u>put! =repeat(nr2char(10), v:count1)<CR>'[
nnoremap <silent> ]<Space> :<C-u>put =repeat(nr2char(10), v:count1)<CR>
" ── Auto-Clear Search Highlight ─────────────────────────────────────────────
augroup ChopstickSearchHL

View file

@ -2,6 +2,7 @@
" ── GitGutter ───────────────────────────────────────────────────────────────
let g:gitgutter_map_keys = 0
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '~'
let g:gitgutter_sign_removed = '-'

View file

@ -19,12 +19,6 @@ augroup ChopstickFiletype
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
autocmd BufNewFile,BufRead *.json setlocal filetype=json
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
autocmd BufNewFile,BufRead *.jsx setlocal filetype=javascript.jsx
autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescript.tsx
autocmd BufNewFile,BufRead Dockerfile* setlocal filetype=dockerfile
autocmd FileType python
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=88 colorcolumn=+1
autocmd FileType javascript,typescript

View file

@ -43,6 +43,8 @@ let g:ale_sign_warning = '!'
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_enter = 1
let g:ale_lint_delay = 200
let g:ale_echo_delay = 100
if exists('g:plugs["ale"]')
nnoremap <silent> [e :ALEPrevious<cr>

View file

@ -18,10 +18,13 @@ let g:lsp_settings_filetype_markdown = ['marksman']
let g:lsp_settings_filetype_sql = ['sqls']
let g:lsp_diagnostics_virtual_text_enabled = !g:is_tty
let g:lsp_diagnostics_virtual_text_delay = 200
let g:lsp_diagnostics_highlights_enabled = !g:is_tty
let g:lsp_document_highlight_enabled = !g:is_tty
let g:lsp_document_highlight_delay = 200
let g:lsp_signs_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_diagnostics_echo_delay = 100
let g:lsp_completion_documentation_enabled = 1
let g:lsp_signs_error = {'text': 'X'}

View file

@ -24,7 +24,10 @@ Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
" tpope/vim-unimpaired removed: 2.5ms startup cost, we define our own
" [q/]q (quickfix), [e/]e (ALE), [x/]x (conflict) — unimpaired's [b/]b
" is covered by ,h/,l. Blank line insertion ([<Space>) added below.
Plug 'tpope/vim-sleuth'
Plug 'wellle/targets.vim'
Plug 'jiangmiao/auto-pairs'

View file

@ -86,43 +86,31 @@ augroup BWCCreateDir
\ endif
augroup END
" ── Large File Handling (>10 MB) ────────────────────────────────────────────
" ── Large File Handling ──────────────────────────────────────────────────────
let g:LargeFile = 1024 * 1024 * 10
augroup LargeFile
let s:tty_large = g:is_tty ? 512000 : g:LargeFile
augroup ChopstickLargeFile
autocmd!
autocmd BufReadPre *
\ if !empty(expand('<afile>')) |
\ let f = getfsize(expand('<afile>')) |
\ if f > g:LargeFile || f == -2 | call LargeFileSettings() | endif |
\ let s:fsize = getfsize(expand('<afile>')) |
\ if s:fsize > g:LargeFile || s:fsize == -2 |
\ setlocal bufhidden=unload undolevels=-1 noswapfile syntax= |
\ let b:ale_enabled = 0 |
\ elseif g:is_tty && s:fsize > s:tty_large |
\ setlocal syntax= |
\ endif |
\ endif
augroup END
function! LargeFileSettings()
setlocal bufhidden=unload
setlocal undolevels=-1
setlocal noswapfile
setlocal syntax=
let b:ale_enabled = 0
echo "Large file (>10 MB): syntax, undo, and linting disabled."
endfunction
if g:is_tty
augroup ChopstickTTYLargeFile
if g:is_tty && !exists("g:tty_message_shown")
augroup TTYMessage
autocmd!
autocmd BufReadPre *
\ if !empty(expand('<afile>')) && getfsize(expand('<afile>')) > 512000 |
\ setlocal syntax= |
\ endif
autocmd VimEnter * echom "TTY mode — visual features disabled"
augroup END
if !exists("g:tty_message_shown")
augroup TTYMessage
autocmd!
autocmd VimEnter * echom "TTY mode — visual features disabled"
augroup END
let g:tty_message_shown = 1
endif
let g:tty_message_shown = 1
endif
" ── Run Current File (,cr) ──────────────────────────────────────────────────