RHCSA Rapid Track
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
vimtutorcommand.
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
sshcommand to log in to theserveramachine as thestudentuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$Run the
vimtutorcommand. Read the Welcome screen and perform Lesson 1.1.In the presentation, keyboard arrow keys help to navigate the window. Initially, when the
vieditor was developed, users could not rely on having arrow keys or working keyboard mappings for arrow keys to move the cursor. Therefore, thevieditor 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:
hangback,jumpdown,kickup,leapforward.[student@servera ~]$
vimtutorIn the
vimtutorwindow, 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
vimtutorwindow, 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
xkey for single-character deletion.In the
vimtutorwindow, perform Lesson 1.4.For most editing tasks, the
i(insert) key is pressed first.In the
vimtutorwindow, perform Lesson 1.5.The previous lecture taught only the
icommand 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
vimtutorwindow, perform Lesson 1.6.Type
:wqto save the file and quit the editor.In the
vimtutorwindow, read the Lesson 1 Summary.The
vimtutorcommand 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
workstationsystem as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$