diff --git a/CHEATSHEET.md b/CHEATSHEET.md index 7f343f5..bb11a69 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -4,114 +4,114 @@ Heavily customized. Related blog post: https://lugh.ch/neovim-lessons-learned.ht ## BASICS -- `:checkhealth []` check base or plugin status -- `:checkhealth vim.lsp` show details of LSP attached to buffer -- `:verbose set expandtab?` check where `expandtab` has been set last -- `:Lazy` show package manager TUI -- `:Mason` show LSP management TUI -- `:TSUpdate` update all Tree-sitter parsers -- `:ConformInfo` useful to debug why a formatter times out +- `:che []` check base or plugin status +- `:che lsp` show LSP details +- `:verbose set expandtab?` check where `expandtab` was set last +- `:Lazy` show package manager +- `:Mason` show LSP management +- `:TSUpdate` update Tree-sitter parsers +- `:ConformInfo` Formatter timeout debug -## NAVIGATING +## NAVIGATE -## Windows, splits & tabs +### Windows, splits & tabs - `Ctrl`+`wq` close window -- `Ctrl`+`ws` split window **horizontally** -- `Ctrl`+`wv` split window **vertically** -- `Ctrl`+`h/j/k/l` move between split windows +- `Ctrl`+`ws` split window _horizontally_ +- `Ctrl`+`wv` split window _vertically_ +- `Ctrl`+`h/j/k/l` move between splits - `Ctrl`+`w=` equalize split window width and height - `Ctrl`+`wr` swap position of two windows -- `Ctrl`+`wT` move active split window to new tab +- `Ctrl`+`wT` move focused split to new tab - `gt` or `gT` switch forward/reverse between tabs -## Buffers +### Buffers -- `leader`+`leader` lists open buffers in `snipe.nvim` +- `leader`+`leader` lists open buffers [`snipe.nvim`] - In snipe.nvim popup: Hit `D` to close the selected buffer - `:bd` close current buffer -## Text +### Text -- `w/e` move to **start/end of next word** -- `b` move to **start of previous word** -- `Ctrl`+`0` start of line -- `Ctrl`+`$` end of line -- `Ctrl`+`d/u` scroll down/up 1/2 page while keeping the cursor centered -- `Ctrl`+`o` jump to location you were before (e.g. after using `gg`) -- `Ctrl`+`i` jump back to location you were before (after using `Ctrl`+`o`) -- `s` highlight jump targets w/ `flash.nvim` +- `w/e` move to _start_/_end_ of _next_ word +- `b` move to _start_ of _previous_ word +- `Ctrl`+`0` _start_ of line +- `Ctrl`+`$` _end_ of line +- `Ctrl`+`d/u` scroll _down_/_up_ 1/2 page while keeping the cursor centered +- `Ctrl`+`o` jump to previous location (e.g. after using `gg`) +- `Ctrl`+`i` jump forward (after using `Ctrl`+`o`) +- `s` highlight jump targets [`flash.nvim`] -## LSP, Code & Diagnostics +### LSP, Code & Diagnostics - `Ctrl`+`j/k` scroll down/up through LSP suggestions - `K` show LSP context info -- `Ctrl`+`o` show LSP completion menu +- `Ctrl`+`o` show LSP completion menu in insert mode - `gd` go to definition - `gr` show references of function - `grn` renames all refs of the symbol under cursor -- `leader`+`q` toggle `trouble.nvim` quickfix list +- `leader`+`q` toggle `trouble.nvim` - `leader`+`da` go to next diagnostic (any severity) - `leader`+`dw` go to next diagnostic (_warning_ severity) - `leader`+`de` go to next diagnostic (_error_ severity) -## Telescope +### Telescope -- `↓` or `Ctrl`+`n` scroll down (**n**ext) file list -- `↑` or `Ctrl`+`p` scroll up (**p**revious) file list +- `Esc`+`j` scroll down +- `Esc`+`k` scroll up - `Ctrl`+`d/u` scroll down/up in preview pane - `Ctrl`+`/` help -- `Ctrl`+`v` open file in **vertical** split -- `Ctrl`+`x` open file in **horizontal** split +- `Ctrl`+`v` open file in _vertical_ split +- `Ctrl`+`x` open file in _horizontal_ split - `Ctrl`+`t` open file in new tab -## Oil +### Oil - `Ctrl`+`d/u` bottom/top of file list - `Ctrl`+`p` preview file -- `Ctrl`+`v` open file in **vertical** split -- `Ctrl`+`x` open file in **horizontal** split +- `Ctrl`+`v` open file in _vertical_ split +- `Ctrl`+`x` open file in _horizontal_ split - `Ctrl`+`t` open file in new tab -## EDITING +### Snipe -### Code editing +- `D` close selected buffer -- `leader`+`o` re-format whole file or visual w/ `conform.nvim` -- `i` insert mode at cursor position -- `I` insert mode at **beginning of line** -- `a/A` insert mode **after the current char**/**at end of line** -- `o/O` insert mode a line **below**/**above** the cursor -- `cw` replace the current word -- `cc` replace whole line -- `C` replace to the end of the line -- `yy` copy the current line -- `yygccp` comment and copy the current line -- `yap` "yank-around-paragraph" -- `yip` "yank-inside-paragraph" -- `yaW` copy word w/ dashes/underscores +## SELECT, DELETE AND CHANGE TEXT + +Prefix the marked commands below with `v` to select, `d` for deleting or `c` to +change. + +- `leader`+`o` re-format whole file or visual [`conform.nvim`] +- `i/I` insert mode at _cursor position_/_beginning of the line_ +- `a/A` insert mode _after the current char_/_at end of line_ +- `o/O` insert mode a line _below_/_above_ the cursor +- `cc` replace _whole_ line +- `C` _replace_ to the _end_ of the line +- `D` _delete_ to the end of the line - `p/P` paste yanked line below/above +- `yygccp` comment and copy the current line +- `$` ... to the end of the _line_ +- `w` ... to the end of current _word_ +- `ap` ... around _paragraph_ +- `ip` ... inside _paragraph_ +- `at` ... around HTML/XML _tag_ +- `it` ... inside HTML/XML _tag_ +- `iq` ... inside _quotes_ [`mini.ai`] +- `aq` ... around _quotes_ [`mini.ai`] +- `aW` ... word with dashes or underscores + +### Selection-only commands + +- `ViB` Select lines inside block (useful for commenting) +- `Ctrl`+`s` context-sensitive text selection (Tree-sitter) +- `Backspace` reduce context-sensitive selection + +## GIT + - `:windo diffthis` open `vimdiff` for open splits - `:vert diffsplit ` diff this file and `` - `:windo diffoff` to close diff view -- `ciq` change inside quotes w/ `mini.ai` -- `caq` change around quotes w/ `mini.ai` - -## SELECTING - -### Visual mode - -- `v` at cursor position -- `V` line mode -- `Ctrl`+`v` block mode -- `vap` "visual-select-around-paragraph" -- `vip` "visual-select-inside-paragraph" -- `ViB` Select lines inside block (useful for commenting) - -### Code selection - -- `Ctrl`+`s` context-sensitive text selection w/ Tree-sitter -- `Backspace` reduce context-sensitive selection ## SEARCH/OPEN diff --git a/CHEATSHEET.pdf b/CHEATSHEET.pdf index b60f777..7c259b1 100644 Binary files a/CHEATSHEET.pdf and b/CHEATSHEET.pdf differ