Vim is a modal editor, featuring 4 modes:
-
normal
: Default mode for editing commands and fucking around.esc, Ctrl+[
,Ctrl+c
: Return to normal modeq:
: Show command historymotion
: Navigate within the fileh
: Move leftj
: Move downk
: Move upl
: Move rightw
: Next whitespaceb
: Previous whitespace_
: Beginning of the current line$
: End of the line0
: Start of the line
number motion
: Move a relative distance (e.g.,16k
)dd
: Delete lineu
: UndoCtrl+r
: Redoline search
:fc
: Jump forward to characterc
tc
: Jump to before characterc
Fc
: Jump backward to characterc
Tc
: Jump backward to before characterc
,
: Repeat last find backward;
: Repeat last find forward
command count motion
: Execute command over a count of motions, combine commands (e.g.,d4j
deletes 4 lines downward,d2w
deletes 2 words forward,db
deletes backward,d$
deletes after,dtc
deletes untilc
)
-
insert
: Mode for inserting text, typing shit.i
: Insert at cursorI
: Insert at the beginning of the linea
: Append after cursorA
: Append at end of lineo
: Open a new line belowO
: Open a new line above
-
visual
: Mode for selecting your spaghetti.v
: Start visual modeV
: Start linewise visual modey
: Copy selected textp
: Paste clipboard contents- Deleting, copying, pasting text moves it to the clipboard, effectively cutting the text due to sharing the same buffer
-
command
: Mode for executing extended commands and a way to forget about the mouse and use someone else's solution.:PlugClean
: Clean up plugins:PlugInstall
: Install plugins:VimtexCompile
: Compile LaTeX projects:help
: Open help:pbcopy
: Copy to clipboard:q!
: Quit without saving:q
: Quit:s
: Substitute:set clipboard=unnamedplus
: Use the system clipboard for copy/paste operations:set laststatus=2
: Always display the status line:set nospell
: Turn off spell checking:set number
: Show line numbers:set spell
: Turn on spell checking:syntax on
: Enable syntax highlighting if you are colorblind:w filename
: Save asfilename
:w
: Save changes