2024-07-01

Vim Learnings

Scripts:

  • Echoing Messages :: :ec or :echo prints out the message, example :ec "hello world"
  • Persistent Echoing:: :echom "<message>" or :echomsg "<message>", stores these messages in the message history
  • Help :: :help <commandname>

Keybinding:

  • Keybinding x: deletes the character next to the cursor
  • Deletion: dd: deletes the entire line
  • Deletes a word: dw, from the cursor until the space is found
  • Deletes characters till EOL: d$ deletes characters from the right of the cursor to the End of the Line

Deletion on Operators and motions: takes the form of d motion

list of motions: w: until the start of next word, excluding the first character e: to the end of the current word, including the last character $: to the end of the line

In case of deletion with motions: dw: deletes the word until the start of next word de: deletes until end of the current word d$: deletes until end of line

Count with motion: 2w: moves the cursor two words forward 4e: moves the cursor 4 words to the end of fourth word forward.

Deletion with count and motion: d2w: deletes two words until the start of the next word d2e: deletes two words until the last character of the second character

Lines: dd: deletes the entire line d2d: count with deletion of two lines

Undo & Redo u: Undoing the latest change CTRL+R: Redoing the latest change

Vim Learning Resources [1] https://learnvimscriptthehardway.stevelosh.com/ [2] https://vim-adventures.com/ [3] vimtutor