Mint

How Can We Change the Comment Color in Vim Editor in Linux Mint 20

How Can We Change the Comment Color in Vim Editor in Linux Mint 20

Introduction:

Vim is a very useful text editor for the Linux operating system. This text editor has some default settings on which it operates such as color schemes, text size, format, etc. However, the default color for the comments in this text editor makes the comments quite hard to read with its default background color. Nevertheless, you can always change the color of those comments for making them easier to be read and in this article, we will share the different methods of doing so.

Methods of Changing the Comment Color in Vim Editor in Linux Mint 20:

The following are the three methods using which you can make the comments in the Vim editor to appear in a different color tone:

Method # 1: By Changing the Background of the Vim Editor:

The first method of doing so is by changing the background of the Vim editor on which the comment color will automatically appear to be different. First, we opened an already existing file with the Vim editor by running the command shown below:

$ sudo vim abc

The file opened with the Vim editor in Linux Mint 20 is shown in the following image:

After opening this file, we simply passed the command “:set background=dark” and pressed the Enter key as highlighted in the image shown below:

This command will instantly make the background of the Vim editor a bit darker because of which the comments will automatically become more readable as shown in the following image:

Method # 2: By Highlighting the Comments in Vim Editor:

The second method of changing the comment color in the Vim editor is by highlighting the comments. For that, after opening the desired file, we have passed the command “:highlight Comment ctermfg=green” and pressed the Enter key as highlighted in the image shown below:

This command will immediately highlight the comments in the Vim editor with the specified color thus making them look more readable as shown in the following image:

Method # 3: By Changing the Color of the Comments in Vim Editor:

The last method of doing so is by actually changing the color of the comments in the Vim editor. For that, after opening the desired file with the Vim editor, we have simply passed the command “color elflord” and pressed the Enter key as highlighted in the image shown below:

This command will quickly change the color scheme of the comments in the Vim editor to “elflord” hence making them look more readable as shown in the following image:

Conclusion:

This article taught you three different ways of changing the comment color in the Vim editor in Linux Mint 20. By using either of these methods, you can make the comments in the Vim editor look all the more readable.

Similar Posts