# Vim Cheatsheet - `:Cheat`: Show this file ## Default ## Plugins ### vim-abolish #### Substitution - `:S/query` to search - `:S/quer{y,ies}` to smart search - `:S/from/to/[flags]` to replace - `:S/{red,blue}/{blue,red}/` to swap #### Coercion - `crs` to `snake_case` - `cr_` to `snake_case` - `crm` to `MixedCase` - `crc` to `camelCase` - `cru` to `UPPER_CASE` - `cr-` to `dash-case` - `crk` to `kebab-kase` - `cr.` to `dot.case` - `cr ` to `space case` - `crt` to `Title Case` ### coc.nvim ``` " Use `[g` and `]g` to navigate diagnostics " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. `nmap [g (coc-diagnostic-prev)` `nmap ]g (coc-diagnostic-next)` " GoTo code navigation. `nmap gd (coc-definition)` `nmap gy (coc-type-definition)` `nmap gi (coc-implementation)` `nmap gr (coc-references)` " Use K to show documentation in preview window. `nnoremap K :call show_documentation()` " Symbol renaming. `nmap rn (coc-rename)` " Formatting selected code. `xmap f (coc-format-selected)` `nmap f (coc-format-selected)` " Applying codeAction to the selected region. " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) " Remap keys for applying codeAction to the current buffer. nmap ac (coc-codeaction) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) " Map function and class text objects xmap if (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap af (coc-funcobj-a) xmap ic (coc-classobj-i) omap ic (coc-classobj-i) xmap ac (coc-classobj-a) omap ac (coc-classobj-a) " Use CTRL-S for selections ranges. " Requires 'textDocument/selectionRange' support of language server. nmap (coc-range-select) xmap (coc-range-select) " Mappings for CocList nnoremap A :CocList diagnostics nnoremap E :CocList extensions nnoremap C :CocList commands nnoremap O :CocList outline nnoremap S :CocList -I symbols nnoremap J :CocNext nnoremap K :CocPrev nnoremap P :CocListResume ``` ### vim-sandwich #### Add ``` sa{motion/textobject}{addition} ``` example: `saiw(` makes `foo` to `(foo)` #### Delete ``` sd{deletion} sdb ``` example: `sd(` makes `(foo)` to `foo` example: use `sdb` to auto-search surrounding #### Replace ``` srb{addition} sr{deletion}{addition} ``` example: `srb"` or `sr("` makes `(foo)` to `"foo"`