How to Change Colors and Themes in Vim on Linux

How to Change Colors and Themes in Vim on Linux

Vim is a text editor that we use very often in Linux. Vim is a free, open source text editor that performs much the same functions as many other text editors, such as Sublime and Notepad++. Vim can be executed in the command line or in the graphical interface.

There are many tutorials for Vim. In this article, we will mainly talk about how to change the color and theme of Vim.

Vim is not very friendly to beginners. But once you become proficient in using Vim, you will find that you can no longer live without Vim.

What is the Vim theme?

The so-called theme is essentially a color scheme, that is, a group of aesthetically pleasing color combinations that visually enhance the user experience. The Vim editor itself also comes with some ready-made color schemes.

However, it should be noted that the Vim color scheme described here is applied to the code. Specifically, it adds specific colors to some keywords in the code, not to the background color of the terminal.

To view the current Vim color scheme, enter the following command after entering the Vim operation interface:

:colorscheme

To see what default configurations are available, use the following command:

:colorscheme+space+Tab

In fact, just click the tab key multiple times after the space, switch to the color you want to set and press Enter to set it. There are many default color schemes, such as the basic ones are red, blue, black and gray, and the special ones are desert and so on.

Download your favorite color copy

What if you don't like the default theme? We can find a lot of great themes on Github, and many of them are also available through Vimcolors.com. Some of these themes change not only the code and syntax colors, but also the background colors.

After you find a theme you like, you can apply it to your Vim in the following ways.

1. First create a .vim directory:

$ mkdir ~/.vim

2. Then use the following command to clone the theme repository into your own .vim folder:

$ git clone <https://github.com/flazz/vim-colorschemes.git> ~/.vim

The addresses in angle brackets above may vary depending on the subject project.

3. Enter Vim operation mode and select the theme using the previous command:

:colorscheme+space+Tab

Alternatively, you can specify the topic directly without having to keep hitting the Tab key.

:colorscheme yourTheme

However, these two operations are not permanent. Once you close Vim, the theme will be automatically reset. If you need to set Vim's default theme to your favorite theme, you can run the following command:

$ echo 'colorscheme <desert>' >> ~/.vimrc

Choose a topic you like

Which theme you use is entirely a matter of personal preference, I personally like to use themes with brighter colors. Some people like dark themes, which is often the theme used for hackers in movies. Some people also like colorful themes.

If you are not sure which theme to choose, here are some recommended options for your reference.

fairy-garden

Ice Age

Melancholy bluewery

synthwave84

anderson

Summarize

This is the end of this article about how to change colors and themes in Vim in Linux. For more information about changing colors and themes in Vim, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install vim editor in Linux (Ubuntu 18.04)
  • Setting the length and line number of Tab in Vim editor under Linux
  • Solution to the problem of E514: write error (file system full?) when saving files in Linux using vim
  • How to solve the Chinese garbled code in vim under Linux
  • Use Vim to delete even or odd lines in Linux system

<<:  Detailed explanation of the API in Vue.js that is easy to overlook

>>:  MySQL 8.0.20 Installation Tutorial with Pictures and Text (Windows 64-bit)

Recommend

When to use Map instead of plain JS objects

Table of contents 1. Map accepts any type of key ...

Example of using rem to replace px in vue project

Table of contents tool Install the plugin Add a ....

HTML Tutorial: Collection of commonly used HTML tags (5)

These introduced HTML tags do not necessarily ful...

Detailed explanation of DOM DIFF algorithm in react application

Table of contents Preface What is VirtualDOM? Rea...

Detailed explanation of the simple use of MySQL query cache

Table of contents 1. Implementation process of qu...

Solution to forgetting the root password of MySQL 5.7 and 8.0 database

Note: To crack the root password in MySQL5.7, you...

Mysql uses insert to insert multiple records to add data in batches

If you want to insert 5 records into table1, the ...

Docker installation and deployment example on Linux

After reading the following article, you can depl...

Detailed explanation of HTML page header code example

Knowledge point 1: Set the base URL of the web pa...

Tomcat first deployment web project process diagram

Put your own web project in the webapps directory...

CSS example code for setting scroll bar style

The CSS implementation code for setting the scrol...

Tips for data statistics in MySQL

As a commonly used database, MySQL requires a lot...

How to detect whether a file is damaged using Apache Tika

Apache Tika is a library for file type detection ...

Linux general java program startup script code example

Although the frequency of starting the shell is v...

How to configure two-way certificate verification on nginx proxy server

Generate a certificate chain Use the script to ge...