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

Add terminal_colors for neovim #93

Merged
merged 1 commit into from
Aug 12, 2017
Merged

Add terminal_colors for neovim #93

merged 1 commit into from
Aug 12, 2017

Conversation

ianks
Copy link
Contributor

@ianks ianks commented Jan 28, 2016

Neovim has support for embedded terminals. However, the colors do not inherit from the parent shell settings, and end up looking funky. This commit adds 16 color support for Neovim's terminal.

See: neovim/neovim#2897 (comment)

Neovim has support for embedded terminals. However, the colors do not inherit
from the parent shell settings, and end up looking funky. This commit adds 16
color support for Neovim's terminal.

See: neovim/neovim#2897 (comment)
@wsdjeg
Copy link

wsdjeg commented Jan 30, 2016

will the pr fix this issue?
neovim/neovim#4088

@wsdjeg
Copy link

wsdjeg commented Jan 30, 2016

@morhetz @lanks Thanks for your pr,my issue has been fixed,but can your let the embedded terminals also use true color instead of 16color
2016-01-30 21 15 37

@ianks
Copy link
Contributor Author

ianks commented Jan 30, 2016

@wsdjeg I'm not quite sure what you are saying.

@wsdjeg
Copy link

wsdjeg commented Jan 30, 2016

before this PR My terminal looks like
2016-01-30 23 29 22

@vbauerster
Copy link

I confirm this pr, fixes #104 (comment)

@hansrodtang
Copy link

You should probably switch to single quoted strings like the rest of the file.

let g:terminal_color_11 = "#fabd2f"

" neutral_blue + bright_blue
let g:terminal_color_4 = "#458588"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color four should same as vim's status line color,now it is blue,you can try run irssi,which is a irc client,then you will see the status line backgrould color is blue.

@zhranklin
Copy link

Great! It works for me.

@ahmedelgabri
Copy link

any update on this if it's going to be merged or when?

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

I think this should not be added to vim colorschem.terminal buffer should has same color with origin terminal. I use different color for neovim buffer and terminal.
but if you like this feature. you can add this to your vimrc. and all this g:var is not only for this colorscherme. and not only for neovim.
for example,if I run mutt or irssi in neovim terminal buffer.I hope I can see same color as I see in the origin terminal.

@ahmedelgabri
Copy link

That's what I did for now, I added it to my .vimrc. But I think it should be part of the theme because if I change a theme I want/assume these colors to reflect on all vim buffers. But for now it's better than before anyway

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

@ahmedelgabri I know what you mean,but in neovim, terminal buffer is different from origin vim buffer, it should has same option as in terminal, such as hotkey, colors and so on, it will make neovim's terminal buffer become a really terminal.
so if you add this to colorsheme, other app such as mutt irssi will looks different in neovim terminal buffer and origin terminal. it will make other people anoiy.

BTW, I do not see any colorscheme add this g:var into its repos.

@zhranklin
Copy link

@wsdjeg What if you are using a GUI such as Nyaovim and you just want an embeded terminal in it? We call this embeded because it's a part of neovim but not of the terminal we use. So neovim should control it, just like the embeded terminal in IntelliJ, Sublime and so on. Besides, even in the terminal, does everything look the same as in a real terminal? Maybe not. Without these g:var things, some parts are in colors from terminal's theme while others from neovim's, which terns out that it looks just so wiered.

@zhranklin
Copy link

@wsdjeg Or maybe we can make this an option? If you want it, enable it, else, do nothing.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

@zhranklin it should same as the terminal, if not that is due to your terminal has some different setting for this colors, for example I use termite, the config file is
https://github.com/wsdjeg/DotFiles/blob/master/config/termite/config#L50-L65
and the format of the g:var g:terminal_color_1 is not only for gruvbox.
if you add this into gruvbox, even if in Nyaovim, if you run some app such weechat, in terminal buffer. it will looks very different with origin terminal.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

BTW,I think a good plugin, even if a colorschem should has strong default, and the default option should not make too many people anoiying.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

also, a very importent thing is, terminal buffer will load user's bashrc etc. some people use colored output for some script, and the color should not be changed by vim's colorschem.

@zhranklin
Copy link

@wsdjeg Well the foreground and background colors are not the same as in the terminal, which make some texts even difficult to recognize (in my terminal), but maybe you are right in some ways. Now the thing is nyaovim doesn't has any way to config the value of ANSI colors. What if I want a theme on the terminal? In this case the proper 'default' should be following the color theme. And in case of considering the integrity of the appearance of neovim, some people would also want to follow the colors from the theme in the neovim.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

@zhranklin see talk in #neovim irc channel, the maintainer of neovim justinmk also do not think we should add the g:var into colorsheme,

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

terminal should has its's own colorscheme, it will be better for other apps, most of the terminal has config file for user to set the colors,, such gnome-terminal , st, lilyterm and so on,BTW, I am using termite, it is also very easy to set the color.
and you should know the terminal color is not only for neovim, but also other apps.

@zhranklin
Copy link

@wsdjeg I would be agree with you now. I think it will be better if neovim use the foreground and background colors which are from the terminal in its embedded terminal, but not from the colorscheme's. Otherwise, some terminal-colored texts can't be seen clearly with vim-theme-colored background.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

@zhranklin I do not think neovim terminal can detect the foreground and background colors of other terminals. you should set yourself,because each terminal has its own config file, for example if you have gnome-terminal and termite in your PATH, you can open these two terminal, the should has different colors, it is due to all the terminal has same init file like bashrc, but this file do not have configration for terminal colors. each terminal read its own config file when startup.
cc @justinmk

@zhranklin
Copy link

Neovim doesn't have to know about the setting of foreground and background. Just show the plain text without color, then the terminal will make it in default foreground and background.

@wsdjeg
Copy link

wsdjeg commented May 20, 2016

it is feature, please read man bash or something else, just like xterm, neovim's build in terminal will show colors, for example ls command will list all the files and dirs, and you will see the dir has different colors, and executable files have another color, The file type color definitions are taken from the value of the LS_COLORS environment variable, and you can use echo $LS_COLORS command in terminal to see these;

@zhranklin
Copy link

@wsdjeg I know what you mean. So I think it easy for neovim to just show texts in terminal's foreground and background, which isn't what we see in neovim's embedded terminal.

@zhranklin
Copy link

e.g. in my terminal(iterm):
2016-05-21 1 46 17
and neovim's terminal:
2016-05-21 1 46 08
And see the difference of background color and frontground color?

@zhranklin
Copy link

zhranklin commented May 20, 2016

if the color theme is turned off, it's good:
2016-05-21 1 53 34
So maybe we should disable any theme on the embedded terminal if we want to see a real terminal.

@justinmk
Copy link

maybe we should disable any theme on the embedded terminal if we want to see a real terminal

Did you try ownsyntax ?

@wsdjeg
Copy link

wsdjeg commented May 21, 2016

@zhranklin ok, I see, in terminal buffer, if you do not set these g:var, all text has same colors as the origin terminal except the bg and fg.
that is due to how neovim init the terminal buffer's bg and fg, now I think if we do not set these g:var the terminal buffer 's bg and fg will be same as other buffer. so that is why your first two pics has different bg and fg,but same text colors.
as @justinmk sais ,can you try with ownsyntax? to get more info see :h :ownsyntax.also you can and add some config to your vimrc, to detect if get(g:,'terminal_color_1','') ==# '' or get(g:,'terminal_color_0','') ==# '' then use the origin terminal's bg and fg color,
and the best way to fix this issue is just add two g:var,g:terminal_color_1 and g:terminal_color_0 to your vimrc, set the value same as your origin terminal's bg and fg.

@zhranklin
Copy link

I will try these, thanks!

2016年5月21日 09:48,Wang Shidong notifications@github.com写道:

@zhranklinhttps://github.com/zhranklin ok, I see, in terminal buffer, if you do not set these g:var, all text has same colors as the origin terminal except the bg and fg.
that is due to how neovim init the terminal buffer's bg and fg, now I think if we do not set these g:var the terminal buffer 's bg and fg will be same as other buffer. so that is why your first two pics has different bg and fg,but same text colors.
as @justinmkhttps://github.com/justinmk sais ,can you try with ownsyntax? to get more info see :h :ownsyntax.also you can and add some config to your vimrc, to detect if get(g:,'terminal_color_1','') ==# '' or get(g:,'terminal_color_0','') ==# '' then use the origin terminal's bg and fg color,
and the best way to fix this issue is just add two g:var,g:terminal_color_1 and g:terminal_color_0 to your vimrc, set the value same as your origin terminal's bg and fg.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//pull/93#issuecomment-220752132

@zedeus zedeus mentioned this pull request Oct 7, 2016
@wayneashleyberry
Copy link

With the hopes of getting this merged, could it not be hidden behind a feature flag? That way it's completely opt-in and it wont mess with anyone's neovim terminal unnecessarily.

let g:gruvbox_terminal_colors = 1

@cryptomilk
Copy link
Contributor

Yes, I agree.

let g:gruvbox_terminal_colors = 1

is a good idea

@morhetz morhetz merged commit 6b493c5 into morhetz:master Aug 12, 2017
@morhetz
Copy link
Owner

morhetz commented Aug 12, 2017

Merged

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

Successfully merging this pull request may close these issues.

10 participants