vim is a modal editor (improving on vi). It can run without graphics, is ubiquitous, powerful, and efficient but is an acquired skill.
MIT's “missing semester” has an excellent summary of vim functions video and notes. Vim’s design is based on the idea that a lot of programmer time is spent reading, navigating, and making small edits, as opposed to writing long streams of text. For this reason, Vim has multiple operating modes.
vimtutor is a program included with vim that will guide you through usage – run it from the command line.vim $filename → opens a file in vim. If that file doesn't exist or you opened it in the wrong filepath, you will see an empty blank vim that says [NEW] at the bottomesc → gets you out of insert mode:set nu shows you line numbersmove around
0 or Home puts your cursor to the beginning of the line (in command mode)$ or End puts your cursor to the end of the line (in command mode)Shift + i puts your cursor to the beginning of the line and opens insert modeShift + a puts your cursor to the end of the line and opens insert modeo opens insert mode on a new line below your cursorg then up or down arrowu undo last change (in command mode)Copy and paste
v to put you in visual modedypclose vim temporarily
Ctrl + z puts the vim window to “sleep” and brings you back to the terminalfg brings you from the terminal back into the last script in vim you were working onexit
:q → quits vim:wq → saves what you wrote and quits vim :q! → does not save what you wrote and quits vim