jnurmine / Zenburn

Zenburn is a low-contrast color scheme for Vim.
http://kippura.org/zenburnpage
891 stars 149 forks source link

Vim 8 terminal colours #30

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi,

This is a brilliant theme, I have used the Emacs version of it for a long time. I feel like simplifying things and start using Vim. In Vim 8, when I open a terminal within Vim, this colour scheme doesn't apply to it. But other colour themes such as "nord" apply to both the buffers and the terminal buffer.

Thanks.

jnurmine commented 4 years ago

Hi, thanks for reporting this.

Looks like the g:terminal_ansi_colors is not set.

Cheers

jnurmine commented 4 years ago

I'll soon upload a fix with nicer coloring. They have the same color order as the terminal usually has.

The terminal is not tinted towards some specific color (that could be for future work).

Looks like the terminal coloring feature needs Vim 8.2.0+ Please note, it seems one must use "set termguicolors" when running Vim in a terminal.

Please let me know if it works better, closing for now.

Cheers!

ghost commented 4 years ago

Hi,

Thanks, the terminal colours are as what is usually in the terminal outside Vim now'. The background is still black. I had the termguicolors set. Also, if you don't mind me saying, the relative line numbers' colouring stands out a little too much a bit distracting, I felt like the line number colours could be muted more and the background of the left gutter be a bit more grey just a shade or two different from the main background.

Thanks.

jnurmine commented 4 years ago

Hi,

hmm, about the line numbers colouring, you are right. Now that you pointed it out it is a standing out a bit too much.

I added a switch called g:zenburn_subdued_LineNr.

Here is a picture of it enabled in low high contrast mode in the GUI:

image

And here in high low contrast mode in the GUI:

image

Edit: typos

jnurmine commented 4 years ago

PS. I added a fix now for the terminal colouring, use ANSI colors for Vim 8.2.0+, otherwise the older one. It looks like the Terminal highlight group disturbed the background. Now the terminal looks more as intended.

Does the terminal now look as you expected?

ghost commented 4 years ago

Sorry for late reply. All looks great now! Except the highlight of the numbers gutter with set cursorline. The current line's number gets underlined with yellow.

jnurmine commented 4 years ago

Hi, can you please attach a screenshot?

I don't see the underline, with or without :set cursorline, I have tried terminal and vim -g for different versions... Do you have some other setting enabled?

ghost commented 4 years ago

Here is a screen shot. I launched Vim without the .vimrc, set the colorscheme and then the cursorline.

Screenshot from 2020-09-08 20-20-39

jnurmine commented 4 years ago

Thanks, I can see it with Vim 8.2:

image

But with 8.0 no such thing:

image

The syntax file is exactly the same in both cases.

It looks like Vim overrides cterm=underline always, possibly due to commit 017ba07fa2cdc5 in 8.1.2029.

Not sure yet how to solve this, explicitly specifying cterm doesn't help.

jnurmine commented 4 years ago

Looks like explicit cterm=none works, but the colorscheme must be loaded at Vim startup time i.e. Vim must be restarted for this change to take effeect.

There's a fix now, can you please check if it's OK?

ghost commented 4 years ago

Your fix works, thanks. Following your code above, I've put this right at the end of the .vimrc

set cursorline    
highlight CursorLineNR cterm=NONE ctermfg=234 ctermbg=234 guifg=#424242 guibg=#1b1b1b

I am trying to make the line highlight not effect the gutter at all, but I can't get the background colour right, I got the colours from your zenburn.vim file. What is the correct gui background colour for the gutter? Do you know if there is an easier way to disable the highlight in the gutter altogether?

jnurmine commented 4 years ago

Hi, there should not be need to specify highlight CursorLineNR since Zenburn has the cterm=none now.

Anyway, you should get a newer Vim, like 8.2 and then do :set cursorlineopt=line to avoid highlighting the gutter.

Edit: just to be clear, grab the newest Zenburn and you get commit 4ec3795d81 "Fix underlined CursorLineNr in gutter" which does the cterm=none.

ghost commented 4 years ago

Ah, that's great! Thank you so much!