Useful VIM Hotkeys I can't remember yet ## General `da"` delete everything inside the quotes (including quotes) `di"` delete everything inside the quotes `ci"` change everything inside the quotes (delete + enter insert mode) `zz` move the current line to center of screen `CTRL+D` Move half page down `CTRL+U` Move half page up `ciw` "change inside word", deletes the current word and goes into insert mode `ciW` same as `ciw`, but deletes one character around the word aswell `ci(`/`ci{`/`ci"` etc. changes inside the next occurance of brackets, qoutes etc. `df<char>` deletes everything until the next occurance of `<char>` `C` or `D` Deletes everything from the cursor position to the end of the line. `f<char>` moves forward until to the next occurance of `<char>` `F<char>` moves backwards to the last occurance of `<char>` `t<char>` moves forward until one space before the next occurance of `<char>` `t<char>` moves backwards to the space before the last occureance of `<char` `J` join the current line with the one below with a space `I` Insert at the beginning of the line `A` Insert at the end of the line `CTRL + V` enter Blockwise Visual Mode, can be combined with e.g. `I` to insert something at the beginning of multiple lines ## Navigation `gg` go to first line of file `G` go to last line of file `5gg` or `5G` go to line 5 of file ## Macros `qq` to start recording into register `q` `100@q` replay macro 100 times ## Search start search with `/` start reverse search with `?` `n` go to next occurance `N` go to last occurance Press `*` when inside a word, to search instantly for all occurances, use `n`/`N` to go forward/backward ### Search & Replace `:%s/old/new/gc` -> Replace `old` with `new` and confirm each replace ## Mark `m[a-z]` -> mark current position with a letter `'a` -> jump to marker `a` ## Delete(Cut) and paste `diw` delete inside word, deletes word under cursor. `yiw` yank inside word, yanks word under cursor `Y` or `y
yank to end of line ## Visual mode `~` Switch case of selection ## Registers `"ay` yank the current selection into register `a` `"ap` paste content out of the register `a` `"dd` delete line and replace register `a` with the content of the deletion any deleted content will be placed inside the numbered registers from 1-9. The last yanked text will always be stored inside register 0 (`"0) Meaning that if we yank a line, then delete a line we can access the yanked line with the register `"0` `"0` will always have the last yanked line ## 🔗Resources ### VIM cheatsheet - https://vim.rtorr.com