How to install the highlighted vim editing tool in CentOS

Source: Internet
Author: User
This article mainly introduces how to install the highlighted vim editing tool in the CentOS system. For more information, see CentOS.

After Centos is installed, the VI editor is installed by default and VIM is not installed. Therefore, when using vim test.txt, the prompt vim command not found is displayed... This shows that the vim editor is not installed in our Linux environment. let's take a look at how to install the editor:

Install three packages in the vim editor.:

vim-enhanced-7.0.109-7.el5 vim-minimal-7.0.109-7.el5 Vim-common-7.0.109-7.el5

1. check your local package and check whether your VIM has been installed:
Enter the rpm-qa | grep vim command. if vim has been correctly installed, the names of the preceding three packages are displayed.
2. if one of them is missing, for example, the vim-enhanced package is missing, run the: yum-y install vim-enhanced command, which automatically downloads and installs the package.
3. if none of the above three packages is displayed, enter the following command:
Yum-y install vim *
After the installation is completed, you can use the vim editor.







 

Generally, the reason we choose the VIM editor is that it provides some convenient functions for our work. we can regard vim as a variant of vi, of course, we use vim as a code compiler. whether it is a C or Shell script, it provides highlighted display to facilitate the compilation and error detection.

Generally:

There are two ways to set up the vim editing environment:

One is to set in/etc/vimrc. this setting method works with all users logging on to the Linux environment. we generally do not advocate this method, because Linux is a multi-user, and everyone has their own programming habits and environment, we advocate the following setting method.

Another type is: User login ~ Create a. vimrc file under the Directory, and set the programming environment in which you are used to, so that other users do not affect each other.

Specific method:

cd ~

touch .vimrc

vim .vimrc

In the file, enter:

Set nu // This is the set display line number

Set showmode // set to display the current mode at the bottom of the command line interface.

Set rrows // display the number of rows and other information of the cursor in the lower right corner.

Set autoindent // set that the starting character of the previous line is aligned when the cursor moves to the next line after you click Enter each time.

Syntax on // sets the syntax Check. when you edit a C or Shell script, the keywords are displayed in a special color.

.........

[ESC]

Wq

Set: The running result is as follows:

The steps for installing the highlighted vim editing tool in CentOS 5.4 are very simple. for Linux experts, please ignore this article. just a few lines of command !!

[Root @ localhost ~] # Yum install vim -*

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* Addons: mirrors.ta139.com
* Base: mirrors.ta139.com
* Extras: mirrors.ta139.com
* Updates: mirrors.ta139.com
Addons | 1.9 kB: 00
Base | 1.1 kB
Extras | 2.1 kB: 00
Updates | 1.9 kB: 00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vim-X11.i386. 0.109-7.2.el5 set to be updated
---> Package vim-common.i386. 0.109-7.2.el5 set to be updated
---> Package vim-enhanced.i386. 0.109-7.2.el5 set to be updated
---> Package vim-minimal.i386. 0.109-7.2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================== ==========================================================
Package Arch Version Repository Size
========================================================== ==========================================================
Installing:
Vim-X11 i386. 0.109-7.2.el5 base 1.4 M
Vim-common i386. 0.109-7.2.el5 base 6.4 M
Vim-enhanced i386. 0.109-7.2.el5 base 1.2 M
Updating:
Vim-minimal i386. 0.109-7.2.el5 base 310 k

Transaction Summary
========================================================== ========================================================
Install 3 Package (s)
Update 1 Package (s)
Remove 0 Package (s)
Total download size: 9.4 M
Is this OK [y/N]: y
Downloading Packages:
(1/4): vim-minimal-7.0.109-7.2.el5.i386.rpm | 310 kB
(2/4): vim-enhanced-7.0.109-7.2.el5.i386.rpm | 1.2 MB
(3/4): vim-X11-7.0.109-7.2.el5.i386.rpm | 1.4 MB
(4/4): vim-common-7.0.109-7.2.el5.i386.rpm | 6.4 MB
-------------------------------------------------------------------------------
Total 130 kB/s | 9.4 MB
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vim-common 1/5
Installing: vim-X11 2/5
Installing: vim-enhanced 3/5
Updating: vim-minimal 4/5
Cleanup: vim-minimal 5/5
Installed:
Vim-X11.i386. 0.109-7.2.el5 vim-common.i386. 0.109-7.2.el5 vim-enhanced.i386. 0.109-7.2.el5
Updated:
Vim-minimal.i386. 0.109-7.2.el5
Complete!
[Root @ localhost ~] # Which vi
/Bin/vi
[Root @ localhost ~] # Which vim
/Usr/bin/vim
[Root @ localhost ~] # Rm/bin/vi
Rm: remove regular file '/bin/VI '? Y
[Root @ localhost ~] # Ln-s/usr/bin/vim/bin/vi
[Root @ localhost ~] # Which vi
/Bin/vi
[Root @ localhost ~] # Ls-l/bin/vi
Lrwxrwxrwx 1 root 12 Jan 18 0:22/bin/vi->/usr/bin/vim

If you need more in-depth requirements, directly modify the/etc/vimrc configuration file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.