Vim Tips
Note: My configuration is a lightly-modified fork of kickstart-nvim , which provides a decent starting point for neovim configs, complete with LSP support and many keybindings. I am not a neovim configuration wizard so I am not 100% clear on which of these keybindings are available by default in neovim.
General Tips
vim -p file1 file2to open multiple files as tabs:qato quit out of all open buffers:Exto return to netrw (file explorer)
Terminals
:![cmd]to run a[cmd]in the shell, good for quick one-off commands- I use this for
hugo newa lot when working on my website!
- I use this for
:termto open a terminal in current window- Use
ito enter insert mode and type into the shell <C-\><C-n>to return to normal mode to allow scrolling or switching windows- I’ve remapped this to
<C-space>
- I’ve remapped this to
Windows
<C-w>prefixes all window commands<C-w>+h,j,k,lto focus window to left, bottom, up, right, respectively<C-w>sto split current window horizontally, equivalent to:split<C-w>vto split current window vertically, equivalent to:vs<C-w>=to equally resize all windows
Registers
"cbefore a command, wherecis the register to store the text- Use capital letter to append to the register, e.g.
"C
Macros
- Press
qcto start recording, wherecis the register to store the macro - Stop recording with
q - Replay the macro with
@c
Jumps
- When you jump to a new location (such as using LSP go to definition),
<C-o>will jump back to your previous spot- This is a stack, similar to undo, so you can jump back several times.
Tags: