Skip to content

Instantly share code, notes, and snippets.

@haxpor
Created October 17, 2018 14:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save haxpor/e559a652480b5094353f5dad3f165dba to your computer and use it in GitHub Desktop.
Save haxpor/e559a652480b5094353f5dad3f165dba to your computer and use it in GitHub Desktop.
Note from Mastering Vim Language By Chris Toomey without plugins section at around 12 minutes at the end
* dw - delete word
* . - to repeat changes
* u - undo changes (atomic operation)
* verbs in vim
- d => delete
- c => change
- > => indent
- v => visually select
- y => yank (copy)
* cw - delete and get into insert mode
* >j - to indect the current line and the line below
* yw - to yank a word
* p - to paste from what we have in copied
* nouns in vim -- motions
- w => word (forward by a "word")
- b => back (back by a "word")
- 2j => down 2 lines
* nouns in vim -- text objects
- iw => "inner word" (works from anywhere in a word)
- it => "inner tag" (the contents of an HTML tag)
- i" => "inner quotes"
- ip => "inner paragraph"
- as => "a sentense"
* diw - delete the word that i'm on
* di' - delete whole thing inside ''
* di[ - delete whole thing inside []
* dip - delete a paragraph
* ciw - change inner word
* . - to repeat
* cit - change inner tag
* . - to repeat (even at the bracket, or at <ul>)
* nouns in vim - parameterized text objects
note: 2nd column is for backward direction
* f, F => "find" the next character
* t, T => "find" the next character (not include search character)
* /, ? => Search (up to the next match)
* ctL - replace up to next L character
* ct' - replace up to next '
* c/other - replace up to search 'other'
* combinatorics of commands
5 operators * 10 motions
+ 5 operators * 10 text objects
+ 5 operators * 35 characters * 4 (for 'f', 'F', 't', 'T')
+ 5 operators * ~100 (for /)
= around 2000 commands from memorable 30 keys
* set relativenumber - show relative number of lines in file
* c6j - change up to the next 6 lines
* Visual mode is a smell
* Don't use two sentences where one will due
* Breaks repeatability
* viw - select word in visual mode
* . - it cannot repeat, different operation for visual mode
* V - to select whole line including newline character in visual mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment