Help can anybody tell me my search string background color need to be change

32 views
Skip to first unread message

Kunal Chauhan

unread,
Apr 27, 2020, 7:22:00 AM4/27/20
to vim_use
hi team,

I search text and then press shift * but the string is not properly highlighted the background color I want to change.


Thanks
kunal 

Tim Chase

unread,
Apr 27, 2020, 8:17:23 AM4/27/20
to Kunal Chauhan, vim...@googlegroups.com
On 2020-04-27 04:00, Kunal Chauhan wrote:
> I search text and then press shift * but the string is not properly
> highlighted the background color I want to change.

I'm not sure which colorscheme you're using, but I created my own
(based on an existing one) and set the colors I wanted in it. So you
would have something like

hi Search term=reverse ctermbg=yellow ctermfg=black guibg=yellow guifgi=black

adjusting your colors as you see fit (I believe the default is
black-on-yellow).

-tim





Kunal Chauhan

unread,
Apr 27, 2020, 9:15:18 AM4/27/20
to Tim Chase, vim...@googlegroups.com
Hi  tim,

It is not working for me. 
this is giving error "hi Search term=reverse ctermbg=yellow ctermfg=black guibg=yellow guifgi=black  " iillegal argument last one argument I corrected 
but still it is not working no change on my vim editor.
 1.I am using mobax term and under which I am using vim.
2. my vim background color is black and foreground text is white.
3. I search the text , then cursor come on text found and then press shift +*  but it did not highligh the whole word only first character is highlighted.

--
Thanks with Regards!

Kunal Chauhan
Mob:09813614826
Mob:08860397903

Tony Mechelynck

unread,
Apr 27, 2020, 10:25:01 AM4/27/20
to vim_use, Tim Chase, Kunal Chauhan
On Mon, Apr 27, 2020 at 3:15 PM Kunal Chauhan <atkunal...@gmail.com> wrote:
>
> Hi tim,
>
> It is not working for me.
> this is giving error "hi Search term=reverse ctermbg=yellow ctermfg=black guibg=yellow guifgi=black " iillegal argument last one argument I corrected
> but still it is not working no change on my vim editor.
> 1.I am using mobax term and under which I am using vim.
> 2. my vim background color is black and foreground text is white.
> 3. I search the text , then cursor come on text found and then press shift +* but it did not highligh the whole word only first character is highlighted.

There are two highlight settings which might be involved: one (Search)
for all matches for the latest pattern, and another one (IncSearch)
for the next match for the pattern you are typing between hitting / or
? and the corresponding <Enter>. To see how they are set on your Vim,
and where (if anywhere) those settings were defined, use

:verbose exe "hi Search" | hi IncSearch

When I do this after starting "vim -u DEFAULTS", the answer (in Vim 8.2.646) is

Search xxx term=reverse ctermbg=11 guibg=Yellow
IncSearch xxx term=reverse cterm=reverse gui=reverse

With my usual vimrc and my homemade colorscheme the answer in gvim is

Search xxx term=reverse ctermfg=0 ctermbg=14 guibg=Yellow
Last set from ~/.vim/colors/almost-default.vim line 22
IncSearch xxx term=reverse cterm=reverse gui=reverse
Last set from ~/.vim/colors/almost-default.vim line 22

In both cases both search-related highlights are set the way I want them to be.

See also
:help :colorscheme
:view $VIMRUNTIME/colors/README.txt
:help :highlight (which is two long sections, numbered 13 and
14 in that helpfile)

Best regards,
Tony.

Gary Johnson

unread,
Apr 27, 2020, 11:20:51 AM4/27/20
to vim...@googlegroups.com
On 2020-04-27, Kunal Chauhan wrote:
> Hi  tim,
>
> It is not working for me. 
> this is giving error "hi Search term=reverse ctermbg=yellow ctermfg=black guibg
> =yellow guifgi=black  " iillegal argument last one argument I corrected 
> but still it is not working no change on my vim editor.
>  1.I am using mobax term and under which I am using vim.
> 2. my vim background color is black and foreground text is white.
> 3. I search the text , then cursor come on text found and then press shift +* 
> but it did not highligh the whole word only first character is highlighted.

What is your 'hlsearch' setting?

:verbose set hlsearch?

It defaults to off but must be on for highlighting to be applied to
highlight the entire text of a search match. See

:help 'hlsearch'

HTH,
Gary

Kunal Chauhan

unread,
Apr 27, 2020, 12:12:43 PM4/27/20
to vim...@googlegroups.com
1. when I do :verbose set hlsearch  , it gives or highlight all the string with background to yellow and foreground white is all search strings.

2. help hlsearch // what to see in it ,i am not able to get points from help ?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200427151936.GD28061%40phoenix.

Kunal Chauhan

unread,
Apr 27, 2020, 12:25:46 PM4/27/20
to vim...@googlegroups.com
Also I have noticed right now "verbose set hlsearch" is working when separately opening file but when I use cscope -R and from there I entered in file there it is not working ?

Gary Johnson

unread,
Apr 27, 2020, 1:58:24 PM4/27/20
to vim...@googlegroups.com
On 2020-04-27, Kunal Chauhan wrote:

> On Mon, Apr 27, 2020 at 8:50 PM Gary Johnson wrote:
>
> On 2020-04-27, Kunal Chauhan wrote:
> > Hi  tim,
> >
> > It is not working for me. 
> > this is giving error "hi Search term=reverse ctermbg=yellow ctermfg=black
> guibg
> > =yellow guifgi=black  " iillegal argument last one argument I corrected 
> > but still it is not working no change on my vim editor.
> >  1.I am using mobax term and under which I am using vim.
> > 2. my vim background color is black and foreground text is white.
> > 3. I search the text , then cursor come on text found and then press
> shift +* 
> > but it did not highligh the whole word only first character is
> highlighted.
>
> What is your 'hlsearch' setting?
>
>     :verbose set hlsearch?
>
> It defaults to off but must be on for highlighting to be applied to
> highlight the entire text of a search match.  See
>
>     :help 'hlsearch'
>
> HTH,
> Gary

(I took the liberty of reformatting your post from top-posting to
bottom-posting style so that I could read it more easily.)

> 1. when I do :verbose set hlsearch  , it gives or highlight all
> the string with background to yellow and foreground white is all
> search strings.

The command I wrote included the question mark (?) at the end.

:verbose set hlsearch?

That command will tell you the current setting of 'hlsearch' and
where it was last set.

I don't understand why the foreground of your search highlighting is
white. The Search highlight setting that Tim gave you should have
set the foreground to black. It does for me.

> 2. help hlsearch // what to see in it ,i am not able to get points
> from help ?

I just added that for reference, so that you could read more about
the 'hlsearch' option if you wanted to.

I don't completely understand the problem. What do want to see when
you search and what are you seeing instead? Also, what are the
results of these commands:

:hi Search
:version

Regards,
Gary

Gary Johnson

unread,
Apr 27, 2020, 2:06:01 PM4/27/20
to vim...@googlegroups.com
On 2020-04-27, Kunal Chauhan wrote:
> Also I have noticed right now "verbose set hlsearch" is working when
> separately opening file but when I use cscope -R and from there I entered in
> file there it is not working ?

I would think that once you set 'hlsearch', it would stay set until
you explicitly changed it. Perhaps some plugin is setting it to
off. If you add the question mark (?) to that command as I wrote
a moment ago, you should see what set 'hlsearch' to off. So, after
you execute your cscope command, execute

:verbose set hlsearch?

with the question mark included. That should tell you what set
'hlsearch' to off.

Regards,
Gary

Tim Chase

unread,
Apr 27, 2020, 3:26:26 PM4/27/20
to vim...@googlegroups.com
On 2020-04-27 10:57, Gary Johnson wrote:
> The Search highlight setting that Tim gave you should have
> set the foreground to black. It does for me.

...modulo my fat-fingered typo:

guifgi=black

should have been

guifg=black

-tim


Kunal Chauhan

unread,
Apr 28, 2020, 8:47:51 AM4/28/20
to vim...@googlegroups.com
`Hi 
, I have tried just with  : hi Search ctermbg=LightBlue" it works as initially I tried with verbose command
but  I have puted in my .vimrc it is only showing yellow background and white text as I search by "/text" in vim 

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.

Kunal Chauhan

unread,
Apr 28, 2020, 8:52:48 AM4/28/20
to vim...@googlegroups.com, Tim Chase
Hi 
, I have tried just with  : hi Search ctermbg=LightBlue" it works as initially I tried with verbose command
but  I have puted in my .vimrc it is only showing yellow background and white text as I search by "/text" in vim 

On Tue, Apr 28, 2020 at 12:56 AM Tim Chase <v...@tim.thechases.com> wrote:
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.

Tim Chase

unread,
Apr 28, 2020, 4:29:51 PM4/28/20
to Kunal Chauhan, vim...@googlegroups.com, Tim Chase
On 2020-04-28 18:22, Kunal Chauhan wrote:
> , I have tried just with : hi Search ctermbg=LightBlue" it works as
> initially I tried with verbose command
> but I have puted in my .vimrc it is only showing yellow background
> and white text as I search by "/text" in vim

I suspect your vimrc sets your colorscheme after you explicitly set

:hi Search …

That means that your setting gets overridden by your colorscheme.

This is why I recommended forking your favorite color-scheme into,
say, ~/.vim/colors/kunal.vim and then making the modifications there.
Then you can change your vimrc to have

colorscheme kunal

for whatever colors you prefer.

-tim


Reply all
Reply to author
Forward
0 new messages