Linux system Vi and Vim editors - Note 7

The difference between Vi and Vim

All Unix Like systems will have a built-in vi text editor, and other text editors (gedit) may not exist. Because there are too many commands on Linux that use vi as the data editing interface by default, so you must, must learn vi, otherwise you will not be able to operate many commands at all!

vim can be regarded as an advanced version of vi. Simply put, vi is an old-fashioned word processor, but the functions are already very complete, but there is still room for improvement. Vim can be said to be a very useful tool for program developers. Even the official website of vim (http://www.vim.org) itself says that vim is a "program development tool" rather than a word processing software .

In fact, you can regard vim as an advanced version of vi. Vim can display some special information with colors or underlines. For example, when you use vim to edit a file in C programming language, or the shell script script program we will talk about later, vim will judge the content of the file based on the file extension or the beginning information in the file And automatically call the syntax judgment formula of the program, and then display the program code and general information in color.

Some problems encountered in using vi

1) The vi editor does not display the current status.
When I first started to use vi to write code, I found that after pressing the i key, although it can be edited normally, the bottom left does not display --INSERT--.
After searching for a long time, I found that the vim installed by default on ubuntu was not fully installed. However, you can also set the following settings yourself, without affecting the basic use.

Solution
In normal mode, press ':' to enter command line mode. Just type it in set showmode.

Or follow vim.

2) After editing the file in vim, if you want to exit and save, a prompt appears: E45: 'readonly' option is set (add ! to override). There are two ways to solve this error:

The first method: If you have root authority, you can enter: wq! Forced to save and exit.
The second method: press ESC, enter : set noreadonly, enter : wqto save and exit.

Guess you like

Origin blog.csdn.net/wokaowokaowokao12345/article/details/127621178