-
Notifications
You must be signed in to change notification settings - Fork 37
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
Delimiter matching in vim is hard to read #9
Comments
Thank for the feedback! Hmm... I'm not sure how snazzy has configured the cursor color differently from the rigel theme. In my case, the cursor color is set by my terminal (in this case I'm using kitty which has a rigel theme too). |
Just to be clear, that only happens when I'm hovering over matched delimiters. If I'm hovering over regular characters, the cursor looks totally normal. |
Okay, this is getting a little weird. I can confirm that this issue doesn't affect kitty for me (regardless of the kitty colorscheme), but it looks different than yours. If I don't focus the vim window, it looks pretty similar to yours: but if I do focus the window, it looks like this: where the cursor isn't matching, but it's also not identical to the background color. (I'm hovering the right brace in both cases) xterm has similar behavior, but most of my other terminal emulators (Konsole, gnome-terminal, and alacritty) look like my first screenshot (in the OP) when focused. They look fine (a lot like yours) when the window isn't focused though. Changing the color scheme in Konsole doesn't seem to affect the behavior of the cursor--it's still nearly-invisible. This is strange. |
After some investigation, it seems vim uses the terminal curosor color. The built in highlighting variables such as Turns out it is possible to dynamically change the terminal's cursor colour from within vim. But this only works for some terminals. (Source 1, Source 2). To fix your issue, you could try the snippet used in "Source 2" above? Or perhaps you could configure the cursor colour in your Konsole terminal config? |
Tried to do the configuration in my Konsole config. Is this what you meant? It doesn't seem to fix it :( After reading Source 1, I don't think that applies to me right now. My vim appears to be using the gui colors--in fact if I switch to As far as snippet 2 goes, I'm actually using neovim at the moment, and it already has support for this by default (I did confirm that the bug affects both neovim and vim though). I've managed to semi-fix this issue by replacing a line in The line I'm changing right now is the MatchParen line, to |
I think I understand now. The issue is that some of my colorschemes don't have default cursor colors and attempt to infer the draw colors from context. Some of them do what kitty does, and use predefined cursor block/text colors (options 1,2 in the linked comment). Others, like Konsole, will attempt to invert the bg/fg colors on the cell the cursor is on, so that the text is drawn in the bg color and the block is drawn with the fg color (option 3 in the linked comment). Since I can make this behavior disappear in Alacritty by explicitly setting a cursor color. If I do this, the problem is not present: while if I comment out the cursor colors and let Alacritty try to decide the cursor colors, it is there: So this issue seems to be an interaction between how the terminal emulator chooses to render a block cursor, how vim syntax highlighting works, and the color scheme itself. I see a few ways for me to fix this on my end:
Do you think there's another way to fix this? |
Great work laying this all out. This is pretty much my conclusion too. My preferred fix is your option 2: I think the terminal theme config itself should define a color for the cursor. This is the only way I can figure out how to change color of the cursor. I tried applying your patch for The accompnaying Would be cool to have a Konsole |
One thing about Konsole that I discovered while trying to troubleshoot this is that while you can set the cursor color from the GUI settings, you can't seem to set a text color. This means that e.g. if you set a yellow cursor, red text is rendered as red text against a yellow cursor, which is...less than optimal. I found an issue on solarized-light that seemed to mirror the one I described here. Their solution was to invert the fg/bg colors while changing one of them to have slightly more contrast. I might give it a go later and see if that fixes it as well--I don't know if it'd be possible to do it without ruining the colorscheme too much though. |
Ah okay cool. Well, I appreciate the effort you've put into debugging this! This is tricky one. |
Hi there!
Thanks for the work on this colorscheme!
One thing I've noticed in vim is that, with this colorscheme, the automatic delimiter highlighting gets a little tricky to read. For example, in the following screenshot, my cursor is actually on the last parenthesis of the line: the blue block after
empty
is just the matching delimiter highlighting.In this example, it's not too bad, but in large codebases where delimiters may be very far up the page, it causes me to lose track of my cursor sometimes.
I looked over the docs, but I couldn't see a mention of this. Have I missed a setting that controls this or do you know if there's a different setting that interferes with coloring? The same screenshot with the Snazzy colorscheme looks like this:
In case it matters, my
vimrc
is here, and the terminal emulator is Konsole.The text was updated successfully, but these errors were encountered: