In this exercise, you use the vimtutor command to practice basic editing techniques in the vim editor.
Outcomes
Edit files with Vim.
Gain competency in Vim by using the vimtutor command.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start edit-editfile
Instructions
Use the ssh command to log in to the servera machine as the student user.
[student@workstation ~]$ ssh student@servera
...output omitted...
[student@servera ~]$Run the vimtutor command. Read the Welcome screen and perform Lesson 1.1.
In the presentation, keyboard arrow keys help to navigate the window.
Initially, when the vi editor was developed, users could not rely on having arrow keys or working keyboard mappings for arrow keys to move the cursor.
Therefore, the vi editor was initially designed to move the cursor by using commands with standard character keys, such as the conveniently grouped h, j, k, and l.
Here is a way to remember them:
hang
back, jump
down, kick
up, leap
forward.
[student@servera ~]$ vimtutorIn the vimtutor window, perform Lesson 1.2.
This lesson teaches how to quit without keeping unwanted changes. All changes are lost. Sometimes it is preferable to lose changes than to leave a critical file in an incorrect state.
In the vimtutor window, perform Lesson 1.3.
Vim has fast, efficient keystrokes to delete an exact number of words, lines, sentences, or paragraphs.
Any editing is possible with the x key for single-character deletion.
In the vimtutor window, perform Lesson 1.4.
For most editing tasks, the i (insert) key is pressed first.
In the vimtutor window, perform Lesson 1.5.
The previous lecture taught only the i command to enter edit mode.
This lesson demonstrates other available keystrokes to change the cursor placement in insert mode.
In insert mode, all typed text changes the file content.
In the vimtutor window, perform Lesson 1.6.
Type :wq to save the file and quit the editor.
In the vimtutor window, read the Lesson 1 Summary.
The vimtutor command includes six more multistep lessons.
These lessons are not assigned as part of this course, but feel free to explore them to learn more.
Return to the workstation system as the student user.
[student@servera ~]$ exit
logout
Connection to servera closed.
[student@workstation ~]$This concludes the section.