custom colors
Recall the last lesson
-
This time we studied the color scheme
- eureka
colors
Location of - Downloaded and applied color scheme
- Made their own color scheme
- eureka
-
Now I want to change the color of the color scheme
- Is it successful???
First, you have to have your own color scheme
#Find the location of colors
cd usr/share/vim/vim81/colors
#List all color schemes
ls
#Copy your own color scheme
sudo cp murphy.vim oeasy.vim
#View color scheme information
sudo vi oeasy.vim
Modify color scheme
- The first five lines are comments
- Line 7 cancels the original color matching
- Line 8 set background
- Lines 9-11 reset syntax highlighting
- Line 12 names this color scheme, which can be modified to
oeasy
- Line 14 starts to set the colors of the various highlight groups
-
Let’s modify the first highlight group first
Normal
Normal
I meanGeneral text
- This type of text belongs to this highlight group
-
Similar to this are
- notes
Comment
- constant
Constant
etc.
- notes
Change the normal highlight group color
- First, change the color scheme name to
oeasy
- find
Normal
group - hold
Normal
Group background colorctermbg
Change toblue
- hold
Normal
Foreground color of the groupctermfg
Change toyellow
:w
Save color filecolorscheme oeasy
Reset color file
View colors
:hi Normal
Can viewNormal
Color matching of groups:hi
You can view all colors of the current color schemexxx
Is the effect preview
Color details
hi
yeshighlight
Abbreviation of:h hi
You can query help
Font features
:hi StatusLine
:hi StatusLine cterm=bold
:hi StatusLine cterm=bold,italic
:hi StatusLine cterm=bold,italic
:hi StatusLine cterm=bold,italic,underline
:hi StatusLine
-
term
- intend
terminal
- A comma can be added between the effects
- Corresponding black-and-white terminal
- Not valid here
- intend
-
cterm
- Bold bold
- Underline underline
- Italic tilt
- None cancels any effects
Set color
hi StatusLine
hi StatusLine ctermfg=red ctermbg=blue
hi StatusLine
-
ctermfg
- intend
c
olorter
minalf
orec
olor - Foreground color settings
- ctermfg=white
- intend
-
ctermbg
- intend
c
olorter
minalb
ackc
olor - Set by scene
- ctermfg=red
- intend
-
gui
Related properties- And
gui
relevant - No effect in current terminal
- And
- The color number corresponding to the color is the color value corresponding to ANSI from the system
Defines the color effect of the line where the cursor is located
- Set cursor line highlighting
:set cursorline
:h 'cursorline'
:hi CursorLine
:hi CursorLine ctermbg=red ctermfg=white
:hi CursorLine
- Cursorline moves as the cursor moves
Defines the color effect of the column where the cursor is located
- Set cursor line highlighting
:set cursorcolumn
:h 'cursorcolumn'
:hi CursorColumn
:hi CursorColumn ctermbg=red ctermfg=white
:hi CursorColumn
- As the cursor moves, the cursorcolumn moves
-
If there is a line feed problem
:set nowrap
Custom color name
-
definition
oeasy
group:hi oeasy ctermbg=white ctermfg=red
-
see
oeasy
group:hi oeasy
-
application
oeasy
group:set statusline=%#oeasy#%F%*
configuration file
set statusline=%-040.40(%F%m%)%-030.30([%l,%c]%)%p%%
set laststatus=2
set ruler
set number
set showcmd
set nocompatible
set showcmd
set showmode
set history=100
set t_Co=256
colorscheme blue
set cursorline
hi CursorLine ctermbg=red ctermfg=white
set cursorcolumn
hi CursorColumn ctermbg=red ctermfg=white
summary
-
We went deep into the color scheme this time
- The specific color matching in the scheme has been modified
- Established its own color matching
- Applied your own color
-
Is there anything interesting in the configuration?
- It’s red, green and blue
- Can I have more colors?
- Next time