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

Terminal colors inside neovim from normal terminal #3114

Closed
ianks opened this issue Jul 29, 2015 · 20 comments
Closed

Terminal colors inside neovim from normal terminal #3114

ianks opened this issue Jul 29, 2015 · 20 comments
Labels

Comments

@ianks
Copy link

ianks commented Jul 29, 2015

When opening a terminal inside Neovim, the line colors are different feel what they should be.

Specs:

  • Terminal: termite
  • 24 bit color enabled in Neovim
  • color scheme, Seoul 256
  • shell: zsh
@lithammer
Copy link
Contributor

Are you using iTerm2? If so, what version?

@fwalch
Copy link
Member

fwalch commented Jul 30, 2015

@agustinvinao
Copy link

I have big issues with colors for NVim. When I open vim using the same vimrc content it looks ok. is there any way to set default colors? I've checked the fix in the link posted by fwalch, I've tested with terminal.app, iterm2 and all its the same.

Terminal: terminal.app / iterm
OS: OSX
24 bit color enabled in Neovim
Color scheme: base16-tomorrow or zenburn (screenshots with base16-tomorrow)
Shell: zsh
Tmux: yes

NeoVim
nvim
VIM
vim

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 31, 2015

Terminal: terminal.app / iterm

Tmux: yes

This means that your terminal is tmux, not terminal.app or iterm. Tmux is interpreting all escape sequences on its own and then sends whatever escape sequences it thinks is right to send to the currently used terminal to display everything correctly. Since it does not know about 24-bit colors (note: there is a patch available somewhere to make it know) and parts of 24-bit color codes (unless expressed in a form with colons) look like other colors it cannot send right escapes to terminal.app or iTerm, but highlighting is still not completely missing.

You should disable 24-bit colors in NeoVim when using tmux.

@agustinvinao
Copy link

With let $NVIM_TUI_ENABLE_TRUE_COLOR=0 in my vimrc doesn't fix it.

Should I change any other setting?

By the way, this is how neovim looks outside tmux:

screen shot 2015-07-31 at 12 09 33 pm

@fmoralesc
Copy link
Contributor

The original issue isn't resolved, reopening.

@fmoralesc fmoralesc reopened this Jul 31, 2015
@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 31, 2015

@agustinvinao Is not vimrc too late? AFAIR you can only set this in shell before launching NeoVim.

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 31, 2015

@agustinvinao Look outside tmux means that your terminal emulator supports true color in the same fashion tmux does. Do not know anything about terminal.app, but iterm does not support true color until some second version.

@agustinvinao
Copy link

@ZyX-I I've tested with ITerm v2 too, all my tests are with "let $NVIM_TUI_ENABLE_TRUE_COLOR=0":

ITerm2 + Tmux + NVim
item2-tmux-nvim

ITerm2 + NVim
iterm2-nvim

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 31, 2015

@agustinvinao

  1. Which version exactly?
  2. I am wrong, and setting it in the vimrc appears to be not too late. But setting it to zero (== non-empty string) is not different from setting it to one (== non-empty string). You need to either unset this variable or set it to the empty string (note: you can’t unlet from within NeoVim).

@lithammer
Copy link
Contributor

@agustinvinao Make sure you're using the iTerm2 nightly (http://iterm2.com/downloads/nightly/).

@ianks What if you try another colorscheme, my experience is that some mess with the shell colors (like base16-eighties), and some don't (vim-hybrid).

@agustinvinao
Copy link

@ZyX-I unsetting $NVIM_TUI_ENABLE_TRUE_COLOR was the solution.

All working good in terminal.app, I'll check @Renstrom to update to nightly version.

Great job and its a very nice thing to have this project going on.

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 31, 2015

@agustinvinao

// For future: do not fool yourself by using let $… = number. Environment variable can never be anything, but string, so when you use let $… = 0 zero is implicitly converted into a string. But zero looks like false and '0' does not. Usually for “boolean” environment variables set/unset semantics is used (due to historical reasons unset and empty are considered to be the same under most circumstances), especially this is the case in applications where it is easier just to test whether variable is unset then parse it. C apps usually fall into this category, as well as shell apps.

@justinmk
Copy link
Member

Closing, unless there is a specific issue not covered by the posts above.

@justinmk justinmk added tui and removed terminal labels Dec 13, 2015
@chirvo
Copy link

chirvo commented Jan 27, 2016

I also have the same problem. As you can see, the colors from the terminal in neovim don't correspond to the ones on the right (just the terminal).

screenshot from 2016-01-27 14-27-10

In my .bashrc I have this:

#Neovim true color support
export NVIM_TUI_ENABLE_TRUE_COLOR=1
#Neovim cursor shape support
export NVIM_TUI_ENABLE_CURSOR_SHAPE=1

and finally:

$ echo $TERM
xterm-256color
$

My neovim configuration is here: https://github.com/bigchirv/neovim-distribution

I would love to know how can I fix it or, if it is actually a bug, reopen this issue report.

Thanks!

EDIT: Added $TERM.

@lithammer
Copy link
Contributor

@bigchirv your colorscheme is probably lacking g:terminal_color_0-g:terminal_color_15.

@ianks
Copy link
Author

ianks commented Jan 27, 2016

@Renstrom I just checked gruvbox, and they are indeed missing terminal_color_X AFAICT. Given this is one of the more popular colorschemes, I tend to think that most color schemes will not implement terminal_color for quite some time. Maybe it would be reasonable to fallback to reasonable defaults? Is this even possible?

@chirvo
Copy link

chirvo commented Jan 28, 2016

Thanks @Renstrom! Adding the g:terminal_color_* to my colorscheme did the trick.

Here's more information about setting g_terminal_color_*: #2897 (comment)

@ignuki
Copy link

ignuki commented Mar 5, 2016

Hi, I have an issue with the color black inside the terminal emulator. The rest of the colors seem to display right but for some reason black is not inherited from the regular terminal.
I have tried seting g:terminal_color_*, but with no result.
In editing mode, all colors are displayed properly.

2016-03-05-17-37-06

@flppv
Copy link

flppv commented Oct 24, 2022

2022 still have same issue, neovim picks up my terminal colorscheme color for background instead of nvim colorscheme colors. syntax works fine, but not the background. in alacritty/iterm/neovide, etc.

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

No branches or pull requests

10 participants