Vim

Love it or hate it, most distros have it installed. It's best to know at least how to edit files, and exit. Knowing how to exit vi is one of life's greatest mysteries.

Not much here yet...please feel free to contribute at my GitHub page.

Basic Commands

All commands must be run from Command Mode (unless otherwise specified).

Command

Description

[ESC]

Return to Command Mode.

i

Enter insert (normal text edit) mode.

x

Delete a character. Type a number first to delete that many characters.

dd

Delete a whole line. Type a number first to delete that many lines.

yy

Yank (copy) a whole line. Type a number first to yank that many lines.

p

Put (paste) contents of clipboard.

How to exit Vim

No really, exiting vi, vim, etc. is quite simple. [esc] :q! will get you out every time, most of the time. Learning why or why not...takes a little bit longer.

If you need to save any changes you made to a file use [esc] :w or [esc] :wq to save changes and exit.

To clarify, that's the escape key, then colon w to write changes, or colon wq to write and quit.

If you need to exit without making changes (for example when you open a read-only file by accident) type [esc] :q!

Misc

If you like this content and would like to see more, please consider buying me a coffee!

Last updated