agude / vim-eldar

A dark color scheme for vim based on Elflord.
MIT License
72 stars 13 forks source link

How to change line number's color? #4

Closed XiaochenCui closed 7 years ago

XiaochenCui commented 7 years ago

After I changed the background image in terminal, the line number can't been recognition clearly. Like below: screenshot

How can I change the color of the line number? Thanks.

agude commented 7 years ago

There are two highlight groups you'll need to change (well, just one if you don't use cursorline). LineNr sets the color for the numbers, and CursorLineNr sets the color for when you have :set cursorline enabled. You can do this in two ways. I prefer the first (vimrc override method) method because it won't conflict with any future changes to the color scheme, but both will work.

Override the specific colors in your vimrc

Override in your .vimrc (or init.vim) by putting autocmd ColorScheme * highlight ... calls just above where you set colorscheme eldar, as per StackOverflow:

if has('autocmd')
    augroup coloroverride
        autocmd!
        autocmd ColorScheme * highlight LineNr  ctermfg=DarkGrey guifg=DarkGrey " Override LineNr
        autocmd ColorScheme * highlight CursorLineNr  ctermfg=White guifg=White " Override CursorLineNr
    augroup END
endif
silent! colorscheme eldar " Custom color scheme

Edit the color scheme directly

Edit eldar.vim and change these lines:

let  s:ColourAssignment['LineNr']        =  {'GUIFG':  'DarkGrey'} "
let  s:ColourAssignment['CursorLineNr']  =  {'GUIFG':  'White'} "

In both cases you'll want to replace DarkGrey and White with your preferred colors.

XiaochenCui commented 7 years ago

@agude Thanks