Give your editor a classy color scheme so that you can feel happier when typing code. Personally, I generally prefer darker tones, which are more eye-friendly and won’t tire my eyes after working for a long time. The vim editor can also modify the color scheme. Let me introduce to you how to configure it.
Default color matching
Naked vim itself has some theme colors, and the default color scheme is used by default. How to check the current theme color scheme? Open the vim editor, then enter the command line mode, enter: colorsheme, and press the enter key.
So, how to check the colors supported by the current editor, and how to modify the colors.
It is also very simple to view all color schemes. You can also enter colorscheme
:colorscheme slate
Installing Theme
After talking about how to use the default color scheme, now let’s talk about how to install the theme you want.
First of all, we need to download the theme we like. The following common download address is
https://github.com/flazz/vim-colorschemes
There are Hundreds of colors. Here, I chose a more classic color scheme, molokai. Because I personally like it darker, I also chose to download molokai_dark. Here, I don't want to download all the colors, so I chose to copy the molokai.vim and molokai_dark.vim files. After the molokai.vim and molokai_dark.vim files are ready, next, create the ~/.vim/colors directory in the home directory, and then put the above two files into this directory.
The file has been created and placed in the specified directory. So how to check whether the installation is really completed and use it? In fact, the method used is still the same, using colorsheme in command line mode.
Did you see it? Two new colors are out now. If you want to use it, enter
:colorsheme molokai
as above. This setting is only effective in a single edit. When you exit vim and open vim again, The color scheme will go back to what it was before. How can I modify it so that I can use this color scheme in the future?
Here we are going to modify the vim configuration file. Open the ~/.vimrc file, then add a line
colorsheme molokai
to the configuration file, then save and exit. In the future, no matter how many times you reopen vim, the molokai color will be used.
In addition to molokai color matching, there are also many other classic ones, such as gruvbox and onedark. Friends can choose their favorite color matching, and then install and set them up.
The above is the detailed content of Change the color of VIM - install a theme. For more information, please follow other related articles on the PHP Chinese website!