The 10 best vim color schemes for Python, and how to install

Table of Contents

Vim, an open-source editor, comes pre-installed with a few color schemes. If you’re tired of the default color scheme or want to try something new or give your code a fresh look and feel, you can download and install a new color scheme. In addition, color schemes are a set of colors that specify how to emphasize source code.

It’s useful since the colors can assist you in distinguishing between different data kinds, functions, arguments, and so on. You’ll be able to find what you’re seeking this way quickly. Syntax highlighting can sometimes aid in the detection of syntax problems. Also, the color schemes were only applied to the source, not the editor’s background.

We’ll go through some of the most excellent vim color schemes in this article and how to download and install a new color scheme in your Vim editor. In addition, we’ll learn how to use the Vim editor’s pre-installed color scheme.

How to view installed Vim Color Schemes

There are a variety of Vim color schemes available locally. The text editor comes pre-configured with a default scheme, which may differ based on whether you’re using a light or dark Terminal. In a light terminal, the default Vim color scheme is peach puff. The default color scheme is ron if you have a dark terminal.

Open any document in the Vim editor and use the following command to display a list of ready-to-use themes:

SUGGESTED READ

:colorscheme [space] [Ctrl+d]

The output includes a list of Vim color schemes, as shown in the figure below.

Vim color schemes

How do I change the color scheme in Vim?

You can explore and adjust the design until you discover one you like best after requesting Vim to display a list of color schemes. Use the following command to alter the color palette in Vim:

:colorscheme [colorscheme_name]
change colorscheme to blue
change the color scheme to blue

You can even type an abbreviated version of the instruction:

:colo [colorscheme_name]

e.g.

:colo shine
vim colorscheme shine
vim color scheme shine

To improve your Vim experience, try the following color schemes:

SUGGESTED READ

  • Ayu
  • Palenight
  • Inkpot
  • Monokai
  • Solarized Dark
  • Gruvbox
  • Purify
  • Vim-one

First, enable syntax highlighting. Then, change the Normal mode using the Esc key to enable syntax highlighting in vim. After that, type

:syntax on

The syntax highlighting will be enabled, and the default theme will be displayed. Edit the ~/.vimrc file using the following line in Terminal to turn on syntax highlighting permanently:

vi ~/.vimrc

Then insert the following line:

turn on syntax highlighting permanently
turn on syntax highlighting permanently

View the color schemes that have already been implemented. On your computer, certain color schemes are already installed. Color schemes with the.vim extension can be found in the /usr/share/vim/vim*/colors directory. Run the following command in Terminal to view previously installed schemes:

ls –l /usr/share/vim/vim*/colors
previously installed schemes
previously installed schemes

Establish a Color Scheme

To change the color scheme in vim, launch the editor and switch to Normal mode by pressing Esc. Then type the color scheme’s name followed by the color scheme’s name as follows:

SUGGESTED READ

:colorscheme morning

Alternatively, simply

:colo morning
:colorscheme morning
:colorscheme morning

You may also change the vim color scheme permanently by modifying the ~/.vimrc file and adding the line:

colorscheme morning

How to Install a new color scheme

Several user-created color schemes may fit your needs better than the alternatives available locally. GitHub or websites like vim color schemes are good places to look for and download them. Download a new theme from a remote source and add it to your repository. After installing it on your local machine, make sure to relocate a new color scheme to the /vim/colors directory.

For instance, to install a new color scheme for Vim, go to the GitHub site and download it. We will get the “Monokai” vim theme from the Git source. Right-click on the following link and save it as .vim in your Downloads directory for the Monokai color scheme.

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

Alternatively, you can get the.vim file with wget followed by wget. Move the downloaded.vim file to the ~/.vim/colors directory once it has finished downloading. You may find this directory under /etc/vim/colors on some distributions, such as mine. As a result, execute the following command to transfer the .vim file:

SUGGESTED READ

mv ~/Downloads/monokai.vim ~/.vim/colors

or

mv ~/Downloads/monokai.vim /etc/vim/colors/

This color scheme is now complete and ready to use. Open a vim file and type the following line in normal mode to test it:

: colo monokai

As you can see, the new vim color scheme has been successfully implemented. Edit the ~/.vimrc file and add the following lines to set the newly installed color scheme permanently:

syntax on :colorscheme monokai

After that, press the Esc key to return to Normal mode and type the following command to save and exit the file.

Manually adjust Vim’s color settings

You can manually adjust the color parameters if none of the schemes appeal to you. Before making any changes to the color settings, it’s good to test them out. You can do this with the vim text editor within an existing file.

SUGGESTED READ

:highlight [Group] [key=value]

For a shortened form, you can use hi instead of highlight. The [Group] element is the item(s) that should be impacted by the key-value modifiers, while the highlight is the command. In addition, the previously mentioned command allows you to create a variety of groups. Among them are the following:

  • Typical (standard text)
  • Characters that do not appear in the text are referred to as NonText.
  • Cursor(the character under the cursor)
  • ErrorMsg is a type of error message (error messages)

These are only a few of the many Vim highlight groups available. Refer to Vim’s official documentation for a complete list of all the groups.

Highlight Keys in Vim

The key=value element changes whether you’re working in a GUI or a terminal window, the key=value element changes. If you’re working on a terminal with color support, for example, you could use any of the following highlight keys:

  • ctermfg (for setting the foreground)
  • ctermbg (for setting the background)
  • cterm (for additional properties)

The highlight keys should be used by users who prefer the GUI:

  • guifg (for setting the foreground)
  • guibg (for setting the background)
  • gui (for additional properties)

You can use standard color names, recommended numbers, or hex values to define the values for ctermfg, ctermbg/guifg, and guibg (only in the GUI). With color values, however, cterm and GUI are not needed. Instead, bold, italic, underline, reverse, and none are the values you use for these highlight keys.

SUGGESTED READ

Using the highlight command in Vim

A simple example is the easiest method to demonstrate how the highlight command works. Take a look at this file and its initial color scheme when you open it in Vim:

initial color scheme
initial color scheme

Set the foreground color of all Normal text to green and the background color to black. To accomplish this, type the following:

:hi Normal ctermfg=Green ctermbg=Black

When you press Enter, the colors should change automatically, as shown in the figure below.

foreground color changed to green
foreground color changed to green

Conclusion

After reading this article, it would help if you had a basic understanding of Vim color schemes. You should also be able to adjust the color options and determine the best option for you. Color schemes are an essential feature of the popular text editor Vim. They allow for proper syntax highlighting, but they also allow users to customize the interface.

You can alter the color schemes that come with the software package or install custom color schemes as a Vim user. Additionally, the software allows you to manually change the colors of individual elements.

SUGGESTED READ

This article has covered how to install and configure the new color scheme in Vim. The syntax highlighting will be enabled by default when you open a text file in vim. As a result, it will implement the new color scheme. Also, replace the new color scheme name with “default” to return to the default color scheme.

Source: https://www.codeunderscored.com/the-10-best-vim-color-schemes-for-python-and-how-to-install/

You might also like this video