9. Text Editor - A Powerful Linux Text Editor's Basic Usage
Contents
Vim Text editor can efficiently help us quickly create or modify some common text type files, such as configuration files:
![img](../images/9/man_vim.png)
Check vim's definition and usage
Create File
|
|
![img](../images/9/vim_new.png)
Create a new file
Command Mode
Vim opens a file in command mode:
![img](../images/9/vim_new_ran.png)
Command mode
Help
We can view the command-related help by the :help command:
|
|
![img](../images/9/command_mode_help.png)
Before pressing the Enter key
![img](../images/9/command_mode_help_after.png)
After pressing the Enter key
To go back to command mode, just type :q and press Enter:
|
|
Insert Mode
We can press the letter i on the keyboard to enter to insert mode:
![img](../images/9/enter_to_insert_mode.png)
This is shown at the left bottom of the screen
Let’s write something:
![img](../images/9/insert_mode_typing.png)
We have wrote something in the insert mode
We can press the ESC key to go back to command mode:
![img](../images/9/back_to_command_mode.png)
The -- Insert -- text shown at the left bottom of the screen has gone
Command Mode Operations
We can do a lot of things in command mode, such as searching, undo changes, save, exit files, and other more advanced uses.
Save
We can type the :w command in command mode and press enter to save the file:
|
|
![img](../images/9/command_mode_save.png)
Before pressing the Enter key
After we save the command, we can see some basic information about the file at the bottom: of the screen
![img](../images/9/command_mode_save_after.png)
After pressing the Enter key
Exit
If we have saved the written content, we can exit vim by :q command and press Enter:
|
|
![img](../images/9/command_mode_exit.png)
Before pressing the Enter key
Edit File
Opening a file is almost the same as creating a file:
![img](../images/9/vim_edit.png)
Edit an existing file
The difference between an existing file and a new file is the basic information at the bottom of the screen after the file is opened, the existing file has the basic information, and the new file has nothing:
![img](../images/9/vim_edit_ran.png)
After opening an existing file
Author Dong Chen
LastMod Sun Feb 10 2019