Skip to content

Instantly share code, notes, and snippets.

@0ex-d
Created January 31, 2022 04:05
Show Gist options
  • Save 0ex-d/7b8fea9a18fd938f2035c691cdce9389 to your computer and use it in GitHub Desktop.
Save 0ex-d/7b8fea9a18fd938f2035c691cdce9389 to your computer and use it in GitHub Desktop.
Vim easy command mappings

(Vi)m Commands

By David Akin

Create and open a new file

vim file.txt

Vim Modes:

Vim has 3 main modes: NORMAL, INSERT and VISUAL. The most you’ll be using are NORMAL and INSERT.

Key bindings

Switch to insert mode

Press the i key

Switch to normal mode

Press the esc key

Key combo

To switch to commands/combo mode i.e the : below the vim editor Press the Ctrl+C key

Save

Type :w or ZZ

Save in root/admin mode :w !sudo tee %

Save all opened buffer wa

Save and quit

Type :wq

Exit w/o save ZQ

Quit Type :q

Force quit Type :q!

Read another file data or system output into the buffer

:r file1.txt
:r !ls
:r !date

Navigation

h         left
l         right
j         down
k         up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment