IMX6ULL Development Board - Text Editing Tool
[Copy link]
Text editing (based on Xunwei-IMX6ULL Terminator development board) is the most commonly used tool. We can use Notepad or other more powerful text
editors such as UltraEdit in Windows. Ubuntu comes with a text editor by default: Gedit, which is a window interface editor
. Compared with the Gedit text editor, the most commonly used one is the command line editor: vim. The vim editor is
operated in terminal mode. The default Ubuntu system does not install vim. We can manually install the vim editor through the apt-get command. First,
we enter the "sudo apt-get install vim" command in the terminal and press Enter. During the installation process, we will be prompted whether to continue the installation. We
enter y to continue the installation. The installation process is shown in the figure below:
vim has three working states: command mode, insert mode, and bottom line mode. Different functions can be completed by switching different modes. Let
's learn how to use vim by editing a document as an example. First open the terminal and enter the command "sudo vi myfile", as shown below:
vim opens myfile. The file is first in command line mode. At this time, we cannot enter text in the terminal, so we need to switch to insert
mode. We can enter any of the following letters in the terminal to enter insert mode:
a //After the character where the cursor is currently located, switch to insert mode
i //Before the character where the cursor is currently located, switch to insert mode
o //Below the line where the cursor is currently located, create a new line and switch to insert mode
O //Above the line where the cursor is currently located, create a new line and switch to insert mode
s //Delete the character where the cursor is located
r //Replace the character where the cursor is located
The most common method we use is to enter the letter "a". When we press the "a" button on the keyboard in the above figure, we can see that there will be an "Insert
" prompt in the lower left corner of the terminal, indicating that the current mode is insert mode, as shown below:
After entering insert mode, we can enter text, as shown below:
After completing the text input, we need to save the text. First, press the "ESC" key on the keyboard to exit the current insert mode and return to the command line
mode, as shown in the figure below:
In the figure above, we can see that the "Insert" character in the lower left corner is gone, indicating that we are now in the command line mode. Then we
enter the ":" key (Shift+; combination key) in the terminal to enter the bottom line mode. We will see a ":" colon character in the lower left corner of the terminal
, as shown in the figure below:
In the bottom line mode in the figure above, the commonly used commands are as follows:
q Exit
w Save changes
q! Exit without saving changes
To save the text entered above, you can enter "wq" and then press Enter to save the document and exit vim, as shown in the figure below:
After exiting the vim text editor, we can use the cat command to view the contents of the myfile file we just created, as shown in the figure below:
As you can see from the above picture, the content in the myfile file is what we entered using the vim editor. So far, we have completely used the vim
text editor to create, edit, and save documents.
Sometimes we may need to use the keyword search function when editing files. The vim editor also provides a very convenient keyword search function.
Let's learn the keyword search function of vim. First, enter "vim myfile" to open the myfile file created earlier, as
shown in the following figure:
In the above figure, we opened the file myfile. At this time, vim is in command line mode. We enter the "/" character in the terminal to make vim enter the bottom board mode
, as shown in the following figure:
In the above figure, we enter the keyword to be searched when entering the bottom line mode. For example, we search for the keyword "topeet", as shown in the following figure
:
After entering the search keyword "topeet", we press the Enter key, and vim will search for the first position of the keyword in the file.
After searching, the cursor will be located at the position of the keyword, as shown in the following figure:
About vim We will introduce the basic operation here. Vim is very powerful. For more detailed information about the use of vim, you can go to the Internet to read
relevant information or documents.
For more information, please follow: Xunwei Electronics
|