Understanding V I Modes
V I operates in two modes: command mode (for executing commands) and insert mode (for typing text).
To switch to insert mode, press 'i', and to return to command mode, press 'Escape'.
Basic Commands for File Management
To save a file, use 'Shift + ZZ' or type ':wq!' and hit 'Enter'.
To delete text, use 'x' to remove a character or 'dd' to delete an entire line.
Editing and Navigating Text
Use arrow keys to navigate in command mode, but not in insert mode.
To replace text, switch to command mode and use 'r' followed by the new character.
Searching and Undoing Changes
To search for a word, use '/' followed by the word and hit 'Enter'.
To undo the last action, press 'u' in command mode.
Practice and Familiarization
It's encouraged to practice using V I by creating and editing various files to become proficient with its commands.
Here's a practice example to help you get familiar with using the V I text editor in Linux:
Task: Create and Edit a Simple Text File
Open the Terminal:
Type vi my_practice_file.txt and press Enter.
vi my_practice_file.txt
Enter
Enter Insert Mode:
Press i to switch to insert mode.
i
Type Some Text:
Write the following text:
This is my practice file. I am learning to use V I. Let's edit this file together!
Save and Exit:
Press Escape to return to command mode.
Escape
Type :wq and press Enter to save and exit.
:wq
Reopen the File:
Edit the Text:
Move the cursor to the line "I am learning to use V I."
Press r and then type Vim to replace "V I" with "Vim".
r
Vim
Delete a Line:
Move to the line "Let's edit this file together!" and press dd to delete it.
dd
Undo the Deletion:
Press u to undo the last action and restore the deleted line.
u
Search for a Word:
Press / and type practice then press Enter to find the word "practice".
/
practice
Save and Exit Again:
Press Escape, type :wq, and press Enter.
Zuletzt geändertvor einem Monat