Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install highlight vim Editing tool in CentOS system

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install the highlight vim editing tool in the CentOS system". In the daily operation, I believe that many people have doubts about how to install the highlight vim editing tool in the CentOS system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the question of "how to install the highlight vim editing tool in the CentOS system". Next, please follow the editor to study!

After we have installed Centos, it defaults to installing the VI editor, but VIM is not installed, so we will prompt: vim command not found when we use vim test.txt. This means that our Linux environment does not have a vim editor installed, so let's talk about how to install this editor:

The vim editor requires three packages to be installed:

Vim-enhanced-7.0.109-7.el5

Vim-minimal-7.0.109-7.el5

Vim-common-7.0.109-7.el5

1. Check the packages that already exist on your computer and make sure that your VIM is installed:

Enter the command rpm-qa | grep vim to show the names of the above three packages if vim has been installed correctly

two。 If one of them is missing, for example, the vim-enhanced package is missing, execute the command: yum-y install vim-enhanced, and it will download and install automatically.

3. If none of the above three packages is displayed, enter the command directly:

Yum-y install vim*

It can be installed automatically, and when it is finished, you can use the vim editor.

Usually: we choose the VIM editor because it can provide some very convenient features to facilitate our work, we can think of vim as a variant of vi, of course, we are more of a code compiler, whether C, or Shell scripts, it provides highlighting, convenient for us to write and error detection.

Usually:

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

One is to set it in / etc/vimrc, which works for all users who log in to the Linux environment. In general, we do not recommend this method, because Linux is multi-user, and everyone has their own programming habits and environment, so we advocate the following setting method.

The other is to create a .vimrc file in the directory where the user is logged in, in which you are accustomed to setting the programming environment, so that it does not affect each other when other users use it.

Specific methods:

Cd ~

Touch .vimrc

Vim .vimrc

Enter in the file:

Set nu / / this is to set the display line number

Set showmode / / sets to display the current mode at the bottom of the command line interface, etc.

Set ruler / / displays information such as the number of lines where the cursor is located in the lower right corner.

Set autoindent / / sets the cursor to align with the starting character of the previous line when the cursor moves to the next line after each click on enter

Syntax on / / sets syntax detection. When editing C or Shell scripts, keywords are displayed in a special color.

.

[ESC]

Wq

Setup completed: run result for example:

CentOS 5.4 installation of highlight vim editing tools is very simple, Linux master please ignore this article, a few lines of command done!

[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:00

Base | 1.1 kB 00:00

Extras | 2.1 kB 00:00

Updates | 1.9 kB 00:00

Setting up Install Process

Resolving Dependencies

-> Running transaction check

-> Package vim-X11.i386 2 7.0.109-7.2.el5 set to be updated

-> Package vim-common.i386 2 7.0.109-7.2.el5 set to be updated

-> Package vim-enhanced.i386 2 7.0.109-7.2.el5 set to be updated

-> Package vim-minimal.i386 2 7.0.109-7.2.el5 set to be updated

-> Finished Dependency Resolution

Dependencies Resolved

=

Package Arch Version Repository Size

=

Installing:

Vim-X11 i386 2VR 7.0.109-7.2.el5 base 1.4m

Vim-common i386 2VR 7.0.109-7.2.el5 base 6.4m

Vim-enhanced i386 2VR 7.0.109-7.2.el5 base 1.2m

Updating:

Vim-minimal i386 2VR 7.0.109-7.2.el5 base 310k

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:

(1ap4): vim-minimal-7.0.109-7.2.el5.i386.rpm | 310 kB 00:00

(2cap 4): vim-enhanced-7.0.109-7.2.el5.i386.rpm | 1.2 MB 00:06

(3go 4): vim-X11-7.0.109-7.2.el5.i386.rpm | 1.4 MB 00:09

(4ax 4): vim-common-7.0.109-7.2.el5.i386.rpm | 6.4 MB 00:56

Total 130 kB/s | 9.4 MB 01:13

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 2VR 7.0.109-7.2.el5 vim-common.i386 2VR 7.0.109-7.2.el5 vim-enhanced.i386 2VR 7.0.109-7.2.el5

Updated:

Vim-minimal.i386 2Rank 7.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 root 12 Jan 18 01:22 / bin/vi-> / usr/bin/vim

If you need more advanced requirements, please modify the / etc/vimrc configuration file directly.

At this point, the study on "how to install the highlight vim editing tool in the CentOS system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report