Are you annoyed about the comment color in vim? The dark blue color of the comment is often hard to read.
In this tutorial, we learn how to change the comment color in Vim. There are few methods we can use to look vim comment very readable.
Method 1: Use a different color scheme
There are many color schemes available in vim. You can use a different color scheme using the :color command. The color scheme desert is more pleasant to read.
From the output, you can see the comments are very clear to read.
To make this change permanent create a hidden file named .vimrc in your home folder and add the below line:
color desert
Different color schemes are available under the directory /usr/share/vim/vim<version>/colors/.
List vim color schemes directory
Alternatively, you can see the available color schemes by opening vim and type :color <space> <press tab key> .
Method 2: Change terminal Background
You can change the default light background to dark. Open vim and add below line
:set background=dark
Method 3: Using highlight comment command
You can use the highlight comment command to change the vim comment color. For example to change to vim comment to green, type:
:highlight Comment ctermfg=green
vim comment in green
If using GUI vim, you can use hex color codes:
:highlight Comment guifg=#a26a4d
Conclusion
In this tutorial, we learned how to change comment color in vim. Thanks for reading, please leave your feedback and suggestions in the comment section.
If this resource helped you, let us know your care by a Thanks Tweet.
Did you find this article helpful?
We are glad you liked the article. Share with your friends.
About The Author
Bobbin Zachariah
Bobbin is a seasoned IT professional with over two decades of experience. He has excelled in roles such as a computer science instructor, Linux system engineer, and senior analyst. Currently, he thrives in DevOps environments, focusing on optimizing efficiency and delivery in AWS Cloud infrastructure. Bobbin holds certifications in RHEL, CCNA, and MCP, along with a Master's degree in computer science. In his free time, he enjoys playing cricket, blogging, and immersing himself in the world of music.
Comments