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

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời

Dịch vụ thuê mua proxy Telegram đang được nhiều người tìm kiếm và sử dụng để kiếm tiền dễ...
18/05/2024

How to Use CentOS Unzip

Zip is a file compression utility. It is the default file compression utility on Windows and widely used in Windows operating...
29/12/2020

Mua shadowsocks và hướng dẫn sữ dụng trên window

Đầu tiên tải file này và giải nén ra https://github.com/shadowsocks/shadowsocks-windows/releases/download/4.4.1.0/Shadowsocks-4.4.1.0.zip Bài...
05/01/2024
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024