ui: redesign cheat sheet — vertical sidebar, one key per line, aligned

This commit is contained in:
m1ngsama 2026-04-22 14:41:09 +08:00
parent 51b10aa16d
commit fbb692846b

View file

@ -122,35 +122,88 @@ function! s:CheatSheet() abort
execute bufwinnr(l:name) . 'wincmd w | bd'
return
endif
execute 'botright new ' . l:name
execute 'vertical botright new ' . l:name
vertical resize 42
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
setlocal nowrap nonumber norelativenumber signcolumn=no
setlocal winfixwidth
call setline(1, [
\ 'chopsticks — quick reference ,? toggle this sheet',
\ ' chopsticks ,? close',
\ ' ─────────────────────────────',
\ '',
\ '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',
\ ' ── files ──────────────────',
\ ' Ctrl+p find file',
\ ' ,b buffers',
\ ' ,rg grep project',
\ ' ,rG grep word',
\ ' ,e sidebar (cwd)',
\ ' ,E sidebar (file dir)',
\ ' ,, last file',
\ ' ,fh recent files',
\ ' ,fl lines in buffer',
\ ' ,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',
\ ' ── code ──────────────────',
\ ' gd definition',
\ ' gy type definition',
\ ' gi implementation',
\ ' gr references',
\ ' K hover docs',
\ ' ,rn rename',
\ ' ,ca code action',
\ ' ,f format',
\ ' ,o outline',
\ ' ,cr run file',
\ ' [g ]g LSP diagnostics',
\ ' [e ]e ALE errors',
\ '',
\ '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',
\ ' ── edit ──────────────────',
\ ' gc comment',
\ ' s+2ch easymotion jump',
\ ' cs"'' surround',
\ ' ,u undo tree',
\ ' ,y clipboard yank',
\ ' Alt+j/k move line',
\ ' ,* replace word',
\ ' ,F re-indent file',
\ ' ,W strip whitespace',
\ '',
\ 'GIT ,gs status | ,gd diff | ,gb blame | ,gc commit',
\ ' ,gp push | ,gl pull | [x ]x conflict markers',
\ ' ── 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',
\ ' ── windows ───────────────',
\ ' Ctrl+hjkl navigate splits',
\ ' ,h ,l prev / next buf',
\ ' ,bd close buffer',
\ ' ,z maximize toggle',
\ ' ,= ,- resize height',
\ ' ,tv ,th terminal v / h',
\ ' ]q [q next / prev qf',
\ ' ,qo ,qc open / close qf',
\ '',
\ 'TOGGLE F2 paste | F3 line# | F4 relative# | F6 invisible',
\ ' ,ss spell | ,e sidebar',
\ ' ── toggle ────────────────',
\ ' F2 paste mode',
\ ' F3 line numbers',
\ ' F4 relative numbers',
\ ' F6 invisible chars',
\ ' ,ss spell check',
\ '',
\ 'SURVIVAL ,w save | ,q quit | ,x save+quit | Ctrl+s save',
\ ' jk escape | :w!! sudo save | ,ev ,sv edit/reload vimrc',
\ ' ── survival ──────────────',
\ ' ,w save',
\ ' ,q quit',
\ ' ,x save + quit',
\ ' Ctrl+s save (any mode)',
\ ' jk exit insert',
\ ' :w!! sudo save',
\ ' ,ev edit vimrc',
\ ' ,sv reload vimrc',
\ ])
setlocal nomodifiable readonly
nnoremap <buffer> <silent> q :bd<CR>