Vim is an editor with a steep learning curve. This is a list of shortcuts that I have learnt and use regularly. It is by no means intended to be a comprehensive list and will continue to grow as I learn more.
h/j/k/l- left, down, up, right
:Ex- enter netrw
gg- to start of file
G- to end of file
0- to start of line
$- to end of line
b- to beginning of word
w- to beginning of next word
ctrl-n- go down in list, turns out this works on various other software e.g. Chrome + Sublime autocomplete
ctrl-p- go down in list, turns out this works on various other software like Chrome + Sublime autocomplete
:ls- list all listed buffers
:bn- next buffer
:bd- delete buffer
:b- switch to certain buffer, can tab for autocompletion, can search too. Or use a number from
ctrl-d- move down half a screen
ctrl-u- move up half a screen
vib- select in brackets (much more ergonomic than
dib- delete in brackets (much more ergonomic than
HML- high, middle, low, move cursor to this position of the screen to prevent hitting
ctrl-w s- split horizontally.
ctrl-w v- split vertically.
ctrl-w w- toggle between
ctrl-w r- switch windows around (left <-> right)
ctrl-w =- Normalize all split sizes
:Vex- visual split create a new vertical window in netrw mode
:Vex!adds to RHS
/- to search. My vimrc settings allow for case-insenstive unless a capital letter is used
*- on a current word to use that as the search term
N/n- Go back and forward between the matches.
y- yank (copy)
V- select by whole lines
v- select text
ctrl v- visual block, when wanting to operate on multiple lines at once (adding tabs, commenting out etc)
gd- Go to definition
ctrl t- Go back a defintion (pop the ‘go to’ off the stack)
:FZF- search for file. Select a file in the list to open in new buffer
- Graphical cheat sheet - 2006 so dated but looks comprehensive and is often referenced.
- Devhints cheat sheet - this website has a bunch of great software engineering cheatsheets and cuts throught the rubbish.
You may find my .vimrc settings file here: https://github.com/oliverbenns/dotfiles/blob/master/.vimrc.
Plugins are installed in the setup script of that dotfiles repository.