Home  >  Article  >  Operation and Maintenance  >  How to install vim on centos

How to install vim on centos

藏色散人
藏色散人Original
2020-03-19 13:52:0012797browse

How to install vim on centos

How to install vim in centos?

When using vim in a Linux environment, the prompt: vim command not found means that vim has not been installed on the system.

Installation steps:

1. Check whether it is installed

Check the packages that already exist on your machine and confirm whether your VIM has been installed. Enter:

rpm -qa|grep vim

If it has been installed, it will be displayed:

[root@localhost usr]# rpm -qa|grep vim
vim-minimal-7.4.629-6.el7.x86_64
vim-filesystem-7.4.629-6.el7.x86_64
vim-enhanced-7.4.629-6.el7.x86_64
vim-common-7.4.629-6.el7.x86_64
vim-X11-7.4.629-6.el7.x86_64

2. Installation

If one of them is missing, for example: the vim-enhanced package is missing, then execute:

yum -y install vim-enhanced

It will automatically download and install. If none of the above three packages are displayed, enter the command directly:

yum -y install vim*

It will be installed automatically after executing the command. After completion, you can use the vim editor.

3. Configuration

After the installation is complete, start configuring vim

vim /etc/vimrc

After opening the file, press i to enter the edit mode, and then find a location to add the following code

 set nu          " 设置显示行号
 set showmode    " 设置在命令行界面最下面显示当前模式等
 set ruler       " 在右下角显示光标所在的行数等信息
 set autoindent  " 设置每次单击Enter键后,光标移动到下一行时与上一行的起始字符对齐
 syntax on       " 即设置语法检测,当编辑C或者Shell脚本时,关键字会用特殊颜色显示

After adding, press Esc, then enter

:wq

to exit and save.

Recommended video tutorial for learning Linux: https://www.php.cn/course/list/33.html

The above is the detailed content of How to install vim on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn