molokai
molokai copied to clipboard
revert MatchParen color changes
They make matched parens look exactly the same as the cursor. This is very confusing, so revert that change.
Why would this only affect the terminal version? What color is the cursor in the GUI version?
The matched parens are orange. I do not see the cursor being set to orange anywhere in this plugin, can you point to it?
The changes is better.
I also believe that the current colors on MatchParen are a little disorienting. To demonstrate:
hi MatchParen ctermfg=233 ctermbg=208 cterm=bold
hi MatchParen ctermfg=208 ctermbg=233 cterm=bold
If we go vertically the problem becomes even more apparent. It feels as if the cursor suddenly jumps away despite moving steadily up or down.
hi MatchParen ctermfg=233 ctermbg=208 cterm=bold
hi MatchParen ctermfg=208 ctermbg=233 cterm=bold
These were taken on Ubuntu 14.04 (vbox), using vim and tmux in gnome-terminal.
Relevant configuration files:
.vimrc
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
colorscheme molokai
.bashrc
export TERM=screen-256color
.tmux.conf
set -g default-terminal "screen-256color"
@justinmk sorry but I didn't find time to provide any additional info, the gifs @nstratos provided wonderfully display what was happening to me. thanks @nstratos!
It feels as if the cursor suddenly jumps away despite moving steadily up or down.
Then set noshowmatch
or fix it locally. Don't change the upstream colorscheme to suit your showmatch
preferences.
@shime Always happy to help!
@justinmk Indeed, we have not approached the issue correctly. It seems that the issue is caused by the fact that the cursor seems to be "disappearing" when it goes on a parenthesis or a bracket but only on the terminal version.
vim terminal version (cursor "disappears" on brackets and parentheses)
gvim (works great!)
Unfortunately I am not able to pinpoint why that happens. Any ideas?
Doesn't happen in my terminal. Note that I have my terminal cursor set to not blink. At any rate this is not a colorscheme issue.
@justinmk I set my cursor to not blink as well but it still "disappears". I assumed that it might be a color scheme issue (only for terminals) since it seems that the cursor becomes the same color as the background when it goes to a bracket or parenthesis (and when using the default color scheme I do not have that issue). Ideally both the cursor and the matched parenthesis should remain visible. But since that doesn't happen on your terminal maybe it's a problem that just me and @shime have, or maybe platform specific (Ubuntu, gnome-terminal for me).
yup, I'm using gnome-terminal too.
+1 I jus to apply this patch to my own molokai fork and now I can look to my brakets and parentesis without stress :D
I was also able to replicate the issue using termite. It seems to be an incompatibility with libvte, which both termite
and gnome-terminal
are based on.
I don't know enough about VTE to comment, but it seems like this could be something wrapped in a colorscheme-level option.
VTE's cursor is, by default, a full rectangle which reverses the colors underneath. Moreover, if blinking is enabled, (as clearly seen on the gifs above before the problem occurs) blinking restarts with a complete "on" phase after each cursor movement.
I suspect that this color scheme highlights both parentheses, that is, both the one under the cursor and its counterpart. Hence at the cursor's cell a double reverse make it look like it wasn't changed.
I think it'd be a better approach for the color scheme to highlight the counterpart only, and not the one under the cursor.
In GNOME Terminal's Profile Preferences you can change the cursor shape to I-Beam or Underline (see https://bugzilla.gnome.org/show_bug.cgi?id=772134 for how make them wider) (I personally use I-Beam which works wonderfully in every app except vim which has an IMO crazy braindamaged legacy idea about the cursor, being one of the reasons I don't use vim), and you can also specify a concrete foreground+background color pair for the cursor. Either of these could mitigate the problem.
Ah yes. Thank you very much for the input @egmontkob .
I really don't know much about the subject (obviously), but here's what I've gathered so far:
-
VTE Draws a full rectangle as the cursor, the color of the cursor is the color of the foreground below it (ie the color of the text it's selecting), and the text color is inverted so that it can be seen through the cursor. Essentially, whatever color the text is, VTE's cursor becomes that.
-
The change introduced in https://github.com/tomasr/molokai/pull/34 turns the foreground of parenthesis pair to 233 (#121212), which is the same color that molokai uses for its background.
-
Therefore, when VTE terminals encounter a matched parenthesis, the foreground changes to the same color as the molokai background, VTE's cursor becomes that color and disappears. Meanwhile, the background has changed to orange (#FF8700), so when the cursor blinks off, the orange background shows up.
In this case, VTE's method of cursor-coloring does not seem like a "special snowflake" and this definitely seems like an issue with the colorscheme.
But I'm also now seeing https://github.com/tomasr/molokai/commit/e7bcec757319cbfe23b40452f70dad8ad98d021e ... there's just no easy way to solve this problem.
I think it'd be a better approach for the color scheme to highlight the counterpart only, and not the one under the cursor.
That behavior change would need to be made in Vim's matchparen plugin, rather than the colorscheme.
I guess it might be worth to file a feature request. Your call.
I had the same problem and changed the color on line 180 like this:
hi MatchParen ctermfg=cyan ctermbg=208 cterm=bold
I had put cyan
because I don't know how the 3 digits translate into colors and it is very easily visible.
Also, this seems to only affect the terminal.
@ddaza For the colors see https://commons.wikimedia.org/wiki/File:Xterm_256color_chart.svg .
thanks @egmontkob
cyan === 014
hi MatchParen ctermfg=014 ctermbg=208 cterm=bold
This totally works I dunno how peeps feel about this change.
@ddaza - I think that's a great solution. It may not look the prettiest, but it does what it needs to do and will probably work nicely in both terminal and GUI.
Do you think it would be a good idea to use color 081 (#5fd7ff) instead, since that color is already used in the colorscheme? I don't think cyan is used anywhere.
I think reverting the colors as suggested before looks even better. It only affects the terminal version anyways.