--- title: Vim Tips slug: vim-tips tags: - Linux --- ## General Tips - `vim -p file1 file2` to open multiple files as tabs - `:qa` to quit out of all open buffers - `:Ex` to return to netrw (file explorer) ## Terminals - `:term` to open a terminal in current window - Use `i` to enter insert mode and type into the shell - `` to return to normal mode to allow scrolling or switching windows - I've remapped this to `` ## Windows - `` prefixes all window commands - `` + `h,j,k,l` to focus window to left, bottom, up, right, respectively - `s` to split current window horizontally, equivalent to `:split` - `v` to split current window vertically, equivalent to `:vs` ## Registers - `"c` before a command, where `c` is the register to store the text - Use capital letter to append to the register, e.g. `"C` ## Macros - Press `qc` to start recording, where `c` is the register to store the macro - Stop recording with `q` - Replay the macro with `@c`