In windows, the default mode is gb encoding, while in vim mode, the default mode is UTF-8 (gedit is also UTF-8 by default. Modified the configuration file so that vi supports the gb encoding.
$ Vi ~ /. Vimrc
Let & termencoding = & encoding
Set fileencodings = UTF-8, gbk
$: Wq
Open vi again, and the display will be normal.
References:
========================================================== ================
When you use vim to edit a terminal, by default, the editing interface does not display line numbers, syntax High Brightness Display, smart indentation, and other functions. To better work in vim, You need to manually set a configuration file:. vimrc.
When vim is started. the vimrc file is automatically read, which can contain some settings or even scripts. the vimrc file is easy to create in the root directory of the current user, that is, the command to create is:
$ Vi ~ /. Vimrc
After setting
$: X or $ wq
Save and exit.
The following example shows the frequently used settings. For detailed settings, see references:
"Comments rows starting with double quotation marks, the same below
"Remove the annoying vi consistency mode and avoid bugs and limitations in earlier versions.
Set nocompatible
"Show row number
Set nummber
"Detection file type
Filetype on
"Records the number of historical rows
Set history = 1000
"Black is used for background
Set background = dark
"Syntax High Brightness Display
Syntax on
"The following two lines are useful in the format when writing code;
"In the first line, vim uses automatic start, that is, to apply the format of the current row to the next line;
"The second line, based on the preceding setup format, intelligently selects the setup method.
"Writing is very useful.
Set autoindent
Set smartindent
"The tab key of the first line is set to 4 spaces, and the second line is set to use 4 spaces when lines are staggered.
Set tabstop = 4
Set shiftwidth = 4
"Set the matching mode, similar to the right brace that will be matched when a left brace is entered.
Set showmatch
"Remove toolbar from vim's GUI version
Set guioptions-= T
"When vim is being edited, if a command error occurs, a sound will be triggered. This setting removes the sound.
Set vb t_vb =
"The status line at the cursor position is displayed in the lower right corner during editing.
Set ruler
"By default, matching is displayed in High Brightness. This setting turns off the highlighted display.
Set nohls
"It is very convenient to query. To search for the book word, when/B is entered, the first
"A word starting with B. When it is input to/bo, it will automatically find the word starting with the first bo, according
"And so on, you can use this setting to quickly find the answer.
"Don't forget to press ENTER
Set incsearch
"After a file is modified, it is automatically backed up. The backup file name is added to the original file name." ~ "Suffix
If has ("vms ")
Set nobackup
Else
Set backup
Endif
After the annotation is removed, a complete. vimrc configuration is as follows:
Set nocompatible
Set nummber
Filetype on
Set history = 1000
Set background = dark
Syntax on
Set autoindent
Set smartindent
Set tabstop = 4
Set shiftwidth = 4
Set showmatch
Set guioptions-= T
Set vb t_vb =
Set ruler
Set nohls
Set incsearch
If has ("vms ")
Set nobackup
Else
Set backup
Endif
If the function does not work after setting, check whether the vim-enhanced package is installed in the system. The query command is:
$ Rpm-q vim-enhanced
Questions about vi segmentation in UTF8 text mode
Many hosts now use UTF8 to connect to the environment.
At this time, when we got to the host and read a text file titled Big5
When you use vi, you may be overwhelmed.
Then you may begin to think about whether to change the hosts system.
Of course, it would be normal to change the coding system, but at the same time it also lost some UTF8 points.
But it cannot be changed and then re-opened. After the login is completed, the case will be changed back to UTF8 and then re-opened.
This is too tired!
Before resolving a problem, I 'd like to know a little about it,
Linux allows users to use different operating systems, instead of using the system.
That is to say, every user who does not have to worry about it can have its own attention series.
So we can solve this problem as long as we repair a case.
I want to repair the hidden parts under my eyes.
Vi. bashrc
Join this line
Export LANG = en_US
Log out and then log in.
But it usually takes some time for me to change it. After use, it will be changed again!
Avoid changing the UFT8 shopping spree case to "shopping spree" that day!