Title: Vi Commands - Movement (navigating the cursor)
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

When in command mode, the 0 will bring you to the start of the current line, whereas the $ will put the cursor at the end of the current line. You can add 0 and $ to the d command. d0 will delete every character between the current character and the start of the line. Likewise d$ will delete everything from the current character till the end of the line. Similarly y0 and y$ will yank till start and end of the current line. (Source: Linux Fundamentals, Cobbaut, 149)

- ^ - Beginning of text (bot)
- $ - End of line
- 0 – Beginning of line (That's a zero)
- w – Beginning of next word
- e – End of current word or next word
- b – Beginning of current or previous word
- h – Cursor Left
- j – Cursor Down
- k – Cursor Up
- l – Cursor Right
- G – Go to end of file (eof)
- 12G – Go to line 12

Movement keys may be proceeded by a number. The action will then be repeated.

Combinations

When a movement command is preceded by a lowercase 'd', everything between the current position and the new position is deleted. Numbers can precede the 'd'.

- d$ - Delete to EOL
- 3dw – Delete to beginning of third word
- 12db – Delete back 12 words