Vim has very detailed user manual which can be accessed from inside vim using :h user-manual. Following are some of my notes from reading a few chapters:

First steps usr_02.txt

  • J-delete a line break
  • U-undo all changes on last edited line

Moving around usr_03.txt

  • word - [a-zA-Z0-9_]+|[^a-zA-Z0-9_\s]+
  • WORD - \S+

The sentence e.g. I'll be there in 5 has 6 WORDs and 11 words:

>>> s="e.g. I'll be there in 5"
>>> W=re.findall(r"\S+",s);print(len(W),W)
6 ['e.g.', "I'll", 'be', 'there', 'in', '5']
>>> w=re.findall(r"[a-zA-Z0-9_]+|[^a-zA-Z0-9_\s]+",s);print(len(w),w)
11 ['e', '.', 'g', '.', 'I', "'", 'll', 'be', 'there', 'in', '5']
  • w/W-move forward to start of next word/WORD
  • b/B-move backward to start of previous word/WORD
  • e/E-move forward to end of next word/WORD
  • ge/gE-move backward to end of previous word/WORD

  • f{char}/F{char}-find next/previous {char} in current line.
  • repeat these commands in forward/backward direction using ; and ,

  • move to matching parenthesis using %

  • move to line no. using {lineNo}G
  • move to current view’s Home/Middle/Last using H/M/L

  • zt/zz/zb-put the cursor line at the top/middle/bottom.

  • search for word under cursor using *

  • “mark” a place using m[a-z].
  • goto a “mark” using `mark or to the start of the line containing the mark using 'mark
  • special marks:
    • ' - cursor position before jump
    • " - cursor position when last editing the file
    • [/] - start/end of last change.

Making small changes usr_04.txt

  • operator-motion pattern - type a operator command followed by a motion command on which the operator works.
  • delete operators:
    • d - delete
    • c - change (same as delete except it leaves you in insert mode)
  • shortcuts
    • x = dl - delete character under cursor
    • X = dh - delete character left of the cursor
    • D = d$ - delete to EOL
    • C = c$ - change to EOL
    • s = cl - change one char
    • S = cc - change line
  • use r to replace character under cursor