dracula / vim

🧛🏻‍♂️ Dark theme for Vim
https://draculatheme.com/vim
MIT License
1.34k stars 455 forks source link

background color break after update #65

Closed Saul-Mirone closed 6 years ago

Saul-Mirone commented 6 years ago

Hi, I'm using vim in iTerm on macOS. My iterm theme is dracula as well. It works well for years. I update dracula today and my iterm color is so werid,and the background image disappear, what happend?

BEFORE I UPDATE

that

AFTER I UPDATE

this

Saul-Mirone commented 6 years ago

some hightlight break too, look at the arrows.

BEFORE

image

AFTER

image

Saul-Mirone commented 6 years ago

visual mod breaks too

Saul-Mirone commented 6 years ago

JSX is the worest..... image

ghost commented 6 years ago

This is happening to me too, but with the terminal app. Background is dark grey instead of the default Dracula background.

dsifford commented 6 years ago

Fixes for @Saul-Mirone: Your terminal does not support italics. Or, if it does, your terminfo is not correct (which is why the italics are appearing inverted).

Try disabling the italics with let g:dracula_italic = 0 in your vimrc

Fixes for @braddielman: Add set termguicolors to your vimrc.

dsifford commented 6 years ago

@Saul-Mirone -- Re: Background image. To get that back you'll need to add a reset to the Normal highlight group.

so, for example: highlight Normal cterm=NONE term=NONE

~I'm not going to revert back to that because you and potentially a few others out there are in the minority when it comes to wanting a transparent background.~

Edit: I may revert to a system that falls back to transparent based on t_Co and/or termguicolors -- Either a direct fallback or add an option flag. Let me think about the best way to approach this.

dsifford commented 6 years ago

@braddielman: Terminal App might not suffice for the fix that I suggested above as I'm not sure that that terminal supports truecolor.

If that's the case, you're seeing the gray because that's the closest 256 color fallback. See #60

ghost commented 6 years ago

@dsifford - Yeah, using set termguicolors sets the background to bright yellow. The theme was working prior to the update, however. It's cool though since I mainly use MacVim.

richnotwealthy commented 6 years ago

I'm on iTerm2 and my background color has also changed to match the airline gray. It was working until I did a vim-plug PlugUpdate a few minutes ago...

richnotwealthy commented 6 years ago

set termguicolors seems to fix the issue outside of tmux, but when in tmux it looks like it completely breaks syntax highlighting

dsifford commented 6 years ago

@rivyx Haha, yeah I'm a tmux'er myself and there's a few things that you need to do to make it play nicely...

Can you confirm that you have the truecolor overrides in your tmux.conf and the correct terminfo file is being read by tmux?

richnotwealthy commented 6 years ago

@dsifford the terminfo is the same for both my iTerm2 and my tmux (xterm-256color) and in an effort to keep my dotfiles portable I'd rather not implement truecolor overrides...just from a quick google it looks like a bit more overhead than I'm comfortable with

EDIT: https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be

Actaully, it doesn't look too bad. I will try this out after work and report back later. Until then, is there a solution which does not require truecolor overrides?

Thanks again

dsifford commented 6 years ago

Adding truecolor support with iterm should be no more than just adding a single line to your tmux.conf.

Adding a terminfo fix is only relevant if you want to make italics work correctly.

dsifford commented 6 years ago

For example, here's the line from my tmux.conf.

The relevant portion of that line with respect to truecolor is the ,*:Tc.

Saul-Mirone commented 6 years ago

@dsifford Thanks for response. I tried disabling the italics, but the highlight and visual mod still not works correctly image (I select the "$ char '0'" using the visual mod but it seems still can't work, and the Integer highlight seems wrong)

Then I tried add italics for my terminal by followying [this].(https://apple.stackexchange.com/questions/266333/how-to-show-italic-in-vim-in-iterm2) I succeed but nothing seems changed.

Saul-Mirone commented 6 years ago

I forked and checkout to the commit 1f44625 Everything works fine now.

For Dracula, What important to me is that it can be used together with it's iterm and zsh themes. So I can do every thing in terminal. (I use solarized in gui vim). Thanks for the guys who contribute to this awesome theme, but these day's update seems break the most important advantage for some guys like me, so I have to use an old version managed by myself. I write this because I think it maybe useful for you guys to maintain this project.

dexrualo commented 6 years ago

I'm having @Saul-Mirone's issue too. Some keywords have cyan highlighting. And when I source my .vimrc from within vim, I get this output: screen shot 2018-03-30 at 12 35 00 pm

larshisken commented 6 years ago

I'm using Vim8 in iTerm2 3.1.5 (also with dracula theme), using the following settings in this exact order fixed both issues for me:

let g:dracula_italic = 0
colorscheme dracula
highlight Normal ctermbg=None
dsifford commented 6 years ago

@larshisken Bingo!

Thanks for centralizing everything for people who are reading this thread.

Again, I'll likely add in a flag to disable the ctermbg in the Normal group when I get some free time.

@Saul-Mirone You're more than welcome to maintain a fork, but again the entirety of your issue boils down to having ctermbg set. So you're sort of creating more work for yourself.

If you can hold off for now, just add in the fix that @larshisken has above and I'll add in that flag soon.

richnotwealthy commented 6 years ago

@dsifford So I got it working fine on my local instance of tmux inside of iTerm2 now that truecolors has been enabled and I've changed my terminfo to support italics and truecolors. However, I am now getting a seemingly related issue on Konsole (Kubuntu 16.04) inside of tmux (with terminfo and truecolors properly set).

image

Also, I like using this theme on remote servers and I definitely don't always have the option of setting up truecolor overrides on there.

Honestly, this update has really made working with this package a lot more difficult. I don't know what was wrong with the previous background color configuration, but until this issue is fixed/truecolors are optional, I am going to fork the project from a previous version...

dsifford commented 6 years ago

What's the unrelated issue you're getting?

Also, re: remote servers -- I adopted the same fallback mechanism for that that gruvbox uses: https://github.com/dracula/vim/blob/master/colors/dracula.vim#L28

If in the case that the remote server passes the fallback, setting the flag to disable ctermbg should make the theme work fine on remote servers.


Side note: I'm receiving a lot of flack here because of the update. I'll say this again: Nobody is stopping you from forking this and maintaining your own implementation that satisfies whatever look you're going for. The update was done for two reasons:

  1. The colors were out of specification.
  2. The theme was difficult to maintain and difficult to extend with additional highlight groups.

I can't make everybody happy, so as a second best, I'm forced to make changes based on what a majority of users would agree upon.

Thanks for understanding.

richnotwealthy commented 6 years ago

Now getting the same issue inside of tmux on local Konsole (Kubuntu 16.04) and while inside of tmux on a remote server. This screenshot is from vim running in tmux on a remote server inside of iTerm2. It is the same problem from my previous comment (that screenshot was from my Kubuntu machine). It looks like the background color is being set correctly everywhere except the text characters (they have a gray highlight).

For Konsole, this problem persists even with truecolors set. For the remote server, I have ctermbg disabled and am getting the same problem.

image

EDIT: I reverted a lot of settings that I've been messing with and it looks like termguicolors was the problem there. Everything seems to be working now. Thanks for the help.

dsifford commented 6 years ago

@rivyx The issue you're describing above is likely related to the ostensible fact that you have termguicolors indiscriminately enabled.

To get it to play well for all situations, you need to add a check in your vimrc that checks the environment you're in and then enables termguicolors based on that. If termguicolors is not enabled, then you should also (for now, until I get a chance to add the flag), add in a downgrade of the Normal highlight group so that ctermbg=NONE

Hope that makes sense.

richnotwealthy commented 6 years ago

@dsifford Yes, it looks like I realized that just as you were commenting. Also, sorry if I sound ungrateful, I do appreciate the work you've been putting in as well as all the help you've been providing for everyone. It was just very frustrating for a little while which I'm sure you get.

That being said, if it is possible to somehow tell dracula to set these settings automatically based on the current environment, that would be great! Thanks again...I luckily did not have to fork haha.

EDIT: Updating the instructions at https://draculatheme.com/vim/ would also be helpful for future users :).

Saul-Mirone commented 6 years ago

@dsifford I tried @larshisken 's solution but it didn't work for me.

dsifford commented 6 years ago

Sorry for the delayed response.

@rivyx Re: "if it is possible to somehow tell dracula to set these settings automatically based on the current environment" --- I agree that would be ideal, but there's just too many variables in play to be able to do that effectively (terminal, os, kernel version, unpredictable terminfo across similar machines, etc). No way that I'm aware of to be able to reliably catch all of that.

Re: "Updating the instructions at https://draculatheme.com/vim/" -- @benknoble did a pretty amazing job with the help docs which are now available with :h dracula -- I think that might be something that we could potentially put in there. PRs accepted.

Glad to hear you were able to get everything sorted without having to fork!

@Saul-Mirone Refresh me again on what issues you have that are still unresolved? The same as your original comment or just a portion of that?

Can you link me to your vimrc? Also, can you provide some info related to your environment that you're on (terminal, os, vim/neovim/gvim, etc).. I understand you're using tmux. Have you tried terminal-override fixes?

benknoble commented 6 years ago

Hi all, sorry for leaping into the thread really late, just want to add a couple of things I saw.

  1. I use Terminal.App on macos. It does not, I repeat, not, have truecolor support at this time
  2. I have had 0 issues using the colorscheme since the update
    • I did set g:dracula_italic=0 before setting the colorscheme!
    • I might turn off the background highlighting for Normal, since my term's background is setup to use Dracula colors (I maintain the Terminal.app theme) and the grey is kind of weird (but not impossible)
    • I guard against colorscheming twice in my vimrc, since that doesn't usually make sense and can ruin things like markology highlighting groups.
  3. The entirety of my tmux/vim play-nice setup is using screen-256color in tmux and xterm-256color elsewhere; vim takes care of the rest automagically.
  4. Truecolors has so far been optional ? That is, I do not (and should not) set termguicolors, and I experience no issues.

P.S. @dsifford , I haven't gone through the Terminal theme yet to see if it needs to be updated re: the spec.

When the new ctermbg flag gets added, let me know if you need help editing the doc file. It sounds like it could use an a explanation of what to with termguicolors, but I'm not in a position to author that sort of explanation.

Saul-Mirone commented 6 years ago

@dsifford sorry for late, I tried everyone's solution and the only problem is the background color.(left is dracula in iterm2 and right is vim). image I use vim in tmux. my .vimrc is here and .tmux.conf is here

hacker1db commented 6 years ago

I have same issue as above ^ @Saul-Mirone

dsifford commented 6 years ago

@Saul-Mirone @hacker1db

Try setting let g:dracula_colorterm = 0 to disable background fills.

hacker1db commented 6 years ago

@dsifford when I use tmux with that flag set it, the colorscheme loads as expected but when you use vim in just a standard terminal the theme does not load properly.

benknoble commented 6 years ago

@hacker1db How so? I have no bg issues in/outside of tmux now

dsifford commented 6 years ago

@hacker1db Yeah, you'll have to write in a conditional in your vimrc to apply that flag only why tmux is loaded.

so, basically...

if exists('$TMUX')
  let g:dracula_colorterm = 0
endif
dsifford commented 6 years ago

@benknoble I think in @hacker1db's case, when tmux is not loaded his terminal background is black, where yours likely already has the dracula colors

hacker1db commented 6 years ago

screen shot 2018-04-03 at 10 18 22 am This first image is before I enter the command colorscheme dracula (without running tmux) screen shot 2018-04-03 at 10 18 39 am this is after I enter the command manually :colorscheme dracula

dsifford commented 6 years ago

@hacker1db Can I assume you have the overrides set appropriately and you're calling colorscheme dracula somewhere in your init scripts after setting those overrides?

Do you have a link to an updated version of your startup scripts?

What terminal are you running?

hacker1db commented 6 years ago

@dsifford dotfiles-nvim tmux_conf *Note I am using my dev_branch for testing to see if my colorscheme issues are resolved.

dsifford commented 6 years ago

@hacker1db Looking at your init.vim

Are these lines correct?

https://github.com/hacker1db/Dotfiles/blob/dev_branch/config/nvim/init.vim#L39 https://github.com/hacker1db/Dotfiles/blob/dev_branch/config/nvim/init.vim#L42

hacker1db commented 6 years ago

@dsifford Sorry, can you please clarify your question are you thinking there not correct?

dsifford commented 6 years ago

Sure..

What I mentioned may or may not be correct based on your intentions, so I'm not sure. One thing I'm noticing is that you're explicitly forcing 256 color on all terminals and you are only setting "termguicolors" when not in tmux. Is that what you intended?

Also, this line is redundant and shouldn't be necessary.

hacker1db commented 6 years ago

I guess, I was setting "termguicolors" to see if it would fix the Dracula theme when not in tmux.. as it works now when in tmux but when your not in tmux the color scheme does not apply but you manually apply it and all is well.

dsifford commented 6 years ago

Sorry for my slowness -- can you clarify again just once more what exactly is broken in non-tmux terminals?

Just want to make sure we're on the same page here.

k-f- commented 6 years ago

Updated the plug-in today and the background color changed to the issue folks are having here. fixed with let g:dracula_colorterm = 0 however the line number gutter no longer has a contrasting color.

dsifford commented 6 years ago

@k-f- Hm.. Would you mind posting a screenshot?

(everyone else: Sorry for the noise and the trouble with this update -- hoping we can get this collectively sorted out soon!)

hacker1db commented 6 years ago

@dsifford the colorscheme does not apply fully when not running tmux

dsifford commented 6 years ago

@hacker1db Right, but specifically, where is it not applying?

From your screenshot, it appears that the only issue is with the ~ in the gutter? Is that correct?

hacker1db commented 6 years ago

Correct, I can't tell for sure if its affecting anything else but thats the most obvious issue. @dsifford you are correct its not fully applying to ~ which intern looks like it doesn't fully apply to comments.

dsifford commented 6 years ago

Would you mind reporting back with the output of :verbose hi NonText in the affected terminal?

dsifford commented 6 years ago

Also, can you run :set foldcolumn=3 and let me know if that is affected as well?

hacker1db commented 6 years ago
screen shot 2018-04-06 at 2 56 20 pm screen shot 2018-04-06 at 2 56 52 pm

@dsifford here is the info you asked for let me know how else I can help is anyone else besides me having this issue? I wonder if its something I did in my config that is causing this issue...