27 C
Jaipur
Tuesday, December 1, 2020

How to Change Color Schemes in Vim

Must read

Nokia Laptops Get BIS Certification; Might Launch Soon in India

Finnish telecom giant, Nokia, seems to be all set to revive its PC business with the launch of an all-new ‘NKi’ series in India....

Spotify is Testing Stories for Playlists

After Snapchat, Instagram, Twitter, and a bunch of other platforms, Spotify is testing stories. The company is currently testing the feature on select playlists...

Vim is a text editor that can be used to edit all kinds of plain text, especially useful for writing and editing programs. It is also one of the customizable text editors heavily used in Linux operating system.

The suitable color in the editor helps you to categorize, analyze and identify bug in the code. You can change color schemes that come with the software package or install vim themes.

We are going to use and set Vim color schemes in centos 7 or 8. Though the tutorial is prepared on centos 8, the procedure is same for all the Linux distribution.

Prerequisites

1. Vim text editor

The minimal version of CentOS doesn’t come up with vim. You need to install it.

sudo yum install -y vim

2. Terminal or ssh access to your server

View and change default color scheme

By the default installation, there are a number of vim color schemes. Vim color schemes are installed in the /usr/share/vim/vim*/colors directory.

To see a list of ready-to-use themes, open any document using the Vim editor, use:

:colorscheme [space] [crtl+d]
default color scheme

Vim default color scheme

For instance, to switch to the color scheme darkblue, you would use:

:colorscheme darkblue
color scheme - dark blue

Color scheme – dark blue

color scheme - delek

Color scheme – delek

Download and apply themes

Themes are basically a mixture of different colors which has a nice feel and look. There is a wide variety of color themes that may suit your needs. You can find and download Vim themes from GitHub or websites such as vimcolors.

In the following steps, we are going to download nirvana color scheme and use it.

1. First find folder where vim color scheme are stored during installation.

$ sudo find / -iname colors

The color are stored inside the directory /usr/share/vim/vim74/colors/

2. Download nirvana from its github page.

$ sudo yum install –y git
$ git clone https://github.com/duckwork/nirvana.git

3. Move the scheme configuration to /usr/share/vim/vim74/colors/

$ sudo mv nirvana/colors/nirvana.vim  /usr/share/vim/vim74/colors/

4. Open any file and just search for nirvana, use:

:colorscheme nirvana
user made color scheme

Apply color theme – nirvana

To make this change permanent, update .vimrc file in /etc or in the user’s home directory.

Change below the line with your preferred color scheme name:

colorscheme colorscheme_name

To enable the syntax highlight, use:

syntax on

Conclusion

A color scheme can dramatically influence your experience with any text editor. This tutorial guide you to choose and apply colors in vim and accomplish your task in an easier way.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Nokia Laptops Get BIS Certification; Might Launch Soon in India

Finnish telecom giant, Nokia, seems to be all set to revive its PC business with the launch of an all-new ‘NKi’ series in India....

Spotify is Testing Stories for Playlists

After Snapchat, Instagram, Twitter, and a bunch of other platforms, Spotify is testing stories. The company is currently testing the feature on select playlists...