This is a document about me learning VIM Key bindings as I try them out in Obsidian.
Nouns (source):
hleftjdownkuplright- … (directions in navigation)
- word: anything composed of
a-zA-Z0-9 - WORD: anything but spaces (space, tab, EOL)
Navigation:
hcharacter leftjcharacter downkcharacter up14k14 lines up
lcharacter rightwforward one word (beginning)Wforward one WORD (anything but space)bback one word (beginning)Bback one WORD (beginning)eforward one word (end)Eforward to next WORD (end)$end of line0beginning of lineggbeginning of documentGend of document15Ggo to line 15 in document
Htop of screenMmiddle of screenL? bottom of screenfxsearch for x in current line (single character)Fsame but backwardstxsearch for x in current line (single character) but select previousTsame but backwards(previous sentence)next sentence}next paragraph{previous paragraph
Editing:
iinsert mode: insert at the beginning of cursorainsert mode: append at the next characterIinsert mode: insert at the beginning of the lineAinsert mode: append at the end of the lineoinsert mode: insert into new line after current oneOinsert mode: insert into new line prior to the current onedddelete entire linerreplace characterxdelete character`vstart selectiongUchange selection to uppercaseguchange selection to lowercaseccdelete line and enter edit mode (replace line)sdelete selection and enter edit mode (replace selection)y“yank” text (copy, view mode)2yycopy two lines
ppaste (view mode)>>indent2>>indent two lines
<<de-indent/enter search modenget next search resultNget previous search result
Mixing editing verbs and nouns:
y$yank until the end of lined2wdelete 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)wwordspparagraphssentence(or)parenthesized text{or}text between braces[or]text between brackets<or>text between angled bracketstXML tags (applies to HTML too)"text in double quotes'text in single quotes`text in backticks
Mixing with previous:
gUiwuppercase current word
Commands:
:%s/a/b/gsubstitute all instances of “a” for “b”:%s/a/b/gcsubstitute all instances “a” for “b”, but ask for confirmation
Sources:
- How to use VIM Bindings in Obsidian | Beginners Guide, Antone Heyward
- Learn-Vim