How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Enable Syntax Highlighting in Vi/Vim Editor

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
27
VIEWS
Share on FacebookShare on Twitter

Contents

  1. How to Install VIM
  2. How to Enable Syntax Highlighting in VI and VIM
  3. Test Syntax Highlighting in Vi Editor
    1. Example of Syntax Highlighting in VI
  4. Turn On or Turn Off Syntax Highlighting in VI
    1. Turn On Syntax Highlighting in VI
    2. Turn Off Syntax Highlighting in VI

One of the easiest ways to boost the readability and context of the text in a configuration file or your source code for various programing languages, is by using a text editor that supports “syntax highlighting”.

Syntax highlighting is a simple but useful component in most if not all text editors that are used for programming, scripting, or markup languages, which enables for displaying colored text, notably source code, in different colors (and possibly fonts) corresponding to the category of terms.

Read Also: 10 Reasons Why You Should Use Vi/Vim Text Editor in Linux

In this article, we will show how to turn on syntax highlighting temporarily or permanently in Vi/Vim text editor.

VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn’t show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file. By default VIM works on all Linux terminals, but some terminals have minimal highlighting capabilities to run.

VIM has another great feature that enable us to Turn Off or Turn On syntax highlighting using option syntax on and syntax off.

How to Install VIM

Most of the Linux system already included VIM package, if not then install it using YUM tool.

# yum -y install vim-enhanced

How to Enable Syntax Highlighting in VI and VIM

To enable Syntax Highlighting feature in VI editor, open the file called /etc/profile.

# vi /etc/profile

Add the alias function to VI by pointing to VIM in /etc/profile file. This file is used to set alias functions globally.

alias vi=vim

If you would like to set user specific aliases and functions, then you need to open the file .bashrc under user directory.

# vi /home/tecmint/.bashrc

Add the alias function. For example we set alias for tecmint user.

alias vi=vim

After making changes to file you need to reset the changes by executing following command.

# source /etc/profile
OR
# source /home/tecmint/.bashrc

Test Syntax Highlighting in Vi Editor

Open any example code of file with vi editor. By default Syntax Highlighting is automatically turned on in /etc/vimrc file.

Example of Syntax Highlighting in VI

How to Enable Syntax Highlighting in Vi/Vim Editor

Syntax Highlighting in Vi

Turn On or Turn Off Syntax Highlighting in VI

You can Turn On or Turn Off syntax highlighting by pressing ESC  button and use command as :syntax on and :syntax off in Vi editor. Refer example screenshots.

Turn On Syntax Highlighting in VI

How to Enable Syntax Highlighting in Vi/Vim Editor

Enable Syntax Highlighting in Vi Editor

Turn Off Syntax Highlighting in VI

How to Enable Syntax Highlighting in Vi/Vim Editor

Disable Syntax Highlighting in Vi Editor

If you are new to vi/vim, you will find the following guides useful:

  1. Learn Vi/Vim as a Full Text Editor in Linux
  2. Learn Useful Vi/Vim Editor Tricks and Tips in Linux
  3. 8 Interesting Vi/Vim Editor Tricks for Every Linux User
  4. How to Password Protect a Vim File in Linux

You can share with us any other useful vi/vim tips or tricks you have come across, via the comment form below.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install Apache Tomcat 8 on CentOS 7
Linux

How to Install Apache Tomcat 8 on CentOS 7?

February 11, 2020
Install Arch Linux With Btrfs Snapshotting
Uncategorized

Install Arch Linux With Btrfs Snapshotting

February 13, 2020
Next Post

Securing SSH Using Key Based Authentication

How to Copy File Permissions and Ownership to Another File in Linux

How to Add a New Disk to an Existing Linux Server

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

Install Arch Linux With Btrfs Snapshotting

Install Arch Linux With Btrfs Snapshotting

3 years ago

How to Install Flarum Forum on Debian 10

3 years ago

How to Install Perl 5.28 on an Arch Linux Webserver

4 years ago

How To Install Just Cause 2 (JC2-MP) Server on CentOS 7

3 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.