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.
In this context, we shall look into the different methods to modify Color Syntax Highlighting In vi or vim Editor.
When we apply this method, it involves modifying 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:
$ sudo vim abc
After opening the file, we simply passed the command ":set background=dark" and pressed the Enter key.
This command will instantly make the background of the Vim editor a bit darker because of which the comments will automatically become more readable.
By using this method, we will be 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.
This command will immediately highlight the comments in the Vim editor with the specified color thus making them look more readable.
Here, we will be 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.
This command will quickly change the color scheme of the comments in the Vim editor to "elflord" hence making them look more readable.
This article covers the different ways of changing the comment color in the Vim editor in Linux Mint 20. In fact, 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. Now, you can make the comments in the Vim editor look all the more readable.