Add local config commands

This commit is contained in:
m1ngsama 2026-05-23 20:00:00 +08:00
parent 0b1c8d94d7
commit fd29dd160e
12 changed files with 144 additions and 18 deletions

1
.vimrc
View file

@ -9,6 +9,7 @@ let s:xdg_config_home = !empty($XDG_CONFIG_HOME) && $XDG_CONFIG_HOME =~# '^/'
\ : '~/.config' \ : '~/.config'
let s:local_config = expand(get(g:, 'chopsticks_local_config', let s:local_config = expand(get(g:, 'chopsticks_local_config',
\ s:xdg_config_home . '/chopsticks.vim')) \ s:xdg_config_home . '/chopsticks.vim'))
let g:chopsticks_resolved_local_config = s:local_config
if filereadable(s:local_config) if filereadable(s:local_config)
execute 'source ' . fnameescape(s:local_config) execute 'source ' . fnameescape(s:local_config)
endif endif

View file

@ -35,6 +35,9 @@ let g:chopsticks_profile = 'engineer'
let g:chopsticks_keymap_style = 'space' let g:chopsticks_keymap_style = 'space'
``` ```
Inside Vim, `:ChopsticksConfig` opens that file and `:ChopsticksReload`
reloads chopsticks after saving it.
## Daily test loop ## Daily test loop
Use the beta for real editing, not only demos. For each session, record: Use the beta for real editing, not only demos. For each session, record:
@ -57,7 +60,8 @@ SPC SPC find file SPC / grep project
s + 2ch jump on screen gd / gr definition / references s + 2ch jump on screen gd / gr definition / references
SPC rr run current file SPC gs git status SPC rr run current file SPC gs git status
SPC cf format SPC ca code action SPC cf format SPC ca code action
SPC ? active cheat sheet :ChopsticksStatus health SPC fc local config SPC ? active cheat sheet
:ChopsticksStatus health :ChopsticksConfig preferences
``` ```
Also test the boring path: save, quit, reopen Vim, edit over SSH, open a large Also test the boring path: save, quit, reopen Vim, edit over SSH, open a large

View file

@ -25,6 +25,8 @@
- `:ChopsticksCheatSheet` command, with `SPC ?` as the discoverable default - `:ChopsticksCheatSheet` command, with `SPC ?` as the discoverable default
- `:ChopsticksHelp` and native `:help chopsticks` documentation for in-editor - `:ChopsticksHelp` and native `:help chopsticks` documentation for in-editor
support without a separate wiki support without a separate wiki
- `:ChopsticksConfig` and `:ChopsticksReload` for editing local preferences
without touching the managed `.vimrc`
- `:ChopsticksBeta`, `:ChopsticksBetaLog`, and `:ChopsticksBetaSession` for - `:ChopsticksBeta`, `:ChopsticksBetaLog`, and `:ChopsticksBetaSession` for
guided beta testing and local session notes guided beta testing and local session notes
- Dedicated modules for buffers, utilities, files, runner, quickfix, status, - Dedicated modules for buffers, utilities, files, runner, quickfix, status,

View file

@ -51,6 +51,7 @@ SPC w save
SPC qx save + quit SPC qx save + quit
:q! force quit :q! force quit
SPC ? cheat sheet (toggle sidebar) SPC ? cheat sheet (toggle sidebar)
SPC fc edit local preferences
:ChopsticksHelp full native help :ChopsticksHelp full native help
``` ```
@ -62,6 +63,7 @@ Esc back to Normal
,x save + quit ,x save + quit
:q! force quit :q! force quit
,? cheat sheet (toggle sidebar) ,? cheat sheet (toggle sidebar)
,ec edit local preferences
:ChopsticksHelp full native help :ChopsticksHelp full native help
``` ```
@ -140,6 +142,8 @@ syntax. Enable the heavier Markdown tools only when you want them.
``` ```
:ChopsticksHelp full native Vim help :ChopsticksHelp full native Vim help
:ChopsticksConfig edit local preferences
:ChopsticksReload reload after saving local preferences
:ChopsticksTutor guided practice for the final keymap :ChopsticksTutor guided practice for the final keymap
:ChopsticksStatus see what's installed and what's missing :ChopsticksStatus see what's installed and what's missing
``` ```

View file

@ -49,8 +49,9 @@ That assembly work is the pain chopsticks removes:
- **Remote editing is fragile.** It is built to degrade on TTY, slow SSH, and - **Remote editing is fragile.** It is built to degrade on TTY, slow SSH, and
headless machines instead of assuming a GUI desktop. headless machines instead of assuming a GUI desktop.
- **Custom configs are hard to onboard.** `:ChopsticksHelp`, `SPC ?`, - **Custom configs are hard to onboard.** `:ChopsticksHelp`, `SPC ?`,
`:ChopsticksTutor`, and `:ChopsticksStatus` make the active keymap, full `:ChopsticksTutor`, `:ChopsticksConfig`, and `:ChopsticksStatus` make the
help, and missing tools visible inside Vim. active keymap, full help, local preferences, and missing tools visible inside
Vim.
You SSH into a server. You need to edit code. You want LSP, fuzzy find, git You SSH into a server. You need to edit code. You want LSP, fuzzy find, git
integration, format-on-save — not a 20-minute setup. integration, format-on-save — not a 20-minute setup.
@ -129,7 +130,9 @@ into Markdown lint, format, spell, conceal, Marksman, and LSP virtual text.
Project updates leave `~/.config/chopsticks.vim` alone, so put local choices Project updates leave `~/.config/chopsticks.vim` alone, so put local choices
there instead of editing the managed `.vimrc`. The `SPC ?` cheat sheet follows there instead of editing the managed `.vimrc`. The `SPC ?` cheat sheet follows
the active profile and only shows keys for enabled features. the active profile and only shows keys for enabled features. Inside Vim, use
`:ChopsticksConfig` to edit that local file and `:ChopsticksReload` after
saving it.
## Keys ## Keys
@ -144,7 +147,8 @@ for native `S`.
For onboarding, use `:ChopsticksHelp` / `:help chopsticks` for full native Vim For onboarding, use `:ChopsticksHelp` / `:help chopsticks` for full native Vim
help, `:ChopsticksTutor` for a guided practice page, `SPC ?` for the active help, `:ChopsticksTutor` for a guided practice page, `SPC ?` for the active
keymap, and `:ChopsticksStatus` for tool/LSP health. keymap, `:ChopsticksConfig` for local preferences, and `:ChopsticksStatus` for
tool/LSP health.
`QUICKSTART.md` is the 5-minute path; this README is the full reference. `QUICKSTART.md` is the 5-minute path; this README is the full reference.
During the beta, `:ChopsticksBeta` opens the in-editor test checklist, During the beta, `:ChopsticksBeta` opens the in-editor test checklist,
`:ChopsticksBetaLog` opens editable local notes, and `:ChopsticksBetaSession` `:ChopsticksBetaLog` opens editable local notes, and `:ChopsticksBetaSession`
@ -157,6 +161,7 @@ SPC e toggle file sidebar SPC rr run current file
SPC gs git status SPC cf format SPC gs git status SPC cf format
SPC w save SPC qq quit SPC w save SPC qq quit
Esc exit insert mode SPC ? cheat sheet Esc exit insert mode SPC ? cheat sheet
:ChopsticksConfig local prefs :ChopsticksReload reload
``` ```
<details> <details>
@ -168,7 +173,7 @@ Esc exit insert mode SPC ? cheat sheet
### Files ### Files
`SPC ff` files | `SPC fb` buffers | `SPC fg` git files | `SPC fr` recent | `SPC fl` buffer lines | `SPC fL` all lines | `SPC fv` edit vimrc | `SPC fV` reload vimrc `SPC ff` files | `SPC fb` buffers | `SPC fg` git files | `SPC fr` recent | `SPC fl` buffer lines | `SPC fL` all lines | `SPC fc` local config | `SPC fv` edit vimrc | `SPC fV` reload
### Search ### Search
@ -200,7 +205,7 @@ Esc exit insert mode SPC ? cheat sheet
### Survival ### Survival
`SPC w` save | `SPC W` save all | `SPC qq` quit | `SPC qx` save and quit | `SPC ?` cheat sheet | `:ChopsticksHelp` full help | `:ChopsticksTutor` practice | `:ChopsticksStatus` diagnostics `SPC w` save | `SPC W` save all | `SPC qq` quit | `SPC qx` save and quit | `SPC fc` local config | `SPC fV` reload | `SPC ?` cheat sheet | `:ChopsticksHelp` full help | `:ChopsticksTutor` practice | `:ChopsticksStatus` diagnostics
</details> </details>
@ -237,7 +242,7 @@ Esc exit insert mode SPC ? cheat sheet
### Utilities ### Utilities
`,cp` copy full path | `,cf` copy filename | `,ev` edit vimrc | `,sv` reload vimrc | `,wa` save all | `:ChopsticksStatus` diagnostics `,cp` copy full path | `,cf` copy filename | `,ec` local config | `,ev` edit vimrc | `,sv` reload | `,wa` save all | `:ChopsticksStatus` diagnostics
</details> </details>
@ -298,7 +303,7 @@ For Markdown LSP, install or select `marksman` first.
├── git.vim fugitive, gitgutter, conflict nav ├── git.vim fugitive, gitgutter, conflict nav
├── languages.vim vim-go, markdown, filetype settings ├── languages.vim vim-go, markdown, filetype settings
├── buffers.vim buffer commands ├── buffers.vim buffer commands
├── utilities.vim reindent, trim, clipboard, vimrc helpers ├── utilities.vim config, reload, trim, clipboard helpers
├── files.vim auto mkdir, large-file protection ├── files.vim auto mkdir, large-file protection
├── runner.vim run current file ├── runner.vim run current file
├── quickfix.vim quickfix and location-list helpers ├── quickfix.vim quickfix and location-list helpers
@ -333,7 +338,8 @@ Each module is self-contained. Comment out one line in `.vimrc` to disable it. A
| What's installed? | `:ChopsticksStatus` shows tools, LSP, linters | | What's installed? | `:ChopsticksStatus` shows tools, LSP, linters |
For deeper checks, start with `:ChopsticksStatus`, `SPC ?`, For deeper checks, start with `:ChopsticksStatus`, `SPC ?`,
`:ChopsticksTutor`, `:ChopsticksHelp`, and [QUICKSTART.md](QUICKSTART.md). `:ChopsticksTutor`, `:ChopsticksHelp`, `:ChopsticksConfig`, and
[QUICKSTART.md](QUICKSTART.md).
## Contributing ## Contributing

View file

@ -31,6 +31,7 @@ Inside Vim:
SPC ? active keymap cheat sheet SPC ? active keymap cheat sheet
:ChopsticksStatus tool, plugin, and LSP diagnostics :ChopsticksStatus tool, plugin, and LSP diagnostics
:ChopsticksHelp this help page :ChopsticksHelp this help page
:ChopsticksConfig edit local preferences
< <
Daily loop: Daily loop:
@ -62,7 +63,8 @@ High-frequency keys:
SPC e/E file sidebar SPC rr run file SPC e/E file sidebar SPC rr run file
SPC gs git status SPC gl git log graph SPC gs git status SPC gl git log graph
SPC ca code action SPC cr rename SPC ca code action SPC cr rename
SPC cf format SPC ? cheat sheet SPC cf format SPC fc edit local config
SPC fV reload config SPC ? cheat sheet
< <
Classic comma mappings remain available: Classic comma mappings remain available:
@ -76,6 +78,8 @@ COMMANDS *chopsticks-commands
User-facing commands: User-facing commands:
> >
:ChopsticksHelp open this help :ChopsticksHelp open this help
:ChopsticksConfig edit local preferences
:ChopsticksReload reload chopsticks after config changes
:ChopsticksTutor guided practice :ChopsticksTutor guided practice
:ChopsticksCheatSheet active keymap reference :ChopsticksCheatSheet active keymap reference
:ChopsticksStatus health diagnostics :ChopsticksStatus health diagnostics
@ -100,6 +104,16 @@ Keep personal choices outside the managed .vimrc:
let g:chopsticks_keymap_style = 'space' let g:chopsticks_keymap_style = 'space'
< <
Open that file from inside Vim:
>
:ChopsticksConfig
<
Reload after saving it:
>
:ChopsticksReload
<
Profiles: Profiles:
minimal Core navigation, editing, git, Markdown. No LSP/ALE/completion. minimal Core navigation, editing, git, Markdown. No LSP/ALE/completion.
@ -147,6 +161,7 @@ Start with:
SPC ? SPC ?
:ChopsticksTutor :ChopsticksTutor
:ChopsticksHelp :ChopsticksHelp
:ChopsticksConfig
< <
Common fixes: Common fixes:
@ -155,6 +170,8 @@ Common fixes:
LSP missing Open that filetype, then :LspInstallServer LSP missing Open that filetype, then :LspInstallServer
Need active keys SPC ? Need active keys SPC ?
Need full docs :help chopsticks Need full docs :help chopsticks
Need local config :ChopsticksConfig
Changed local config :ChopsticksReload
Need beta notes :ChopsticksBetaSession Need beta notes :ChopsticksBetaSession
Slow large file Syntax, undo, swap, and ALE are auto-reduced Slow large file Syntax, undo, swap, and ALE are auto-reduced

View file

@ -145,9 +145,12 @@ function! s:CheatSheet() abort
\ ' SPC qq quit', \ ' SPC qq quit',
\ ' SPC qx save + quit', \ ' SPC qx save + quit',
\ ' Esc exit insert', \ ' Esc exit insert',
\ ' SPC fc edit local config',
\ ' SPC fv edit vimrc', \ ' SPC fv edit vimrc',
\ ' SPC fV reload vimrc', \ ' SPC fV reload vimrc',
\ ' :ChopsticksHelp full help', \ ' :ChopsticksHelp full help',
\ ' :ChopsticksConfig local config',
\ ' :ChopsticksReload reload config',
\ ' :ChopsticksTutor practice', \ ' :ChopsticksTutor practice',
\ ' :ChopsticksStatus health', \ ' :ChopsticksStatus health',
\ ' :ChopsticksBeta beta test guide', \ ' :ChopsticksBeta beta test guide',
@ -259,9 +262,12 @@ function! s:CheatSheet() abort
\ ' ,q quit', \ ' ,q quit',
\ ' ,x save + quit', \ ' ,x save + quit',
\ ' Esc exit insert', \ ' Esc exit insert',
\ ' ,ec edit local config',
\ ' ,ev edit vimrc', \ ' ,ev edit vimrc',
\ ' ,sv reload vimrc', \ ' ,sv reload vimrc',
\ ' :ChopsticksHelp full help', \ ' :ChopsticksHelp full help',
\ ' :ChopsticksConfig local config',
\ ' :ChopsticksReload reload config',
\ ' :ChopsticksTutor practice', \ ' :ChopsticksTutor practice',
\ ' :ChopsticksStatus health', \ ' :ChopsticksStatus health',
\ ' :ChopsticksBeta beta test guide', \ ' :ChopsticksBeta beta test guide',

View file

@ -80,12 +80,22 @@ function! s:BetaLogPath() abort
return expand(l:xdg . '/chopsticks-beta.md') return expand(l:xdg . '/chopsticks-beta.md')
endfunction endfunction
function! s:LocalConfigPath() abort
let l:xdg = !empty($XDG_CONFIG_HOME) && $XDG_CONFIG_HOME =~# '^/'
\ ? $XDG_CONFIG_HOME
\ : '~/.config'
return expand(get(g:, 'chopsticks_resolved_local_config',
\ get(g:, 'chopsticks_local_config', l:xdg . '/chopsticks.vim')))
endfunction
function! s:ChopsticksStatus() abort function! s:ChopsticksStatus() abort
let l:lines = [] let l:lines = []
call add(l:lines, 'chopsticks status') call add(l:lines, 'chopsticks status')
call add(l:lines, repeat('─', 50)) call add(l:lines, repeat('─', 50))
call add(l:lines, '') call add(l:lines, '')
call add(l:lines, ' help :ChopsticksHelp :ChopsticksTutor SPC ?') call add(l:lines, ' help :ChopsticksHelp :ChopsticksTutor SPC ?')
call add(l:lines, ' config ' . s:LocalConfigPath())
call add(l:lines, ' commands :ChopsticksConfig :ChopsticksReload')
call add(l:lines, '') call add(l:lines, '')
if !empty(get(g:, 'chopsticks_beta_label', '')) if !empty(get(g:, 'chopsticks_beta_label', ''))

View file

@ -28,7 +28,11 @@ function! s:ChopsticksTutor() abort
\ ' SPC ? active cheat sheet', \ ' SPC ? active cheat sheet',
\ ' SPC w save', \ ' SPC w save',
\ ' SPC qx save and quit', \ ' SPC qx save and quit',
\ ' SPC fc edit local config',
\ ' SPC fV reload config',
\ ' :ChopsticksHelp full help', \ ' :ChopsticksHelp full help',
\ ' :ChopsticksConfig local config',
\ ' :ChopsticksReload reload config',
\ ' :ChopsticksStatus health check', \ ' :ChopsticksStatus health check',
\ ' :ChopsticksBeta beta checklist', \ ' :ChopsticksBeta beta checklist',
\ ' :ChopsticksBetaLog beta notes', \ ' :ChopsticksBetaLog beta notes',
@ -93,7 +97,11 @@ function! s:ChopsticksTutor() abort
\ ' <C-w>hjkl split navigation', \ ' <C-w>hjkl split navigation',
\ '', \ '',
\ ' support', \ ' support',
\ ' ,ec edit local config',
\ ' ,sv reload config',
\ ' :ChopsticksHelp full help', \ ' :ChopsticksHelp full help',
\ ' :ChopsticksConfig local config',
\ ' :ChopsticksReload reload config',
\ ' :ChopsticksStatus health check', \ ' :ChopsticksStatus health check',
\ ' :ChopsticksBeta beta checklist', \ ' :ChopsticksBeta beta checklist',
\ ' :ChopsticksBetaLog beta notes', \ ' :ChopsticksBetaLog beta notes',

View file

@ -1,5 +1,47 @@
" utilities.vim — small editing and config helpers " utilities.vim — small editing and config helpers
function! s:LocalConfigPath() abort
let l:xdg = !empty($XDG_CONFIG_HOME) && $XDG_CONFIG_HOME =~# '^/'
\ ? $XDG_CONFIG_HOME
\ : '~/.config'
return expand(get(g:, 'chopsticks_resolved_local_config',
\ get(g:, 'chopsticks_local_config', l:xdg . '/chopsticks.vim')))
endfunction
function! s:EditLocalConfig() abort
let l:path = s:LocalConfigPath()
let l:new_file = !filereadable(l:path)
let l:dir = fnamemodify(l:path, ':h')
if !isdirectory(l:dir)
call mkdir(l:dir, 'p')
endif
execute 'edit ' . fnameescape(l:path)
setlocal filetype=vim
if l:new_file && line('$') == 1 && getline(1) ==# ''
call setline(1, [
\ '" chopsticks local preferences',
\ "let g:chopsticks_profile = 'engineer'",
\ "let g:chopsticks_keymap_style = 'space'",
\ '',
\ '" Optional habits:',
\ '" let g:chopsticks_enable_jk_escape = 1',
\ '" let g:chopsticks_enable_ctrl_s_save = 1',
\ '" let g:chopsticks_enable_auto_pairs = 1',
\ ])
setlocal nomodified
endif
endfunction
function! s:ReloadChopsticks() abort
unlet! g:chopsticks_loaded
execute 'source ' . fnameescape($MYVIMRC)
echo 'chopsticks reloaded'
endfunction
command! ChopsticksConfig call s:EditLocalConfig()
command! ChopsticksReload call s:ReloadChopsticks()
if get(g:, 'chopsticks_enable_reindent_file', 0) if get(g:, 'chopsticks_enable_reindent_file', 0)
if g:chopsticks_space_keymaps if g:chopsticks_space_keymaps
nnoremap <leader>c= gg=G`` nnoremap <leader>c= gg=G``
@ -34,11 +76,13 @@ else
endif endif
if g:chopsticks_space_keymaps if g:chopsticks_space_keymaps
nnoremap <leader>fc :ChopsticksConfig<CR>
nnoremap <leader>fv :edit $MYVIMRC<CR> nnoremap <leader>fv :edit $MYVIMRC<CR>
nnoremap <leader>fV :unlet! g:chopsticks_loaded<CR>:execute 'source ' . fnameescape($MYVIMRC)<CR>:echo "vimrc reloaded"<CR> nnoremap <leader>fV :ChopsticksReload<CR>
else else
nnoremap <leader>ec :ChopsticksConfig<CR>
nnoremap <leader>ev :edit $MYVIMRC<CR> nnoremap <leader>ev :edit $MYVIMRC<CR>
nnoremap <leader>sv :unlet! g:chopsticks_loaded<CR>:execute 'source ' . fnameescape($MYVIMRC)<CR>:echo "vimrc reloaded"<CR> nnoremap <leader>sv :ChopsticksReload<CR>
endif endif
if g:chopsticks_space_keymaps if g:chopsticks_space_keymaps

View file

@ -29,8 +29,8 @@ check_docs() {
markdownlint README.md QUICKSTART.md CONTRIBUTING.md CHANGELOG.md BETA.md markdownlint README.md QUICKSTART.md CONTRIBUTING.md CHANGELOG.md BETA.md
step "Documentation consistency" step "Documentation consistency"
for command in ChopsticksHelp ChopsticksBeta ChopsticksBetaLog \ for command in ChopsticksHelp ChopsticksConfig ChopsticksReload \
ChopsticksBetaSession ChopsticksBeta ChopsticksBetaLog ChopsticksBetaSession
do do
for file in README.md BETA.md doc/chopsticks.txt modules/cheatsheet.vim \ for file in README.md BETA.md doc/chopsticks.txt modules/cheatsheet.vim \
modules/tutor.vim modules/status.vim modules/tutor.vim modules/status.vim
@ -44,6 +44,8 @@ check_docs() {
grep -Fq '*chopsticks.txt*' doc/chopsticks.txt grep -Fq '*chopsticks.txt*' doc/chopsticks.txt
grep -Fq '*chopsticks-v3-space*' doc/chopsticks.txt grep -Fq '*chopsticks-v3-space*' doc/chopsticks.txt
grep -Fq 'command! ChopsticksHelp' modules/help.vim grep -Fq 'command! ChopsticksHelp' modules/help.vim
grep -Fq 'command! ChopsticksConfig' modules/utilities.vim
grep -Fq 'command! ChopsticksReload' modules/utilities.vim
for command in ChopsticksBeta ChopsticksBetaLog ChopsticksBetaSession; do for command in ChopsticksBeta ChopsticksBetaLog ChopsticksBetaSession; do
grep -Fq "command! $command" modules/beta.vim || { grep -Fq "command! $command" modules/beta.vim || {
echo "Missing $command definition in modules/beta.vim" >&2 echo "Missing $command definition in modules/beta.vim" >&2

View file

@ -67,16 +67,27 @@ check_vim() {
vim -u NONE -i NONE -es -N \ vim -u NONE -i NONE -es -N \
-c "let g:chopsticks_local_config = '$TMP_ROOT/local/config.vim'" \ -c "let g:chopsticks_local_config = '$TMP_ROOT/local/config.vim'" \
-c 'source .vimrc' \ -c 'source .vimrc' \
-c 'if g:chopsticks_profile !=# "minimal" || has_key(g:plugs, "ale") || has_key(g:plugs, "vim-lsp") || has_key(g:plugs, "auto-pairs") | cquit | endif' \ -c 'if g:chopsticks_resolved_local_config !~# "config.vim$" || g:chopsticks_profile !=# "minimal" || has_key(g:plugs, "ale") || has_key(g:plugs, "vim-lsp") || has_key(g:plugs, "auto-pairs") | cquit | endif' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
mkdir -p "$TMP_ROOT/xdg" mkdir -p "$TMP_ROOT/xdg"
printf "%s\n" "let g:chopsticks_profile = 'minimal'" > "$TMP_ROOT/xdg/chopsticks.vim" printf "%s\n" "let g:chopsticks_profile = 'minimal'" > "$TMP_ROOT/xdg/chopsticks.vim"
XDG_CONFIG_HOME="$TMP_ROOT/xdg" vim -u NONE -i NONE -es -N \ XDG_CONFIG_HOME="$TMP_ROOT/xdg" vim -u NONE -i NONE -es -N \
-c 'source .vimrc' \ -c 'source .vimrc' \
-c 'if g:chopsticks_profile !=# "minimal" || has_key(g:plugs, "ale") || has_key(g:plugs, "vim-lsp") || has_key(g:plugs, "auto-pairs") | cquit | endif' \ -c 'if g:chopsticks_resolved_local_config !~# "chopsticks.vim$" || g:chopsticks_profile !=# "minimal" || has_key(g:plugs, "ale") || has_key(g:plugs, "vim-lsp") || has_key(g:plugs, "auto-pairs") | cquit | endif' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
local_config_cmd="$TMP_ROOT/config command/chopsticks.vim"
vim -u NONE -i NONE -es -N \
-c "let g:chopsticks_local_config = '$local_config_cmd'" \
-c 'source .vimrc' \
-c 'ChopsticksConfig' \
-c 'if expand("%:p") !=# g:chopsticks_resolved_local_config || &l:filetype !=# "vim" | cquit | endif' \
-c 'if getline(1) !~# "chopsticks local preferences" || &modified | cquit | endif' \
-c 'qa!' 2>&1
test -d "$(dirname "$local_config_cmd")"
test ! -e "$local_config_cmd"
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
-c 'ChopsticksStatus' \ -c 'ChopsticksStatus' \
-c "redir! > $TMP_ROOT/status-default.txt" \ -c "redir! > $TMP_ROOT/status-default.txt" \
@ -89,6 +100,7 @@ check_vim() {
fi fi
grep -Fq 'OK vim-lsp stack (installed)' "$TMP_ROOT/status-default.txt" grep -Fq 'OK vim-lsp stack (installed)' "$TMP_ROOT/status-default.txt"
grep -Fq 'help :ChopsticksHelp :ChopsticksTutor SPC ?' "$TMP_ROOT/status-default.txt" grep -Fq 'help :ChopsticksHelp :ChopsticksTutor SPC ?' "$TMP_ROOT/status-default.txt"
grep -Fq 'commands :ChopsticksConfig :ChopsticksReload' "$TMP_ROOT/status-default.txt"
grep -Fq 'candidate 3.0.0-beta.1' "$TMP_ROOT/status-default.txt" grep -Fq 'candidate 3.0.0-beta.1' "$TMP_ROOT/status-default.txt"
grep -Fq 'keymap space' "$TMP_ROOT/status-default.txt" grep -Fq 'keymap space' "$TMP_ROOT/status-default.txt"
grep -Fq 'commands :ChopsticksBeta :ChopsticksBetaLog' "$TMP_ROOT/status-default.txt" grep -Fq 'commands :ChopsticksBeta :ChopsticksBetaLog' "$TMP_ROOT/status-default.txt"
@ -113,6 +125,7 @@ check_vim() {
-c 'source .vimrc' \ -c 'source .vimrc' \
-c 'let last_change_map = nr2char(96) . "[v" . nr2char(96) . "]"' \ -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 mapleader !=# "," || maparg("s", "n") !=# "" || maparg(",/", "v") !~# "escape" || maparg(",v", "n") !=# last_change_map || maparg(",ff", "n") !~# "SmartFiles" | 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 'if maparg(",gp", "n") !=# "" || maparg(",gl", "n") !=# "" | cquit | endif' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
@ -238,7 +251,7 @@ check_vim() {
-c 'if maparg(",ff", "n") !=# "" || maparg(",w", "n") !=# "" || maparg(",mt", "n") !=# "" || maparg(",gp", "n") !=# "" || maparg("<Space>gp", "n") !=# "" | cquit | endif' \ -c 'if maparg(",ff", "n") !=# "" || maparg(",w", "n") !=# "" || maparg(",mt", "n") !=# "" || maparg(",gp", "n") !=# "" || maparg("<Space>gp", "n") !=# "" | cquit | endif' \
-c 'if maparg("<Space>f", "n") !=# "" || maparg("<Space>q", "n") !=# "" || maparg("<Space>u", "n") !=# "" || maparg("<Space>c", "n") !=# "" || maparg("<Space>x", "n") !=# "" || maparg("<Space>wm", "n") !=# "" || maparg("<Space>w+", "n") !=# "" || maparg("<Space>w-", "n") !=# "" | cquit | endif' \ -c 'if maparg("<Space>f", "n") !=# "" || maparg("<Space>q", "n") !=# "" || maparg("<Space>u", "n") !=# "" || maparg("<Space>c", "n") !=# "" || maparg("<Space>x", "n") !=# "" || maparg("<Space>wm", "n") !=# "" || maparg("<Space>w+", "n") !=# "" || maparg("<Space>w-", "n") !=# "" | cquit | endif' \
-c 'if maparg("<Space><Space>", "n") !~# "SmartFiles" || maparg("<Space>ff", "n") !~# "SmartFiles" || maparg("<Space>,", "n") !~# "Buffers" || maparg("<Space>bd", "n") !~# "Bclose" | cquit | endif' \ -c 'if maparg("<Space><Space>", "n") !~# "SmartFiles" || maparg("<Space>ff", "n") !~# "SmartFiles" || maparg("<Space>,", "n") !~# "Buffers" || maparg("<Space>bd", "n") !~# "Bclose" | cquit | endif' \
-c 'if maparg("<Space>w", "n") !~# ":w" || maparg("<Space>W", "n") !~# ":wa" || maparg("<Space>qq", "n") !~# ":q" || maparg("<Space>qx", "n") !~# ":x" || maparg("<Space>U", "n") !~# "UndotreeToggle" || maparg("<Space>fs", "n") !=# "" || maparg("<Space>bu", "n") !=# "" | cquit | endif' \ -c 'if maparg("<Space>w", "n") !~# ":w" || maparg("<Space>W", "n") !~# ":wa" || maparg("<Space>qq", "n") !~# ":q" || maparg("<Space>qx", "n") !~# ":x" || maparg("<Space>fc", "n") !~# "ChopsticksConfig" || maparg("<Space>fV", "n") !~# "ChopsticksReload" || maparg("<Space>U", "n") !~# "UndotreeToggle" || maparg("<Space>fs", "n") !=# "" || maparg("<Space>bu", "n") !=# "" | cquit | endif' \
-c 'if maparg("<Space>gl", "n") !~# "Git log" || maparg("<Space>gC", "n") !~# "Commits" | cquit | endif' \ -c 'if maparg("<Space>gl", "n") !~# "Git log" || maparg("<Space>gC", "n") !~# "Commits" | cquit | endif' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
@ -266,9 +279,12 @@ check_vim() {
grep -Fq '[d ]d LSP diagnostics' "$TMP_ROOT/cheat-default.txt" grep -Fq '[d ]d LSP diagnostics' "$TMP_ROOT/cheat-default.txt"
grep -Fq '<C-w>hjkl navigate splits' "$TMP_ROOT/cheat-default.txt" grep -Fq '<C-w>hjkl navigate splits' "$TMP_ROOT/cheat-default.txt"
grep -Fq 'SPC w save' "$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" grep -Fq 's+2ch easymotion jump' "$TMP_ROOT/cheat-default.txt"
grep -Fq 'cl / cc native s / S substitute' "$TMP_ROOT/cheat-default.txt" grep -Fq 'cl / cc native s / S substitute' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksHelp full help' "$TMP_ROOT/cheat-default.txt" grep -Fq ':ChopsticksHelp full help' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksConfig local config' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksReload reload config' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksTutor practice' "$TMP_ROOT/cheat-default.txt" grep -Fq ':ChopsticksTutor practice' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksBeta beta test guide' "$TMP_ROOT/cheat-default.txt" grep -Fq ':ChopsticksBeta beta test guide' "$TMP_ROOT/cheat-default.txt"
grep -Fq ':ChopsticksBetaLog beta notes' "$TMP_ROOT/cheat-default.txt" grep -Fq ':ChopsticksBetaLog beta notes' "$TMP_ROOT/cheat-default.txt"
@ -299,6 +315,8 @@ check_vim() {
grep -Fq ',dd definition' "$TMP_ROOT/cheat-classic.txt" grep -Fq ',dd definition' "$TMP_ROOT/cheat-classic.txt"
grep -Fq ',dk hover docs' "$TMP_ROOT/cheat-classic.txt" grep -Fq ',dk hover docs' "$TMP_ROOT/cheat-classic.txt"
grep -Fq ',dp ,dn LSP diagnostics' "$TMP_ROOT/cheat-classic.txt" grep -Fq ',dp ,dn LSP diagnostics' "$TMP_ROOT/cheat-classic.txt"
grep -Fq ',ec edit local config' "$TMP_ROOT/cheat-classic.txt"
grep -Fq ':ChopsticksConfig local config' "$TMP_ROOT/cheat-classic.txt"
if grep -Eq ',gp push|,gl pull' "$TMP_ROOT/cheat-classic.txt"; then if grep -Eq ',gp push|,gl pull' "$TMP_ROOT/cheat-classic.txt"; then
cat "$TMP_ROOT/cheat-classic.txt" cat "$TMP_ROOT/cheat-classic.txt"
exit 1 exit 1
@ -329,6 +347,7 @@ check_vim() {
grep -Fq 'SPC w save' "$TMP_ROOT/cheat-space.txt" grep -Fq 'SPC w save' "$TMP_ROOT/cheat-space.txt"
grep -Fq 'gd definition' "$TMP_ROOT/cheat-space.txt" grep -Fq 'gd definition' "$TMP_ROOT/cheat-space.txt"
grep -Fq 'SPC gl log graph' "$TMP_ROOT/cheat-space.txt" grep -Fq 'SPC gl log graph' "$TMP_ROOT/cheat-space.txt"
grep -Fq 'SPC fc edit local config' "$TMP_ROOT/cheat-space.txt"
grep -Fq 's+2ch easymotion jump' "$TMP_ROOT/cheat-space.txt" grep -Fq 's+2ch easymotion jump' "$TMP_ROOT/cheat-space.txt"
if grep -Eq ',w save|,gp push|SPC gp push|SPC gl pull|SPC fs save|SPC cd definition|SPC f format' "$TMP_ROOT/cheat-space.txt"; then if grep -Eq ',w save|,gp push|SPC gp push|SPC gl pull|SPC fs save|SPC cd definition|SPC f format' "$TMP_ROOT/cheat-space.txt"; then
cat "$TMP_ROOT/cheat-space.txt" cat "$TMP_ROOT/cheat-space.txt"
@ -343,7 +362,9 @@ check_vim() {
-c 'qa!' 2>&1 -c 'qa!' 2>&1
grep -Fq 'chopsticks tutor' "$TMP_ROOT/tutor-default.txt" grep -Fq 'chopsticks tutor' "$TMP_ROOT/tutor-default.txt"
grep -Fq 'SPC ? active cheat sheet' "$TMP_ROOT/tutor-default.txt" grep -Fq 'SPC ? active cheat sheet' "$TMP_ROOT/tutor-default.txt"
grep -Fq 'SPC fc edit local config' "$TMP_ROOT/tutor-default.txt"
grep -Fq ':ChopsticksHelp full help' "$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 's + 2 chars visible jump' "$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 'cl / cc native s / S substitute' "$TMP_ROOT/tutor-default.txt"
grep -Fq 'gd / gr / K definition / refs / docs' "$TMP_ROOT/tutor-default.txt" grep -Fq 'gd / gr / K definition / refs / docs' "$TMP_ROOT/tutor-default.txt"
@ -358,6 +379,7 @@ check_vim() {
-c 'qa!' 2>&1 -c 'qa!' 2>&1
grep -Fq 'classic layout' "$TMP_ROOT/tutor-classic.txt" grep -Fq 'classic layout' "$TMP_ROOT/tutor-classic.txt"
grep -Fq ',? active cheat sheet' "$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 ',S + 2 chars EasyMotion jump' "$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 \ XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \