mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-10 19:10:59 +08:00
perf: remove ttyfast, add grepprg/diffopt, DRY FZF commands, conditional tmux-navigator
- Remove deprecated `set ttyfast` (no-op since Vim 8) - Add grepprg=rg for :grep → quickfix integration - Add diffopt with histogram algorithm - Consolidate Rg/RgWord/GFiles (24 lines → 10, lazy preview) - Load vim-tmux-navigator only inside tmux, Ctrl+hjkl fallback outside
This commit is contained in:
parent
f6631dfdf1
commit
a42c980d3e
4 changed files with 38 additions and 25 deletions
|
|
@ -13,6 +13,12 @@
|
|||
|
||||
### Changed
|
||||
- Skip 2 more built-in plugins: openPlugin, manpager (10 → 12 total)
|
||||
- Remove deprecated `set ttyfast` (no-op since Vim 8)
|
||||
- Add `grepprg=rg --vimgrep` — `:grep` now uses ripgrep + quickfix
|
||||
- Add `diffopt` with histogram algorithm and indent-heuristic
|
||||
- Consolidate FZF Rg/RgWord/GFiles commands (DRY refactor)
|
||||
- vim-tmux-navigator: conditional load (only inside tmux), fallback `Ctrl+hjkl` mappings outside
|
||||
- Add `Ctrl+hjkl` window navigation fallback when tmux-navigator not loaded
|
||||
|
||||
## 2.1.0 — 2025-04-22
|
||||
|
||||
|
|
|
|||
|
|
@ -160,9 +160,13 @@ augroup END
|
|||
" ── Performance ─────────────────────────────────────────────────────────────
|
||||
|
||||
set synmaxcol=200
|
||||
set ttyfast
|
||||
set lazyredraw
|
||||
set complete-=i
|
||||
|
||||
if executable('rg')
|
||||
set grepprg=rg\ --vimgrep\ --smart-case
|
||||
set grepformat=%f:%l:%c:%m
|
||||
endif
|
||||
set updatetime=300
|
||||
set shortmess+=cI
|
||||
|
||||
|
|
@ -183,6 +187,10 @@ set exrc
|
|||
set secure
|
||||
set sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal
|
||||
|
||||
if has("patch-8.1.0360")
|
||||
set diffopt=filler,internal,context:3,algorithm:histogram,indent-heuristic
|
||||
endif
|
||||
|
||||
" ── Format Options ──────────────────────────────────────────────────────────
|
||||
|
||||
augroup ChopstickFormatOptions
|
||||
|
|
|
|||
|
|
@ -72,30 +72,27 @@ else
|
|||
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
||||
endif
|
||||
|
||||
if g:is_tty
|
||||
command! -bang -nargs=* Rg
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '
|
||||
\ .shellescape(<q-args>), 1, <bang>0)
|
||||
command! -bang GFiles call fzf#vim#gitfiles('', <bang>0)
|
||||
else
|
||||
command! -bang -nargs=* Rg
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '
|
||||
\ .shellescape(<q-args>), 1, fzf#vim#with_preview(), <bang>0)
|
||||
command! -bang GFiles call fzf#vim#gitfiles('', fzf#vim#with_preview(), <bang>0)
|
||||
endif
|
||||
function! s:Preview() abort
|
||||
return g:is_tty ? {} : fzf#vim#with_preview()
|
||||
endfunction
|
||||
|
||||
if g:is_tty
|
||||
command! -bang -nargs=* RgWord
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -F -- '
|
||||
\ .shellescape(expand('<cword>')), 1, <bang>0)
|
||||
else
|
||||
command! -bang -nargs=* RgWord
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -F -- '
|
||||
\ .shellescape(expand('<cword>')), 1, fzf#vim#with_preview(), <bang>0)
|
||||
command! -bang -nargs=* Rg
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '
|
||||
\ .shellescape(<q-args>), 1, s:Preview(), <bang>0)
|
||||
command! -bang -nargs=* RgWord
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --no-heading --color=always --smart-case -F -- '
|
||||
\ .shellescape(expand('<cword>')), 1, s:Preview(), <bang>0)
|
||||
command! -bang GFiles call fzf#vim#gitfiles('', s:Preview(), <bang>0)
|
||||
|
||||
" ── Window Navigation ───────────────────────────────────────────────────────
|
||||
|
||||
if empty($TMUX)
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-j> <C-w>j
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-l> <C-w>l
|
||||
endif
|
||||
|
||||
" ── Window Maximize Toggle ──────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ Plug 'fatih/vim-go', { 'for': 'go' }
|
|||
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
|
||||
Plug 'mhinz/vim-startify'
|
||||
Plug 'lifepillar/vim-solarized8'
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
if !empty($TMUX)
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
endif
|
||||
|
||||
call plug#end()
|
||||
|
|
|
|||
Loading…
Reference in a new issue