Navigation in VI
1. Moving the Cursor:
In Normal Mode, you can move the cursor using the arrow keys or the h, j, k, and l keys, which correspond to left, down, up, and right, respectively.
2. Jumping to the Beginning or End of the Line:
Use 0 to go to the beginning of a line and $ to jump to the end.
# In Normal Mode, '0' takes you to the start, and '$' to the end.
This is the start of the line. $ This is the end of the line.
3. Jumping to Specific Lines:
To move to a particular line, type :n, where n is the line number.
# In Normal Mode, ':n' takes you to line number 'n'.
This is line 1.
This is line 2.
This is line 3.
To go to line 2, you’d type :2 and press Enter.
Basic vi Commands
Text editors are essential tools for any programmer or computer enthusiast. One popular text editor that has been around for decades and is still widely used is vi (pronounced “vee-eye”). vi is a terminal-based text editor that offers powerful editing capabilities once you understand its basic commands.
In this article, we will explore the fundamental vi commands that will help you navigate, edit, and save your text files efficiently. Whether you’re a beginner or an experienced user looking to refresh your knowledge, this guide will provide you with a solid foundation in using vi.