Vim Color Schemes

29/12/2020
A suitable color scheme is the single finest upgrade you can have for any text editor. The highlighting offers a wide range of benefits to the users, for example, better readability. Readability is especially important when you’re writing a program. It helps to focus on the important part of the programs. It can also help to identify an error in thecode.

Vim is also one of the most customizable text editors out there. Let’s check out how to improve your Vim experience with color schemes!

Vim color schemes

With the help of various Vim tweaks, it’s possible to have fine-grained control over the color settings. There are also plenty of plugins for all the greatest color schemes.

By default, Vim uses the following structure for changing the scheme.

:colorscheme <theme>

Alternatively, you can use the shorter version of the command.

:colo <theme>

What does it do? According to the Vim help,

:help colo

Vim will search for the “colors/<theme>.vim file in the ‘runtimepath’. Vim loads the very first file that’s encountered. If there’s no such theme, it’ll show the following warning.

In the above examples, the color scheme of Vim isn’t permanent. Every time you restart Vim, you have to reload your favorite color scheme. Really boring, right? Why not just take the help of the vimrc file?

Edit the vimrc and add the following line at the top/end.

color <theme>
syntax on

Don’t forget to test the changes before you move forward.

Want to know what color schemes are currently installed? Check out the following directory for the complete list.

ls /usr/share/vim/vim81/colors | grep .vim

The following directory usually holds all the color schemes for the current user only.

~/.vim/colors

Installing Vim color scheme

There are different ways you can install a new color scheme for Vim. The very first step is to find out a suitable one. For example, let’s check out the Monokai theme for Vim.

Download the color scheme from GitHub and put it in “~/.vim/colors” directory.

wget https://raw.githubusercontent.com/crusoexia/vim-monokai/master/colors/monokai.vim
-O ~/.vim/colors/monokai.vim

Inside Vim, run the following command.

:colo monokai

If you want to make this theme permanent for all your Vim sessions, add the following lines in the vimrc file.

Color scheme using the plugin manager

This is the easiest way to install and use a color scheme for Vim is through a suitable Vim plugin manager. Yes, the number of Vim plugins is so big that for proper management, a plugin manager is necessary. There are a number of Vim plugin managers out there. Check out how to use the Vim plugin manager.

In this example, I’ll be using vim-plug. Feel free to find out your favorite Vim color scheme from Vim Awesome – the largest collection of Vim plugins across the universe.

For example, let’s install Solarized 8.

As the page suggests, add Solarized 8 in the plugin list of vim-plug in the vimrc file.

Complete the installation by running the following Vim command.

:so %
:PlugInstall

Once the installation is complete, update the vimrc file to load the theme.

Check out the result!

Vim MEGA color scheme collection

There are definitely a ton of color schemes out there for Vim. Installing all of them one by one is literally the most painful task. How about getting all the Vim color schemes in one fell swoop?

Check out vim-colorschemes by flazz on GitHub. It’s a MEGA collection of Vim color schemes in the form of a single plugin. The recommended way of installing this plugin is using a suitable plugin manager like Vundle or Pathogen. Vim-plug also does the job.

As I’m using vim-plug, I have to add the following line in the vimrc file.

Plug ‘flazz/vim-colorschemes’

If you’re using Pathogen, use the following one.

git submodule add https://github.com/flazz/vim-colorschemes.git ~/.vim/
bundle/colorschemes

For Vundle, it’s quite similar to vim-plug.

Plugin ‘flazz/vim-colorschemes’

Finally, reload vimrc and complete the install.

:so %
:PlugInstall

Check out the complete list of installed color schemes by this MEGA plugin.

ls .vim/plugged/vim-colorschemes/colors | grep .vim

To try out a different color scheme, use the aforementioned trick.

:colo <theme>

Here’s another trick that you can directly perform from the Vim’s command line. Type “:colo”, then <space>, then hit “Tab”.

Note: The above plugin includes a lot of color schemes but those are very old (not updated for years). So, my personal recommendation would be using it to only check out different color schemes. If you happen to like one, search for it in Vim Awesome and install the latest one.

There are also other such big collections.

Final thoughts

A color scheme can dramatically influence your experience with any text editor. In the case of Vim, it’s more important. It’s a console text editor and a handy coloring will surely help your eyes to focus on where you need to focus. It also helps to imrpove the aesthetics.

Enjoy!

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Top 5 Best Ubuntu Alternatives

If you asked younger Linux users to tell you what their first Linux distribution was, we bet that Ubuntu would be the most...
29/12/2020

Find Out How Much Disk Space a Directory Consumed from the Command Line

On a graphical desktop environment, you can find out how much disk space a directory consumed by just right clicking on...
29/12/2020

Best Linux Distributions for Servers

Linux dominates the server market, offering excellent flexibility, stability, and security without costing any money.From...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024