Skip to content

Instantly share code, notes, and snippets.

@AmirAli-AZ
Last active March 1, 2023 01:10
Show Gist options
  • Save AmirAli-AZ/c5211d5abd69f3bf808a78033061d18b to your computer and use it in GitHub Desktop.
Save AmirAli-AZ/c5211d5abd69f3bf808a78033061d18b to your computer and use it in GitHub Desktop.
my vim notes
# vim modes
defualt mode: normal mode
i -> insert mode (inserting the text)
v -> visual mode (selecting the text)
esc -> exit the mode (back to normal mode)
# vim commands
:q -> quit
:q! -> quit without saving
:w -> save
:wq -> save and quit
:edit <file name> -> edit the file
:!<command> -> run unix commamd from vim
:term -> open terminal
# vim shortcuts
# preferred to use in:
# 1: normal mode
# 2: visual mode
y -> copy selected text (2)
yy -> copy current line (1)
p -> paste (1)
shift + insert -> paste from clipboard (1)
0 -> jump to first character of current line (1, 2)
$ -> jump to last character of current line (1, 2)
w -> forward by word (1, 2)
b -> back by word (1, 2)
e -> forward to end by word (1, 2)
d -> delete/cut (2)
dw -> delete/cut a word (1)
dd -> delete/cut current line (1)
n + dd -> delete from current line to n line (1)
gg -> jump to first line (1, 2)
shift + g -> jump to last line (1, 2)
u -> undo (1)
ctrl + r -> redo (1)
n + shift + g -> jump to n line (1)
x -> delete a character or selected text (1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment