However, beginners sometimes don’t know how to move between the lines in the Vi editor, and they end up losing the data of the text files. So, in this quick guide, we will explain the different ways to move to the end of a line in Vi editor.
How to Move to the End of a Line in Vi Editor
There are a few commands that you can use to go to the end of a line in the Vi editor. However, you can only execute them in the “command” mode. Let’s divide this section into multiple parts to learn about those commands.
1. The “$” Key
The “$” in the Vi editor moves the cursor to the end. Go through the following steps to know its usage:
Open a file in the Vi editor and ensure that you’re in the “command” mode by pressing “ESC”. If you are in the “insert” mode, ESC will switch it to the “command” mode. Otherwise, it doesn’t affect anything.
Select the line whose end you want to locate. Then, make the dollar sign ($) by pressing the “Shift” and “4” keys.
Now, if you want to add a text at the end, press the “I” key which opens the “insert” mode.
2. The “Append” Command
The “append” text command in the Vi editor is used to add a text at the end. Open a file in “command” mode in the editor and then press the “Shift” and “A” keys.
3. The “E” Key
The “e” command in the Vi editor takes you to the end character of a word. However, you can use it to go to the end of a line. First, take the cursor to the desired line using the arrow keys. Then, press “e” repeatedly until you reach the end.
After that, you can press the “I” key to enter the “insert” mode to add more text at the end.
Conclusion
Vi editor’s command-driven environment might intimidate you at first, but it can significantly boost your productivity as you master the commands. You can perform all the text editor operations with the simple commands. After getting the correct information about moving to the end of a line in Vi editor, you can view, edit, or insert the text efficiently.