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

Cursor is not visible while Gruvbox light #35

Closed
thekaganugur opened this issue Dec 18, 2018 · 5 comments
Closed

Cursor is not visible while Gruvbox light #35

thekaganugur opened this issue Dec 18, 2018 · 5 comments

Comments

@thekaganugur
Copy link

thekaganugur commented Dec 18, 2018

I use gruvbox in neovim. Problem appears in light version.
Expected behavior (Screenshot is from alacritty)
2018-12-18-180900_934x1019_scrot
What is happening(Screenshot from st)
2018-12-18-180941_934x1019_scrot

Theme is morhetz/gruvbox
set termguicolors is on

@LukeSmithxyz
Copy link
Owner

Did you set these colors in Xresources or in the source code?

I just activated gruvbox light colors from Xresources and I don't get this problem in neovim. Mind showing exactly what your settings/changes are?

@thekaganugur
Copy link
Author

thekaganugur commented Dec 18, 2018

Did you set these colors in Xresources or in the source code?

I just activated gruvbox light colors from Xresources and I don't get this problem in neovim. Mind showing exactly what your settings/changes are?

I just changed Xresources to gruvbox light and problem disappeared. Yet I want to use dark scheme for the terminal itself. In Vim I change color-scheme to light on daylight, dark scheme otherwise. Do I need to change Xresources for this? I don't understand how this works. I basically use morhetz/gruvbox plugin. Doesn't it overwrite all those values?
In alacritty default color-scheme for terminal is dark, yet the problem doesn't happen.

@LukeSmithxyz
Copy link
Owner

So you want a dark terminal but a light vim? Your problem is probably that the vim colorscheme doesn't set a cursor color for each them. I guess you can add that manually if you'd like (I suppose it's possible, but I don't know about or use vim colorschemes).

@terriblephrases
Copy link
Contributor

terriblephrases commented Dec 19, 2018

I tried xterm and urxvt and they do the same thing as st here - the cursor color stays the same across ":set bg=light/dark".

The reason Alacritty behaves differently seems to be it automatically reverses cursor color, rather than use a set one.
Here's a StackExchange question with answers on the same issue.

A solution would be to set the defaultbg, defaultcs etc to their their own indexes after 255 in st's config.h:

static const char *colorname[] = {
    [256] = "#282828",
    [258] = "#ebdbb2",
};
unsigned int defaultbg = 256;
static unsigned int defaultcs = 258;

// If you want to set cursor color with Xresources, you need this:
ResourcePref resources[] = {
// Luke removed the cursorColor line earlier today
// If you want to set the cursor color with Xresources, put it back
    { "cursorColor",  STRING,  &colorname[258] },
};

... and put this in .vimrc:

	" set st cursor and background to contrasting colors on start
	silent !echo -ne "\033]4;258;\#3c3836\x7\033]4;256;\#fbf1c7\x7"
	" reset cursor and background  when vim exits
	autocmd VimLeave * silent !echo -ne "\033]104;258\x7\033]104;256\x7"

	" You can also change colors depending on Vim mode:
	" use an orange cursor in insert mode
	let &t_SI = "\033]4;258;orange\x7"
	" use red cursor otherwise
	let &t_EI = "\033]4;258;red\x7"

]4;colorindex;colorname is one of few a OSC escape codes st implements
]104;colorindex resets color index to default

Result:
image

@thekaganugur
Copy link
Author

@terriblephrases Thank you for clarifying the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants