last day (16 days later) » 

4:12 PM
Q: Nvim Gray Background

maxwellAnytime I switch to a colorscheme the background turns this ugly gray that gives everything a washed out look. Any ideas? I've tried the following two things but no luck: make sure terminal color is set to xterm-256 color :set background=dark My Iterm2 color preset is dark background

That looks like Dracula in the screenshot. Is it only happening then, or with other colorschemes as well? What is the background color of your terminal emulator ?
Other schemes as well
That looks like macOS terminal, am i correct? Ive not had this problem recently. Have you tried debugging your vimrc ?
What is the output of :verbose hi Normal before and after the switch?
Another possibly important clue: I found a schema where this is not taking effect. ` Plug 'agude/vim-eldar'` Specifically looked for a high contrast theme to test this.
before: :verbose hi Normal Normal xxx guifg=White guibg=Black Last set from ~/.local/share/nvim/plugged/vim-eldar/colors/eldar.vim
after :verbose hi Normal Normal xxx ctermfg=255 ctermbg=236 guifg=#F8F8F2 guibg=#282A36 Last set from ~/.local/share/nvim/plugged/vim/colors/Dracula.vim
Is that iTerm2 then ? Because it supports truecolor (as does neovim); could have something to do with it.
Also, for the 'before' I was rather hoping to get something from the default colorscheme (as opposed to the eldar scheme)
4:33 PM
Yes Iterm2
Okay I'll switch to default
:verbose hi Normal
Normal xxx cleared
Press ENTER or type command to continue
thanks for you help btw
I'm not sure what the cause is, just trying to narrow down the symptoms. Again, have you been through your vimrc (or verified that this doesn't happen without your vimrc?) Does this happen when you use colorschemes shipped with vim (e.g. elflord, &c.) ?
oh wow its happening with elflord - I bet its a problem with my vimrc :(
that's not what elflord is supposed to look like right?
Er, no. Not really. Can you try vim -u NONE -N, then enable filetypes and syntax, pick a colorscheme, and edit that file? If that causes no problems, it's your vimrc. I'll repost the link for debugging here
Wait! I think part of the problem is the background highlighting. elflord doesn't set the ctermbg attribute, so it doesn't change the background inside vim (using your term's bg). This means somewhere in your vimrc the background highlighting on Normal is probably affecting things
4:50 PM
This means somewhere in your vimrc the background highlighting on Normal is probably affecting things
where do I look for modifications to background highlighting
In your vimrc, if you did for example a hi[ghlight] command. I suppose it could be a plugin, have you tried turning those off?
" show relative line numbers in the active buffer (makes it easy to do things like 5j)
au FocusGained * :set relativenumber

" show regular line numbers in inactive buffers
au FocusLost * :set number

" highlight cursor line on entering buffer
au WinEnter * :set cursorline

" remove cursor line highlight when leaving buffer
au WinLeave * :set nocursorline

" highlight cursor column on entering buffer
au WinEnter * :set cursorcolumn

" remove cursor column highlight when leaving buffer
au WinLeave * :set nocursorcolumn
these lines are the closest I come to modifying colors I believe
I'll remove them and source my vimrc and see if elflord looks more normal
None of that touches the colors.
Is your full vimrc online anywhere?
removing those lines totally makes the background fixed
Ok. Try adding them in one by one; maybe I misunderstood the problem?
4:54 PM
Are you talking about the background of the current line?
That's bizzare
no like the background is black no grey haze
which is what I am aiming for :D
Ya I'll add them one by one - super bizarre
They don't touch the colors... I mean they do affect how the screen looks but I don't see how it messes with the bg
okay I added them all back in one by one and its still fixed??
is it possible I had some hidden character in there
Hm. Experiment with it some then, and see if it happens again
4:59 PM
wait okay yeah if I switch to Dracula it comes back
btw you might wan't to consider wrapping the autocmds in an autogroup
Ok so I am one of the maintainers on Dracula which is why this piqued my interest. Have you read through the dracula help file and tried any of the options provided in there?
(I mean the :let g:dracula... ones)
Oh cool - nice man I really like the colorscheme
let me go look at that
is the help file in the github repo?
having trouble finding it
It's in the docs folder; if you have generated the helptags (or you're plugin manager does it for you) you can also do :help dracula inside vim
do you let g:airline_theme='dracula' instead of colorscheme dracula or in addition to?
oh man now when I source my vimrc I get this weird debugging output
looks like vim doesn't like this line: " let g: airline_theme='dracula'
5:14 PM
I've been doing let g:airline_theme='dracula' separately as well (that controls only airline). I don't have a problem with my vimrc, in which I have the same line
okay I took out the space and the line doesnt choke
let g:airline_theme='dracula'
Yeah no space...
word - ya sorry I'm super new to neovim
& vim in general
No problem; gotta start somewhere ! Glad to see you're trying it out. Ok, so are you still having problems with the Dracula colorscheme? Is it happening for any other colorscheme?
Yes I am - it appeared to go away in Elflord - then I switched back to Dracula and it came back, then I took away those au commands and the problem has persisted in Dracula, and trying out the let g: configs and nothing has work yet
but interestingly enough, switching to something like molokai used to give me similar distortions but now it looks kind of right when I switched just now to molokai
does that look like normal molkai to you?
progress maybe
5:21 PM
Ok so molokai looks normal-ish (I don't use it, wouldn't know).
yes it used to look bad but now it looks normalish... only thing I can think of doing is putting those au commands in auto group
Could you do a gist of your current vimrc where Dracula is having problems?
All the autogroup does is help your vim instance not exponentially add autocommands when re-sourcing vimrc
Well, if you prefix it with au! like you appear to have
this is madness, okay so. I switched over to a different tmux window that had an active nvim project on it and it had the old color scheme since when I booted vim it was set to that at the time. so all I did was source my vimrc and now I have molokai WITH the grey hazy background
I think I've got (part of) it. You need to move the line let g:dracular_coloterm = 1 to above the colorscheme dracula line. If the problem persists in dracula, change the 1 to a 0.
5:34 PM
Re: molokai, it might be better to restart vim and see if it's still happening. Re-sourcing a vimrc on top of a running session can introduce complexities with the interactions of colorschemes.
Agreed, this is madness.
okay your suggestion above has made the background black again for dracula :D
I suspect in that case it was a truecolors/guicolors issue.
awesome man thanks so much
That is, the line let g:dracula_colorterm = 0 tells Dracula not to include background fill colors (some grey color that is a 256-color approximation of the real color)
Is molokai still broken post-restart?
guessing I might need a similar line to above but for molokai? like let g:molokai_colorterm=0
5:40 PM
Ok. Well, it's not dracula's fault :P
Molokai has it's own configuration, you should check out their readme
You might need let g:molokai_original = 1, or you might need to adjust the bg highlighting of molokai yourself. Try the var first though
so basically my terminal is not interpreting the colorscheme's background color choice correctly?
Well, no, not necessarily. In dracula's case, dracula was setting the background color to a specific color (which happen's to be an ugly grey on 256-color terminals). We then disable the bg highlighting with a special variable, so you now just see your terminal background.
In molokai's case, well, idk. I can't see the screenshots on their readme
but they say they have a dark grey background by default
Just saw this >Only the dark gray background style is supported on terminal vim at this time. Not sure if still true
Colorschemes either (a) set the bg color, or (b) don't. If they don't, you see your terms bg. However, as with anything, you can adjust it rather easily from your vimrc (something like au ColorScheme molokai highlight Normal ctermbg=...)
hmm gotcha
thanks for that explanation
No problem. also, as I hinted at above, that bg is normally set by using the ctermbg and guibg attributes of the Normal highlighting group. However, at that point you're betting off consulting vim's extensive help manual; it's easy to get lost in all the guides and vimrc's online before having gotten through some of the basics.
Let me know how you fare on molokai. I'll turn some of this discussion into an answer eventually
awesome - will stay tuned for what you write up
so what kind of color spec does this take: au ColorScheme molokai highlight Normal ctermbg
like a hex code or RGB or something?
5:55 PM
uh hang on... (checking vim's :help :P, which you can do as well)
do you know how to follow the link in vim help
like the equivalent of clicking a link in a GUI
Ok so :help :highlight led to me to highlight-args which says...
`ctermfg={color-nr} *highlight-ctermfg* *E421*
ctermbg={color-nr} *highlight-ctermbg*
The {color-nr} argument is a color number. Its range is zero to
(not including) the number given by the termcap entry "Co".
The actual color with this number depends on the type of terminal
and its settings. Sometimes the color also depends on the settings of
"cterm". For example, on some systems "cterm=bold ctermfg=3" gives
another color, on others you just get color 3.
oh wow
Yes ! As stated on :help
Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-].
ha yeah I just read that after I asked (shameful face)
5:58 PM
^^^So for 256 term you've got 0 to 255.
For guis I think you use hexcode
It's ok! Also, the |bars| entry has some useful tips on how to get around
ALSO for ctermbg for example you can use None which turns off that highlighting attribute
hmm okay cool so does that translate to vimrc land simply as: ctermfg=123
or is there more formal syntax pattern involved
No you've got it (assuming you already have the au ColorScheme molokai highlight Normal part
gotcha I see you guys have DraculaBgDark and DraculaBgDarker in :highlight
so maybe Illl try the number you used for darker and see if it works 234
Yeah you conceivably use something like that
Ah I see now, looks like I'll need to play around with both these values to acheive something aesthetically pleasing:

ctermfg={color-nr} *highlight-ctermfg* *E421*
ctermbg={color-nr} *highlight-ctermbg*
6:15 PM
Yeah, check :help hi-normal-cterm for a little bit of info on that
Cool yeah
reading this about 256 colors
seems like part of the issue might be lack of an alpha value in 8 bit colors? like I'm having trouble how anything background could look good just mentally seeing all the flat grey options
having trouble conceiving of how any background could look good*
Where do you see flat grey? The table at the bottom has a lot of color. Plus, you might be overthinking it. What if you just do None to turn it off and see how it looks?
7:06 PM
yeah Molokai looks pretty good with NONE
is there a way to modify this line to apply globally to all colorschemes?
au ColorScheme molokai highlight Normal ctermfg=230 ctermbg=NONE
Hm. probably au ColorScheme * highlight Normal ...
(I'm guessing 😅)
ya I think you're right working well and now I can switch between themes
Brilliant! I'll have some form of answer posted in the next day or two; in the meantime, enjoy (n)Vim!
7:12 PM
Thanks again, man really insightful lesson here

  last day (16 days later) »