about cursorline
Karmenzind opened this issue · 10 comments
Some plugins do need the visible cursorline to show particular infomation.
I tried set cursorline
after initializing the colorscheme but it didn't work.
So I wonder if you can add something like enable_cursorline
?
Thanks a lot.
I also tried highlighting the cursorline on my own, but it turned out really ugly ... 😂
This issue helped me a lot to improve the colorscheme. Update it and let me know if it works now for neovim. Thanks! :)
Glad to try it.
I updated the plugin to v3.1.2 but there is no cursorline in vim(8.1) or neovim(v0.3.1) with set cursorline
.
Do I need to add extra settings to make it work?
I'm using xfce4-terminal.
How does it look like?
It should look like this by default (it's rxvt-unicode configured with atomic colors):
cursorline
has a dark grey background, like colorcolumn
The following screenshot is xfce4-terminal with tango colors:
I would like to see your screenshot. What do you see and how should it be? Tell me the name of the plugins as well, so I will test them. Thanks in advance :)
It works for me into tmux, even using the same $TERM and the $TERM screen-256color
. I'm using tmux 2.7. I checked the tmux changelog (from 2.7 and 2.8) and I don't see anything that could cause conflicts.
Using tmux without configuration, Vim does not show the cursorline
. It's because then terminal uses 8 colors, and the result of tput colors
= 8. Under this case, vim-atomic will use only 8 colors, so cursorline is not displayed. (However, in your second screenshot, cursorline is not displayed, but cyan colors are 2, so it's using the 16 colors palette. Really, a mistery.)
If I put only the following line into the file ~/.tmux.conf
:
set -g default-terminal 'screen-256color'
The cursorline appears again, but also the 16 default colors of vim-atomic. In this case, the result of tput colors
= 256.
Could you try with a very basic tmux config?
Thank you.
I tried in new tmux session with no .tmux.conf
file or with only set -g default-terminal 'screen-256color'
but the cursorline didn't show.
I'm gonna try tmux 2.7 later.
I suggest you to use tmux-256color
which is created by tmux itself.
Yeah, I used tmux-256color
some months ago, however I switched to screen-256color
because it works better for URxvt and XTerm terminals without compiling customized terminfo files.
Anyway, using any terminal with a minimal configuration of tmux like this one:
set -g default-terminal 'tmux-256color'
And using this command in vim/neovim:
:hi CursorLine ctermbg=red
... or this one if you have set termguicolors
:
:hi CursorLine guibg=red
... should paint the CursorLine background in the red color. It's overriding the colorscheme.
(It's guibg
instead of ctermbg
).
Also, under this conditions:
if (has('termguicolors') && &termguicolors) || has('gui_running')
Vim and Neovim recalculate the values of a color from a True Color palette (~16 milions of colors → 256^3) into a new color very similar in a smaller palette of 256 colors. So in some modes of vim-atomic (AtomicDarkCyanSoft
and AtomicDarkOrangeSoft
), it can't find a different color between base1
(background) and base2
(CursorLine) colors. That's because they have a 3% difference of Luma, only. This recalculation causes that base1
and base2
get the same color assignation, so it looks like CursorLine is not displayed. If this is the case, this command mentioned before should paint the CursorLine for sure:
:hi CursorLine guibg=red
So a fix for this case is to configure the colors palette in the terminal. In my case (URxvt), I use shortcuts in the ~/.Xresources
file to switch the exact color palette (Ctrl+{0..9}). For gvim it works automatically as it supports True Color without recalculations. Take a look at these lines of my config:
https://github.com/gerardbm/dotfiles/blob/master/X11/.Xresources#L127:#L161
Actually, I calculated the atomic color palettes with precision to be used exactly as they are, without recalculations. For this reason I avoid termguicolors
, to avoid different colors.
Let me know if this information helps :)
Edit: what I don't understand is why this recalculation works fine out of tmux and it does not work identically inside tmux. I'm having the same issue, as well.
Edit 2: it's because terminal-overrides
variable from tmux. Try this setting and you will see how now it doesn't recalculate any color, so it represents the colors perfectly.
set -g default-terminal 'xterm-256color'
set -ga terminal-overrides ",xterm-256color:Tc"
Keep in mind every terminal needs a different $TERM and a different tmux configuration with a specific Vim/Neovim configuration (they are different) to have all the things working fine: cursor shapes, italics, "italic,underline", all the colors, etc. What works for Konsole, does not work for gnome-terminal, for example. In this case, Alacritty works perfect using the mentioned tmux.
Nice! You're welcome. I'm glad it worked :)
This link is also helpful to understand some things about colors inside and outside tmux. https://github.com/tmux/tmux/wiki/FAQ