vi代码高亮
温馨提示:
本文最后更新于 2017年02月27日,已超过 2,886 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
centos中自带vi编辑器,但是vi毕竟只是vim的阉割版,基本的代码高亮功能也没有,所以考虑安装一个完整版的vim
[root@iZ2zebjvditkx9z5rp1bmsZ zhangyd]# yum search vim
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
* base: mirrors.aliyuncs.com
* epel: mirrors.aliyuncs.com
* extras: mirrors.aliyuncs.com
* updates: mirrors.aliyuncs.com
========================================================================== N/S matched: vim ===========================================================================
beakerlib-vim-syntax.noarch : Files for syntax highlighting BeakerLib tests in VIM editor
fluxbox-vim-syntax.noarch : Fluxbox syntax scripts for vim
golang-vim.noarch : Vim plugins for Go
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-clustershell.noarch : VIM files for ClusterShell
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-go.x86_64 : Go development plugin for Vim
vim-gtk-syntax.noarch : Vim syntax highlighting for GLib, Gtk+, Gstreamer, and more
vim-minimal.x86_64 : A minimal version of the VIM editor
vim-vimoutliner.noarch : Script for building an outline editor on top of Vim
Name and summary matches only, use "search all" for everything.
选择vim-enhanced版本,这个版本是包含最新增强功能的VIM编辑器版本
[root@iZ2zebjvditkx9z5rp1bmsZ zhangyd]# yum install vim-enhanced
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql56-community | 2.5 kB 00:00:00
nginx | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/7): extras/7/x86_64/primary_db | 122 kB 00:00:00
(2/7): mysql-tools-community/x86_64/primary_db | 32 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 745 kB 00:00:00
(4/7): mysql56-community/x86_64/primary_db | 159 kB 00:00:00
(5/7): nginx/x86_64/primary_db | 21 kB 00:00:02
(6/7): updates/7/x86_64/primary_db | 2.9 MB 00:00:02
(7/7): epel/x86_64/primary_db | 4.5 MB 00:00:04
Loading mirror speeds from cached hostfile
* base: mirrors.aliyuncs.com
* epel: mirrors.aliyuncs.com
* extras: mirrors.aliyuncs.com
* updates: mirrors.aliyuncs.com
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.160-1.el7_3.1 will be installed
--> Processing Dependency: vim-common = 2:7.4.160-1.el7_3.1 for package: 2:vim-enhanced-7.4.160-1.el7_3.1.x86_64
--> Running transaction check
---> Package vim-common.x86_64 2:7.4.160-1.el7_3.1 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.160-1.el7_3.1.x86_64
--> Running transaction check
---> Package vim-filesystem.x86_64 2:7.4.160-1.el7_3.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
Installing for dependencies:
vim-common x86_64 2:7.4.160-1.el7_3.1 updates 5.9 M
vim-filesystem x86_64 2:7.4.160-1.el7_3.1 updates 9.7 k
Transaction Summary
=======================================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 7.0 M
Installed size: 23 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): vim-filesystem-7.4.160-1.el7_3.1.x86_64.rpm | 9.7 kB 00:00:00
(2/3): vim-enhanced-7.4.160-1.el7_3.1.x86_64.rpm | 1.0 MB 00:00:01
(3/3): vim-common-7.4.160-1.el7_3.1.x86_64.rpm | 5.9 MB 00:00:05
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.2 MB/s | 7.0 MB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:vim-filesystem-7.4.160-1.el7_3.1.x86_64 1/3
Installing : 2:vim-common-7.4.160-1.el7_3.1.x86_64 2/3
Installing : 2:vim-enhanced-7.4.160-1.el7_3.1.x86_64 3/3
Verifying : 2:vim-enhanced-7.4.160-1.el7_3.1.x86_64 1/3
Verifying : 2:vim-common-7.4.160-1.el7_3.1.x86_64 2/3
Verifying : 2:vim-filesystem-7.4.160-1.el7_3.1.x86_64 3/3
Installed:
vim-enhanced.x86_64 2:7.4.160-1.el7_3.1
Dependency Installed:
vim-common.x86_64 2:7.4.160-1.el7_3.1 vim-filesystem.x86_64 2:7.4.160-1.el7_3.1
Complete!
那么,怎么让vi也能代码高亮呢?
vim /etc/bashrc
在最底部增加alias vi=vim
OK!完成,看看效果
正文到此结束
- 本文标签: Linux Shell
- 本文链接: https://www.zhyd.me/article/45
- 版权声明: 本文由张亚东原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
热门推荐
相关文章
该篇文章的评论功能已被站长关闭