Cursor color when there is a warning

42 views
Skip to first unread message

Germain

unread,
Mar 3, 2010, 9:42:23 AM3/3/10
to vim_use
Hello all !

Sorry if this message has been ever send, I do not know if my mail
work or not ...

I recently set on the cursorline in vim. The problem is that if I do a
mistake on the line, for exemple a closing parenthse, it appears in
white foreground whith a grey95 background and it is difficult to see
it. If I do not use the cursorline that type of mistake will be with a
red background and a white foreground. How can I said to vim that the
warning background should be more important than the cursorline
background ?

This is a part of my vimrc file :

set cursorline
colorscheme default
highlight IncSearch term=underline ctermfg=NONE ctermbg=NONE
guifg=NONE guibg=NONE
highlight Search term=underline ctermbg=LightGreen ctermfg=NONE
guibg=LightGreen guifg=NONE
highlight Cursor guifg=white guibg=grey30
highlight CursorLine term=underline cterm=underline guibg=grey95
highlight CursorColumn term=NONE ctermbg=grey guibg=grey95
highlight StatusLine term=reverse,bold cterm=reverse,bold gui=italic
guibg=SteelBlue guifg=white
highlight StatusLineNC term=reverse cterm=reverse gui=italic
guibg=grey75 guifg=SteelBlue


Thanks for your help

Tony Mechelynck

unread,
Mar 3, 2010, 12:47:55 PM3/3/10
to vim...@googlegroups.com, Germain
On 03/03/10 15:42, Germain wrote:
> Hello all !
>
> Sorry if this message has been ever send, I do not know if my mail
> work or not ...
>
> I recently set on the cursorline in vim. The problem is that if I do a
> mistake on the line, for exemple a closing parenthse, it appears in
> white foreground whith a grey95 background and it is difficult to see
> it. If I do not use the cursorline that type of mistake will be with a
> red background and a white foreground. How can I said to vim that the
> warning background should be more important than the cursorline
> background ?

Method I: Don't set 'cursorline'.

Method II: Set the CursorLine highlighting to something that will still
let you know what the underlying colours were, for instance

hi CursorLine term=NONE,reverse
\ cterm=NONE,reverse ctermfg=NONE ctermbg=NONE
\ gui=NONE,reverse guibg=NONE guifg=NONE

which will show in red on white what would otherwise be white on red, or

hi CursorLine term=NONE,underline
\ ctermfg=NONE ctermbg=NONE cterm=NONE,underline
\ guibg=NONE guifg=NONE gui=NONE,undercurl guisp=yellow

which, in gvim, will show the cursor line in normal colours but with a
wavy yellow underline added. (You might, however, not like this second
example if you use the Vim spell checker, which uses wavy underlines
quite a lot.)

BTW, I see you already have a number of :highlight settings. Maybe it is
time to start your own color scheme. Mine,
http://users.skynet.be/antoine.mechelynck/other/almost-default.vim ,
started that way and slowly grew over the years. This way, if I try new
highlights (set from the command-line), ":syn enable" will go back to my
colorscheme rather than to the Vim default.


>
> This is a part of my vimrc file :
>
> set cursorline
> colorscheme default
> highlight IncSearch term=underline ctermfg=NONE ctermbg=NONE
> guifg=NONE guibg=NONE
> highlight Search term=underline ctermbg=LightGreen ctermfg=NONE
> guibg=LightGreen guifg=NONE
> highlight Cursor guifg=white guibg=grey30
> highlight CursorLine term=underline cterm=underline guibg=grey95
> highlight CursorColumn term=NONE ctermbg=grey guibg=grey95
> highlight StatusLine term=reverse,bold cterm=reverse,bold gui=italic
> guibg=SteelBlue guifg=white
> highlight StatusLineNC term=reverse cterm=reverse gui=italic
> guibg=grey75 guifg=SteelBlue
>
>
> Thanks for your help
>

Best regards,
Tony.
--
You don't sew with a fork, so I see no reason to eat with knitting
needles.
-- Miss Piggy, on eating Chinese Food

Germain

unread,
Mar 4, 2010, 3:29:50 AM3/4/10
to vim_use
Thank you. Your first solution is not very pleasant ;) ! For the two
following the cursorline become to much dark ... I do not really like
that.

Looking at your color scheme file, I took the syntax for the Error
hilight and I simply change the fg color from white to blod red ! For
the cursorline I did the same as you with a light grey bg. Thus with
error in bold red on the cursorline in lightgrey, errors are clearly
visible.

What do I win if I put all my hilight in a color scheme ? Is it just
more elegant or really important for bugs or mistakes ? Actually I do
not understand a large part of your one ... and I am a little bit
afraid to try to do one like that.

That is my current vimrc file, if you have advise for me I will be
very glad !

http://germain.salvato-vallverdu.perso.sfr.fr/vimrc

Best

Germain

On Mar 3, 6:47 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:

Tony Mechelynck

unread,
Mar 4, 2010, 8:01:17 PM3/4/10
to vim...@googlegroups.com, Germain
On 04/03/10 09:29, Germain wrote:
> Thank you. Your first solution is not very pleasant ;) ! For the two
> following the cursorline become to much dark ... I do not really like
> that.
>
> Looking at your color scheme file, I took the syntax for the Error
> hilight and I simply change the fg color from white to blod red ! For
> the cursorline I did the same as you with a light grey bg. Thus with
> error in bold red on the cursorline in lightgrey, errors are clearly
> visible.
>
> What do I win if I put all my hilight in a color scheme ? Is it just
> more elegant or really important for bugs or mistakes ? Actually I do
> not understand a large part of your one ... and I am a little bit
> afraid to try to do one like that.

If you put all your highlight changes (compared to the default) in a
colorscheme with a name, then you can not only test a different
colorscheme and come back to your usual, you can also turn syntax
highlighting off and on without losing your "special" highlights, you
can change one highlight group temporarily (as I did for the CursorLine
group while writing my previous post in this thread, to check if what I
was saying made sense) then easily come back to your "normal" colours,
etc. *And* if you decide to change something in your colour scheme, you
can apply it "on the fly" without restarting Vim -- just save the
modified colorscheme and do ":syntax enable" or ":syntax on" -- I'm a
little fuzzy on the difference between the two.

In summary: I believe that it is both more elegant and easier to use
once done. Of course there is some initial investment (you must write
the colorscheme in the first place).

>
> That is my current vimrc file, if you have advise for me I will be
> very glad !
>
> http://germain.salvato-vallverdu.perso.sfr.fr/vimrc

...salvato-vallverdu, fr... Catalunya-Nord?

Maybe I'll look at that vimrc someday, but please, not today.

>
> Best
>
> Germain


Best regards,
Tony.
--
Too much of a good thing is WONDERFUL.
-- Mae West

Reply all
Reply to author
Forward
0 new messages