This is a document about me learning VIM Key bindings as I try them out in Obsidian.
Nouns (source):
h
leftj
downk
upl
right- … (directions in navigation)
- word: anything composed of
a-zA-Z0-9
- WORD: anything but spaces (space, tab, EOL)
Navigation:
h
character leftj
character downk
character up14k
14 lines up
l
character rightw
forward one word (beginning)W
forward one WORD (anything but space)b
back one word (beginning)B
back one WORD (beginning)e
forward one word (end)E
forward to next WORD (end)$
end of line0
beginning of linegg
beginning of documentG
end of document15G
go to line 15 in document
H
top of screenM
middle of screenL
? bottom of screenfx
search for x in current line (single character)F
same but backwardstx
search for x in current line (single character) but select previousT
same but backwards(
previous sentence)
next sentence}
next paragraph{
previous paragraph
Editing:
i
insert mode: insert at the beginning of cursora
insert mode: append at the next characterI
insert mode: insert at the beginning of the lineA
insert mode: append at the end of the lineo
insert mode: insert into new line after current oneO
insert mode: insert into new line prior to the current onedd
delete entire liner
replace characterx
delete character`v
start selectiongU
change selection to uppercasegu
change selection to lowercasecc
delete line and enter edit mode (replace line)s
delete selection and enter edit mode (replace selection)y
“yank” text (copy, view mode)2yy
copy two lines
p
paste (view mode)>>
indent2>>
indent two lines
<<
de-indent/
enter search moden
get next search resultN
get previous search result
Mixing editing verbs and nouns:
y$
yank until the end of lined2w
delete two words forwardc}
change everything from current location to end of paragraph
Text objects delimiters:
i + delimiter
: inner text object (anything inside the group)di(
deletes text inside the parenthesisda{
deletes everything contained in braces
a + delimiter
: outer text object (group and delimiters)w
wordsp
paragraphs
sentence(
or)
parenthesized text{
or}
text between braces[
or]
text between brackets<
or>
text between angled bracketst
XML tags (applies to HTML too)"
text in double quotes'
text in single quotes`
text in backticks
Mixing with previous:
gUiw
uppercase current word
Commands:
:%s/a/b/g
substitute all instances of “a” for “b”:%s/a/b/gc
substitute all instances “a” for “b”, but ask for confirmation
Sources:
- How to use VIM Bindings in Obsidian | Beginners Guide, Antone Heyward
- Learn-Vim