Run the following command to configure Vim in Ubuntu and display different colors: sudoapt-getinstallvim: Step 2. Change the vim configuration file etc/vim: (1) cd/etc/vim (2) sudogeditvimrc (1) enter/etc/v
Configure Vim in Ubuntu and display different colors in different syntaxes
Step 1. install the vim command: sudo apt-get install vim
Step 2: Change the vim configuration file etc/vim command to: (1) cd/etc/vim (2) sudo gedit vimrc
(1) enter the/etc/vim directory. (2) Open the vimrc File
Step 3: Insert the following content in a line anywhere in vimrc
Syntax on
Set tabstop = 4
Set shiftwidth = 4
Set autoindent
Set cindent
Set cinoptions = {s, t0, N-2, p2s, (03 s, =. 5 s,> 1 s, = 1 s,: 1 s
Set nu
Set softtabstop = 4
Step 4: Save the file and it will end. Then open the. c file with vim, And the highlighted file and different syntax colors will be displayed.
/* Explain the meaning of the content set above */
Syntax on // set syntax highlighting
Set tabstop = 4 // set the tab width to 4
Set softtabstop = 4 // set the soft tab width to 4
Set shiftwidth = 4 // set the number of indented spaces to 4
Set autoindent // set Automatic indent
Set cindent // set the automatic indent mode in C/C ++ Language
Set nu // display the line number of the text on the left
Configuration file:
After successful configuration and preview:
Recommended reading:
Vim Learning Guide http://www.linuxidc.com/Linux/2013-08/89096.htm
Quick learn Vi editor http://www.linuxidc.com/Linux/2013-08/88586.htm
Powerful Vim editor http://www.linuxidc.com/Linux/2013-07/87544.htm
Build a Vim Development Environment http://www.linuxidc.com/Linux/2013-07/87363.htm on CentOS 6.2
Vim 7.4a release, new and faster http://www.linuxidc.com/Linux/2013-07/87035.htm for regular expression Engines
CentOS 5.4 installation highlighted Vim editing tool http://www.linuxidc.com/Linux/2013-06/86508.htm
Vim tips: C language http://www.linuxidc.com/Linux/2012-12/77124.htm settings
Set Vim row http://www.linuxidc.com/Linux/2012-12/75485.htm in Ubuntu
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2