diff --git a/BETA.md b/BETA.md index 1f4df0a..68c831c 100644 --- a/BETA.md +++ b/BETA.md @@ -65,6 +65,7 @@ s + 2ch jump on screen gd / gr definition / references SPC rr run current file SPC gs git status SPC cf format SPC ca code action SPC fc local config SPC ? active cheat sheet +Ctrl-hjkl windows SPC e sidebar :ChopsticksStatus health :ChopsticksConfig preferences ``` @@ -76,6 +77,7 @@ file, edit Markdown, and use a machine with missing optional tools. - `s` as the default visible jump still feels worth the native override after real editing. - No high-frequency action requires remembering an undocumented key. +- Window/sidebar navigation feels faster than native `` only. - README, QUICKSTART, `:help chopsticks`, `SPC ?`, and `:ChopsticksTutor` teach the same layout. - No private wiki or external note is needed to remember the daily loop. diff --git a/QUICKSTART.md b/QUICKSTART.md index bb0db9a..59c79eb 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -86,7 +86,8 @@ SPC SPC fuzzy find file (git-aware) SPC / ripgrep project SPC , search buffers SPC fr recent files -SPC e file browser +SPC e sidebar at project cwd +SPC E sidebar at current file dir SPC Tab last file ``` @@ -134,7 +135,9 @@ SPC y clipboard yank ## Navigate ``` -h/j/k/l splits +Ctrl-h/j/k/l splits +h/j/k/l native Vim fallback +SPC e, Ctrl-h/l open sidebar, enter/leave it SPC bp / SPC bn prev / next buffer SPC z maximize window SPC tt / SPC th terminal diff --git a/README.md b/README.md index 490b235..63e8f1d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ That assembly work is the pain chopsticks removes: diagnostics live behind unrelated commands unless you design a system. - **Plugin defaults fight muscle memory.** chopsticks gives QWERTY users one canonical Space layout and keeps native Vim/LSP habits where they matter: - `gd`, `gr`, `K`, `hjkl`, `cl`, `cc`. + `gd`, `gr`, `K`, `Ctrl-h/j/k/l`, `hjkl`, `cl`, `cc`. - **Remote editing is fragile.** It is built to degrade on TTY, slow SSH, and headless machines instead of assuming a GUI desktop. - **Custom configs are hard to onboard.** `:ChopsticksHelp`, `SPC ?`, @@ -62,7 +62,7 @@ integration, format-on-save — not a 20-minute setup. chopsticks gives you a production-ready Vim config in one command. Pure VimScript — no Node.js for the core. Degrades gracefully on TTY. Works the same on your MacBook and your headless Arch box. -**23–25 plugins** (tmux-navigator loads only inside tmux; auto-pairs is opt-in), LSP, linting, and a hand-built statusline. No bloat, no decorations, just tools. +**23+ plugins** depending on profile and opt-ins, LSP, linting, and a hand-built statusline. No bloat, no decorations, just tools. ## What's in the box @@ -124,6 +124,7 @@ let g:chopsticks_enable_sudo_save_bang = 1 " optional: :w!! sudo save let g:chopsticks_enable_completion_keymaps = 1 " optional: Tab/Enter completion let g:chopsticks_enable_auto_pairs = 1 " optional: automatic pair insertion let g:chopsticks_enable_terminal_keymaps = 1 " optional: terminal Esc/Ctrl navigation +let g:chopsticks_enable_tmux_navigator = 1 " optional: vim-tmux-navigator integration let g:chopsticks_enable_exrc = 1 " optional: source project-local .vimrc/.exrc from CWD let g:chopsticks_enable_reindent_file = 1 " optional: full-file reindent map ``` @@ -144,7 +145,8 @@ Default layout: `space`, leader `SPC`, localleader `,`. This is the canonical layout for QWERTY keyboards with CapsLock mapped to tap-Esc / hold-Ctrl. Escape and Ctrl stay at the system layer; Vim keeps the -native `` window model and standard LSP motions (`gd`, `gr`, `K`). +native `` window model as a fallback and standard LSP motions (`gd`, +`gr`, `K`). Git push/pull are intentionally not bound to default hotkeys. Normal-mode `s` is a screen-local EasyMotion jump; use `cl` for native `s` substitute and `cc` for native `S`. @@ -162,6 +164,7 @@ appends a timestamped session block. SPC SPC fuzzy find file gd go to definition SPC / ripgrep project K hover docs SPC e toggle file sidebar SPC rr run current file +Ctrl-h/l enter/leave sidebar Ctrl-hjkl windows SPC gs git status SPC cf format SPC w save SPC qq quit Esc exit insert mode SPC ? cheat sheet @@ -197,7 +200,7 @@ Esc exit insert mode SPC ? cheat sheet ### Windows -`hjkl` navigate | `SPC z` maximize | `SPC bp` `SPC bn` buffers | `SPC bd` close buffer | `SPC bo` close other buffers | `SPC tt` `SPC th` terminal | `]q` `[q` quickfix | `SPC xq` `SPC xQ` open/close quickfix | `SPC xl` `SPC xL` open/close loclist +`Ctrl-h/j/k/l` windows | `h/j/k/l` native fallback | `SPC z` maximize | `SPC bp` `SPC bn` buffers | `SPC bd` close buffer | `SPC bo` close other buffers | `SPC tt` `SPC th` terminal | `]q` `[q` quickfix | `SPC xq` `SPC xQ` open/close quickfix | `SPC xl` `SPC xL` open/close loclist ### Markdown @@ -234,7 +237,7 @@ Esc exit insert mode SPC ? cheat sheet ### Classic Windows -`hjkl` navigate | `,z` maximize | `,h` `,l` buffers | `,bd` close buffer | `,=` `,-` resize | `,tv` `,th` terminal +`Ctrl-h/j/k/l` windows | `h/j/k/l` native fallback | `,z` maximize | `,h` `,l` buffers | `,bd` close buffer | `,=` `,-` resize | `,tv` `,th` terminal ### Classic Markdown @@ -297,7 +300,7 @@ For Markdown LSP, install or select `marksman` first. │ └── chopsticks.txt :help chopsticks └── modules/ ├── env.vim TTY detection, truecolor, skip built-in plugins - ├── plugins.vim vim-plug + 23–25 plugins + ├── plugins.vim vim-plug + profile/option-driven plugins ├── core.vim settings, keymaps, performance ├── ui.vim solarized, statusline, startify ├── editing.vim easymotion, yank highlight, blank lines diff --git a/doc/chopsticks.txt b/doc/chopsticks.txt index fbca7ac..6c23342 100644 --- a/doc/chopsticks.txt +++ b/doc/chopsticks.txt @@ -21,7 +21,7 @@ self-documenting keys for people who edit locally and over SSH. It is meant to supplement stock Vim, not replace Vim muscle memory. Native motions and well-known conventions stay where they are useful: gd, gr, K, -hjkl, cl, cc, quickfix, and normal Vim commands. +Ctrl-h/j/k/l, hjkl, cl, cc, quickfix, and normal Vim commands. ============================================================================== FIRST FIVE MINUTES *chopsticks-start* @@ -50,8 +50,8 @@ CANONICAL SPACE LAYOUT *chopsticks-v3-space Default layout: Space leader, comma localleader. This layout assumes a QWERTY keyboard and CapsLock mapped at the system layer -to tap-Esc / hold-Ctrl. Vim keeps hjkl for windows and standard LSP -motions for code. +to tap-Esc / hold-Ctrl. Ctrl-h/j/k/l is the fast path for Vim windows; +hjkl remains the native fallback. Standard LSP motions stay on code. Normal-mode s is a visible EasyMotion jump. This is intentionally different from stock Vim because screen-local jumping is higher value in project editing. @@ -62,6 +62,7 @@ High-frequency keys: SPC SPC files SPC , buffers SPC / grep project SPC Tab alternate file SPC e/E file sidebar SPC rr run file + Ctrl-hjkl windows Ctrl-h/l enter/leave sidebar SPC gs git status SPC gl git log graph SPC ca code action SPC cr rename SPC cf format SPC fc edit local config diff --git a/modules/beta.vim b/modules/beta.vim index d9bb603..3d15dd7 100644 --- a/modules/beta.vim +++ b/modules/beta.vim @@ -43,6 +43,7 @@ function! s:OpenBetaGuide() abort \ ' exit criteria', \ ' s as jump still feels worth the native override', \ ' no high-frequency action needs an undocumented key', + \ ' window/sidebar navigation beats native only', \ ' README, QUICKSTART, SPC ?, and tutor teach the same layout', \ ' no private wiki is needed to remember the daily loop', \ ' quick/vim tests pass locally and over SSH', diff --git a/modules/cheatsheet.vim b/modules/cheatsheet.vim index 39220a7..a9fd659 100644 --- a/modules/cheatsheet.vim +++ b/modules/cheatsheet.vim @@ -126,7 +126,8 @@ function! s:CheatSheet() abort \ ' [x ]x conflict markers', \ '', \ ' ── windows ───────────────', - \ ' hjkl navigate splits', + \ ' Ctrl-hjkl windows', + \ ' hjkl native fallback', \ ' SPC bp/bn prev / next buf', \ ' SPC bd close buffer', \ ' SPC bo close other buffers', @@ -249,7 +250,8 @@ function! s:CheatSheet() abort \ ' [x ]x conflict markers', \ '', \ ' ── windows ───────────────', - \ ' hjkl navigate splits', + \ ' Ctrl-hjkl windows', + \ ' hjkl native fallback', \ ' ,h ,l prev / next buf', \ ' ,bd close buffer', \ ' ,z maximize toggle', diff --git a/modules/env.vim b/modules/env.vim index 7fc42e9..ebd0d4e 100644 --- a/modules/env.vim +++ b/modules/env.vim @@ -34,6 +34,8 @@ let g:chopsticks_enable_auto_pairs = get(g:, \ 'chopsticks_enable_auto_pairs', 0) let g:chopsticks_enable_terminal_keymaps = get(g:, \ 'chopsticks_enable_terminal_keymaps', 0) +let g:chopsticks_enable_tmux_navigator = get(g:, + \ 'chopsticks_enable_tmux_navigator', 0) let g:chopsticks_markdown_lint = get(g:, 'chopsticks_markdown_lint', \ s:profile_full) diff --git a/modules/navigation.vim b/modules/navigation.vim index d133dd4..e4e7831 100644 --- a/modules/navigation.vim +++ b/modules/navigation.vim @@ -28,12 +28,29 @@ function! s:ToggleSidebar(...) abort wincmd p endfunction +function! s:NavigateWindow(direction) abort + execute 'wincmd ' . a:direction +endfunction + +nnoremap :call NavigateWindow('h') +nnoremap :call NavigateWindow('j') +nnoremap :call NavigateWindow('k') +nnoremap :call NavigateWindow('l') + nnoremap e :call ToggleSidebar() nnoremap E :call ToggleSidebar(expand('%:p:h')) +function! s:NetrwKeymaps() abort + setlocal bufhidden=wipe + nnoremap :call NavigateWindow('h') + nnoremap :call NavigateWindow('j') + nnoremap :call NavigateWindow('k') + nnoremap :call NavigateWindow('l') +endfunction + augroup ChopstickNetrw autocmd! - autocmd FileType netrw setlocal bufhidden=wipe + autocmd FileType netrw call s:NetrwKeymaps() augroup END " ── FZF ───────────────────────────────────────────────────────────────────── @@ -138,9 +155,9 @@ if has('terminal') endif if g:chopsticks_enable_terminal_keymaps tnoremap - tnoremap h - tnoremap j - tnoremap k - tnoremap l + tnoremap :call NavigateWindow('h') + tnoremap :call NavigateWindow('j') + tnoremap :call NavigateWindow('k') + tnoremap :call NavigateWindow('l') endif endif diff --git a/modules/plugins.vim b/modules/plugins.vim index 8eabba0..17a2082 100644 --- a/modules/plugins.vim +++ b/modules/plugins.vim @@ -62,7 +62,7 @@ if g:chopsticks_enable_ui_extras Plug 'mhinz/vim-startify' endif Plug 'lifepillar/vim-solarized8' -if !empty($TMUX) +if g:chopsticks_enable_tmux_navigator && !empty($TMUX) Plug 'christoomey/vim-tmux-navigator' endif diff --git a/modules/tutor.vim b/modules/tutor.vim index d427e50..e6862ca 100644 --- a/modules/tutor.vim +++ b/modules/tutor.vim @@ -73,7 +73,9 @@ function! s:ChopsticksTutor() abort \ ' 6. git and windows', \ ' SPC gs/gd/gb status / diff / blame', \ ' SPC gl log graph', - \ ' hjkl split navigation', + \ ' Ctrl-h/j/k/l split navigation', + \ ' hjkl native fallback', + \ ' SPC e, Ctrl-h/l enter/leave sidebar', \ ' SPC z maximize split', \ '', \ ' daily drill', @@ -106,7 +108,8 @@ function! s:ChopsticksTutor() abort \ ' gc comment', \ ' ,u undo tree', \ ' ,gs/,gd/,gb status / diff / blame', - \ ' hjkl split navigation', + \ ' Ctrl-h/j/k/l split navigation', + \ ' hjkl native fallback', \ '', \ ' support', \ ' ,ec edit local config', diff --git a/scripts/test-vim.sh b/scripts/test-vim.sh index 0c854a7..04b1536 100755 --- a/scripts/test-vim.sh +++ b/scripts/test-vim.sh @@ -112,7 +112,8 @@ check_vim() { XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ -c 'let last_change_map = nr2char(96) . "[v" . nr2char(96) . "]"' \ - -c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("", "n") !=# "" || maparg("//", "v") !=# "" || maparg("gV", "n") !=# "" || maparg("jk", "i") !=# "" || maparg("", "n") !=# "" || maparg("", "i") !=# "" || maparg("", "n") !=# "" || maparg("", "n") !=# "" || maparg("", "n") !=# "" || maparg("", "n") !=# "" || maparg("", "n") !=# "" || maparg("", "c") !=# "" || maparg("", "c") !=# "" || maparg("w!!", "c") !=# "" | cquit | endif' \ + -c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("", "n") !=# "" || maparg("//", "v") !=# "" || maparg("gV", "n") !=# "" || maparg("jk", "i") !=# "" || maparg("", "n") !=# "" || maparg("", "i") !=# "" || maparg("", "n") !=# "" || maparg("", "c") !=# "" || maparg("", "c") !=# "" || maparg("w!!", "c") !=# "" | cquit | endif' \ + -c 'if maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" | cquit | endif' \ -c 'if has_key(g:plugs, "auto-pairs") || maparg("", "i") =~# "pumvisible" || maparg("", "i") =~# "pumvisible" || maparg("", "i") =~# "asyncomplete#close_popup" || maparg("", "i") =~# "AutoPairs" | cquit | endif' \ -c 'if maparg("", "t") !=# "" || maparg("", "t") !=# "" || maparg("", "t") !=# "" || maparg("", "t") !=# "" || maparg("", "t") !=# "" | cquit | endif' \ -c 'if maparg("s", "n") !~# "easymotion-overwin-f2" | cquit | endif' \ @@ -125,6 +126,7 @@ check_vim() { -c 'source .vimrc' \ -c 'let last_change_map = nr2char(96) . "[v" . nr2char(96) . "]"' \ -c 'if mapleader !=# "," || maparg("s", "n") !=# "" || maparg(",/", "v") !~# "escape" || maparg(",v", "n") !=# last_change_map || maparg(",ff", "n") !~# "SmartFiles" | cquit | endif' \ + -c 'if maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" | cquit | endif' \ -c 'if maparg(",ec", "n") !~# "ChopsticksConfig" || maparg(",sv", "n") !~# "ChopsticksReload" | cquit | endif' \ -c 'if maparg(",gp", "n") !=# "" || maparg(",gl", "n") !=# "" | cquit | endif' \ -c 'qa!' 2>&1 @@ -153,7 +155,24 @@ check_vim() { XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ -c 'let g:chopsticks_enable_terminal_keymaps = 1' \ -c 'source .vimrc' \ - -c 'if has("terminal") && (maparg("", "t") !~# "" || maparg("", "t") !~# "h" || maparg("", "t") !~# "j" || maparg("", "t") !~# "k" || maparg("", "t") !~# "l") | cquit | endif' \ + -c 'if has("terminal") && (maparg("", "t") !~# "" || maparg("", "t") !~# "NavigateWindow" || maparg("", "t") !~# "NavigateWindow" || maparg("", "t") !~# "NavigateWindow" || maparg("", "t") !~# "NavigateWindow") | cquit | endif' \ + -c 'qa!' 2>&1 + + TMUX=/tmp/chopsticks-test XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ + -c 'if has_key(g:plugs, "vim-tmux-navigator") | cquit | endif' \ + -c 'qa!' 2>&1 + + TMUX=/tmp/chopsticks-test XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ + -c 'let g:chopsticks_enable_tmux_navigator = 1' \ + -c 'source .vimrc' \ + -c 'if !has_key(g:plugs, "vim-tmux-navigator") | cquit | endif' \ + -c 'qa!' 2>&1 + + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ + -c 'setfiletype netrw' \ + -c 'if &filetype !=# "netrw" | cquit | endif' \ + -c 'if !maparg("", "n", 0, 1).buffer | cquit | endif' \ + -c 'if maparg("", "n") !~# "NavigateWindow" || maparg("", "n") !~# "NavigateWindow" | cquit | endif' \ -c 'qa!' 2>&1 XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ @@ -281,7 +300,8 @@ check_vim() { grep -Fq 'gd definition' "$TMP_ROOT/cheat-default.txt" grep -Fq 'K hover docs' "$TMP_ROOT/cheat-default.txt" grep -Fq '[d ]d LSP diagnostics' "$TMP_ROOT/cheat-default.txt" - grep -Fq 'hjkl navigate splits' "$TMP_ROOT/cheat-default.txt" + grep -Fq 'Ctrl-hjkl windows' "$TMP_ROOT/cheat-default.txt" + grep -Fq 'hjkl native fallback' "$TMP_ROOT/cheat-default.txt" grep -Fq 'SPC w save' "$TMP_ROOT/cheat-default.txt" grep -Fq 'SPC fc edit local config' "$TMP_ROOT/cheat-default.txt" grep -Fq 's+2ch easymotion jump' "$TMP_ROOT/cheat-default.txt" @@ -379,6 +399,8 @@ check_vim() { grep -Fq 'SPC fc edit local config' "$TMP_ROOT/tutor-default.txt" grep -Fq ':ChopsticksHelp full help' "$TMP_ROOT/tutor-default.txt" grep -Fq ':ChopsticksConfig local config' "$TMP_ROOT/tutor-default.txt" + grep -Fq 'Ctrl-h/j/k/l split navigation' "$TMP_ROOT/tutor-default.txt" + grep -Fq 'SPC e, Ctrl-h/l enter/leave sidebar' "$TMP_ROOT/tutor-default.txt" grep -Fq 's + 2 chars visible jump' "$TMP_ROOT/tutor-default.txt" grep -Fq 'cl / cc native s / S substitute' "$TMP_ROOT/tutor-default.txt" grep -Fq 'gd / gr / K definition / refs / docs' "$TMP_ROOT/tutor-default.txt" @@ -396,6 +418,7 @@ check_vim() { grep -Fq 'Goal: train one long-term project loop around Vim.' "$TMP_ROOT/tutor-classic.txt" grep -Fq ',? active cheat sheet' "$TMP_ROOT/tutor-classic.txt" grep -Fq ',ec edit local config' "$TMP_ROOT/tutor-classic.txt" + grep -Fq 'Ctrl-h/j/k/l split navigation' "$TMP_ROOT/tutor-classic.txt" grep -Fq ',S + 2 chars EasyMotion jump' "$TMP_ROOT/tutor-classic.txt" XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ @@ -409,6 +432,7 @@ check_vim() { grep -Fq 'Prove this can be a long-term project loop.' "$TMP_ROOT/beta-guide.txt" grep -Fq 'Record real editing friction, not abstract taste.' "$TMP_ROOT/beta-guide.txt" grep -Fq 'no private wiki is needed to remember the daily loop' "$TMP_ROOT/beta-guide.txt" + grep -Fq 'window/sidebar navigation beats native only' "$TMP_ROOT/beta-guide.txt" grep -Fq 'SPC ? active cheat sheet' "$TMP_ROOT/beta-guide.txt" grep -Fq 'BETA.md full beta checklist and rollback' "$TMP_ROOT/beta-guide.txt" grep -Fq ':ChopsticksBetaLog editable local beta notes' "$TMP_ROOT/beta-guide.txt"