From 51b10aa16da0ae470d7bb0aed4cf0087b6b4e516 Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Wed, 22 Apr 2026 14:35:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20restore=20,=3F=20cheat=20sheet=20?= =?UTF-8?q?=E2=80=94=20lean=20version=20matching=20current=20keybindings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/tools.vim | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/modules/tools.vim b/modules/tools.vim index c352f7c..aa363e2 100644 --- a/modules/tools.vim +++ b/modules/tools.vim @@ -113,3 +113,47 @@ augroup END nnoremap ]q :cnext nnoremap [q :cprev + +" ── Cheat Sheet (,?) ──────────────────────────────────────────────────────── + +function! s:CheatSheet() abort + let l:name = '__ChopsticksCheatSheet__' + if bufwinnr(l:name) > 0 + execute bufwinnr(l:name) . 'wincmd w | bd' + return + endif + execute 'botright new ' . l:name + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile + call setline(1, [ + \ 'chopsticks — quick reference ,? toggle this sheet', + \ '', + \ 'FILES Ctrl+p find | ,b buffers | ,rg grep | ,rG grep word', + \ ' ,e sidebar (cwd) | ,E sidebar (file dir) | ,, last file', + \ ' ,fh recent | ,fl lines | ,fc commands | ,fm marks', + \ '', + \ 'CODE gd def | gy type | gi impl | gr refs | K docs', + \ ' ,rn rename | ,ca action | ,f format | ,o outline', + \ ' [g ]g diagnostics | [e ]e ALE errors | ,cr run file', + \ '', + \ 'EDIT gc comment | s+2ch jump | cs"'' surround | ,u undo tree', + \ ' ,y clipboard yank | Alt+j/k move line | ,* replace word', + \ ' ,F re-indent | ,W strip whitespace', + \ '', + \ 'GIT ,gs status | ,gd diff | ,gb blame | ,gc commit', + \ ' ,gp push | ,gl pull | [x ]x conflict markers', + \ '', + \ 'WINDOWS Ctrl+hjkl navigate | ,h ,l buffers | ,bd close buf', + \ ' ,z maximize | ,= ,- resize | ,tv ,th terminal', + \ ' ]q [q quickfix | ,qo ,qc open/close qf', + \ '', + \ 'TOGGLE F2 paste | F3 line# | F4 relative# | F6 invisible', + \ ' ,ss spell | ,e sidebar', + \ '', + \ 'SURVIVAL ,w save | ,q quit | ,x save+quit | Ctrl+s save', + \ ' jk escape | :w!! sudo save | ,ev ,sv edit/reload vimrc', + \ ]) + setlocal nomodifiable readonly + nnoremap q :bd + nnoremap ? :bd +endfunction +nnoremap ? :call CheatSheet()