mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-10 19:10:59 +08:00
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:
parent
f0d4431eef
commit
dbb11c9473
8 changed files with 32 additions and 36 deletions
|
|
@ -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.
|
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
|
## 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
|
├── .vimrc thin loader
|
||||||
├── modules/
|
├── modules/
|
||||||
│ ├── env.vim TTY detection, truecolor
|
│ ├── env.vim TTY detection, truecolor
|
||||||
│ ├── plugins.vim vim-plug + 30 plugins
|
│ ├── plugins.vim vim-plug + 29 plugins
|
||||||
│ ├── core.vim settings, keymaps, performance
|
│ ├── core.vim settings, keymaps, performance
|
||||||
│ ├── ui.vim colorscheme, statusline, startify
|
│ ├── ui.vim colorscheme, statusline, startify
|
||||||
│ ├── editing.vim easymotion, yank highlight
|
│ ├── editing.vim easymotion, yank highlight
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ if exists('##TextYankPost') && has('timers')
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
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 ─────────────────────────────────────────────
|
" ── Auto-Clear Search Highlight ─────────────────────────────────────────────
|
||||||
|
|
||||||
augroup ChopstickSearchHL
|
augroup ChopstickSearchHL
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
" ── GitGutter ───────────────────────────────────────────────────────────────
|
" ── GitGutter ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
let g:gitgutter_map_keys = 0
|
||||||
let g:gitgutter_sign_added = '+'
|
let g:gitgutter_sign_added = '+'
|
||||||
let g:gitgutter_sign_modified = '~'
|
let g:gitgutter_sign_modified = '~'
|
||||||
let g:gitgutter_sign_removed = '-'
|
let g:gitgutter_sign_removed = '-'
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,6 @@ augroup ChopstickFiletype
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost *
|
||||||
\ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
\ 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
|
autocmd FileType python
|
||||||
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=88 colorcolumn=+1
|
\ setlocal expandtab shiftwidth=4 tabstop=4 textwidth=88 colorcolumn=+1
|
||||||
autocmd FileType javascript,typescript
|
autocmd FileType javascript,typescript
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ let g:ale_sign_warning = '!'
|
||||||
let g:ale_lint_on_text_changed = 'normal'
|
let g:ale_lint_on_text_changed = 'normal'
|
||||||
let g:ale_lint_on_insert_leave = 1
|
let g:ale_lint_on_insert_leave = 1
|
||||||
let g:ale_lint_on_enter = 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"]')
|
if exists('g:plugs["ale"]')
|
||||||
nnoremap <silent> [e :ALEPrevious<cr>
|
nnoremap <silent> [e :ALEPrevious<cr>
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,13 @@ let g:lsp_settings_filetype_markdown = ['marksman']
|
||||||
let g:lsp_settings_filetype_sql = ['sqls']
|
let g:lsp_settings_filetype_sql = ['sqls']
|
||||||
|
|
||||||
let g:lsp_diagnostics_virtual_text_enabled = !g:is_tty
|
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_diagnostics_highlights_enabled = !g:is_tty
|
||||||
let g:lsp_document_highlight_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_signs_enabled = 1
|
||||||
let g:lsp_diagnostics_echo_cursor = 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_completion_documentation_enabled = 1
|
||||||
|
|
||||||
let g:lsp_signs_error = {'text': 'X'}
|
let g:lsp_signs_error = {'text': 'X'}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ Plug 'airblade/vim-gitgutter'
|
||||||
Plug 'tpope/vim-surround'
|
Plug 'tpope/vim-surround'
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
Plug 'tpope/vim-repeat'
|
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 'tpope/vim-sleuth'
|
||||||
Plug 'wellle/targets.vim'
|
Plug 'wellle/targets.vim'
|
||||||
Plug 'jiangmiao/auto-pairs'
|
Plug 'jiangmiao/auto-pairs'
|
||||||
|
|
|
||||||
|
|
@ -86,43 +86,31 @@ augroup BWCCreateDir
|
||||||
\ endif
|
\ endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" ── Large File Handling (>10 MB) ────────────────────────────────────────────
|
" ── Large File Handling ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
let g:LargeFile = 1024 * 1024 * 10
|
let g:LargeFile = 1024 * 1024 * 10
|
||||||
augroup LargeFile
|
let s:tty_large = g:is_tty ? 512000 : g:LargeFile
|
||||||
|
|
||||||
|
augroup ChopstickLargeFile
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufReadPre *
|
autocmd BufReadPre *
|
||||||
\ if !empty(expand('<afile>')) |
|
\ if !empty(expand('<afile>')) |
|
||||||
\ let f = getfsize(expand('<afile>')) |
|
\ let s:fsize = getfsize(expand('<afile>')) |
|
||||||
\ if f > g:LargeFile || f == -2 | call LargeFileSettings() | endif |
|
\ 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
|
\ endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
function! LargeFileSettings()
|
if g:is_tty && !exists("g:tty_message_shown")
|
||||||
setlocal bufhidden=unload
|
augroup TTYMessage
|
||||||
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
|
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufReadPre *
|
autocmd VimEnter * echom "TTY mode — visual features disabled"
|
||||||
\ if !empty(expand('<afile>')) && getfsize(expand('<afile>')) > 512000 |
|
|
||||||
\ setlocal syntax= |
|
|
||||||
\ endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
let g:tty_message_shown = 1
|
||||||
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
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ── Run Current File (,cr) ──────────────────────────────────────────────────
|
" ── Run Current File (,cr) ──────────────────────────────────────────────────
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue