Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When hlsearch is on, the cursor inverts the search color and not visible #2

Closed
EDmitry opened this issue May 28, 2013 · 7 comments
Closed

Comments

@EDmitry
Copy link

EDmitry commented May 28, 2013

I have a little issue when searching. Gruvbox inverts the cursor color so that when the search is highlighted it's inverted once again. It's hard to spot the currently highlighted result if there are many present on the screen. I wonder what would be the best solution in this case. I really like inverted cursor, are there probably way to make it solid color when searching only?
Thanks.

@dathinaios
Copy link

+1

@morhetz
Copy link
Owner

morhetz commented Oct 2, 2013

That's what I came up with:

  1. Declare functions as follow gist:6795129
  2. Map this to search commands you use e.g. gist:6795169

So you'll get orange cursor when highlight search is on and inverted one otherwise. This should be pretty self-explainable, but if you still have any question feel free to ask. Yep, I feel shameful it took me so much time just to provide this simple solution.

Anyway I'll add these functions to the updated gruvbox theme file and try not to forget documenting it.

@morhetz
Copy link
Owner

morhetz commented Oct 3, 2013

Functions was added with the latest commit f2efaec. You could override cursor color (default: orange) at hls-mode with g:gruvbox_hls_cursor option. E.g.:
let g:gruvbox_hls_cursor="blue"

Remember that you still need to map these functions to search commands.

@blueyed
Copy link
Contributor

blueyed commented Nov 27, 2013

Is there a solution for :substitute with the "c" option (e.g. :%s/foo/bar/gc), apart from calling gruvbox#hls_hide() manually before?
The problem is that the cursor is not with the highlighted word, but at the bottom, asking for the confirmation options.

Additionally, g:gruvbox_hls_cursor does not appear to work with Vim in a terminal (gnome-terminal). Is that expected?

A workaround I have found is to set both cursorline and cursorcolumn (resulting in a crosshair, cox when using tpope's unimpaired plugin).

@morhetz
Copy link
Owner

morhetz commented Nov 28, 2013

@blueyed
Well I didn't really get your problem. What behaviour do you expect from substitute command? Not to highlight results?
So as with vanilla vim you should set :noh, with gruvbox you should call gruvbox#hls_hide() which could be easily mapped to Enter button, as I showed before.
Or you are disturbed with orange cursor while substituting with highlight search enabled?

I'll check gnome-term. Most terms don't allow you to recolor cursor, so I've never experienced this issue before

@morhetz morhetz reopened this Nov 28, 2013
@blueyed
Copy link
Contributor

blueyed commented Nov 28, 2013

@morhetz yes, I just thought there might be a way to also have some kind of inversion when using "substitute". What I mean is this: you cannot see which instance is highlighted:
selection_005
(I have a map to toggle hls already)

I think the main issue is solved, and I justed wanted to point out / ask about this corner case.

@morhetz
Copy link
Owner

morhetz commented Dec 8, 2013

@blueyed
Latest commit should have fixed that. Highlighting current substitution with the same g:gruvbox_hls_cursor color. Tested with GVim, Gnome Term and URxvt. However I still can't get it with Lilyterm.
PS. It suddenly started working for Lilyterm too

@morhetz morhetz closed this as completed Dec 9, 2013
minodisk pushed a commit to minodisk/gruvbox that referenced this issue Oct 29, 2014
Splinter1984 pushed a commit to Splinter1984/gruvbox that referenced this issue Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants