How to install and highlight VI editor syntax with VIM
To install and highlight VI editor syntax with VIM
This article explains how to install and enable Syntax Highlighting in VI editor or Vim ( Vi IMproved )on RHEL / CentOS / Fedora.
To Install VIM
Syntax
yum -y install vim-enhanced
Output
[root@linuxhelp Desktop]# yum -y install vim-enhanced
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Setting up Install Process
..
..
..
Dependency Installed:
vim-filesystem.x86_64 2:7.4.629-5.el6
Updated:
vim-enhanced.x86_64 2:7.4.629-5.el6
Dependency Updated:
vim-common.x86_64 2:7.4.629-5.el6
Complete!
To Enable Syntax Highlighting in VI
To Enable Syntax Highlighting in VI and VIM and to add alias function to VI by pointing to VIM, just mention as follows
alias vi=vim
Example
[root@linuxhelp Desktop]# vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It' s NOT a good idea to change this file unless you know what you
# are doing. It' s much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
alias vi=vim
pathmunge () {
This given function will set the alias globally.
To set user specific aliases and functions
Example
[root@linuxhelp Desktop]# vi /home/user1/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ] then
. /etc/bashrc
fi
# User specific aliases and functions
alias vi=vim
To reset the changes
Execute the following command to reset the changes
[root@linuxhelp Desktop]# source /etc/profile
OR
[root@linuxhelp Desktop]# source /home/user1/.bashrc
To Test Syntax Highlighting in VI
To turn On or turn Off syntax highlighting
[root@linuxhelp Desktop]# vim /etc/vimrc
To turn on
To turn off
Comments ( 0 )
No comments available