morhetz / gruvbox

Retro groove color scheme for Vim
13.87k stars 1.11k forks source link

Feature request: Non gvim compatibility #4

Closed dathinaios closed 10 years ago

dathinaios commented 11 years ago

Hey :)

Thanks for this beautiful theme!! It would be great if I could use it in the Terminal as well ;)

best,

Dionysis

krzkrzkrz commented 11 years ago

Great theme. But yea, wish there was one for the terminal

jojoyuji commented 11 years ago

for terminal users I suggest the CSApprox plugin. Though it's not the same colors it's quite a solution for the majority of vim's colorschemes

greduan commented 11 years ago

@morhetz Still no progress on this? CSApprox doesn't quite cut it, it gets some stuff really wrong: screen shot 2013-09-21 at 12 34 55 pm

Loving it on MacVim, but sadly I don't use MacVim 99% of the time. :/

mukiwu commented 11 years ago

same question for me, hope this color scheme can have non GUI version

morhetz commented 11 years ago

This should be fixed with the latest commit f2efaeca0e. I'll provide updated documentation and term-autodetection a little bit later. If your term doesn't handle italic text then it's displayed inverted. In this case you should put this string to vimrc before setting colorsheme: let g:gruvbox_italic=0

Also "let g:gruvbox_termcolors=16" will use base 16-color palette for most colors, which is handy if your term-theme uses gruvbox colors, and also it provides you more accurate result. This would be the recommended way to use gruvbox at term. See "Palette" section at colorscheme file for details. I think I'll keep this issue opened for a while.

greduan commented 11 years ago

@morhetz Awesome, thanks!

So for us to be able to use it on a terminal we would need to use a Gruvbox terminal theme correct?

morhetz commented 11 years ago

@Greduan Not quite right. By default it will act as usual 256-color theme. But colors wouldn't be that vivid due to 256-palette. Otherwise you could set g:gruvbox_termcolors option to use your terminal colorscheme for most of base colors, specifically: dark0 = black (# 0) light4 = light-gray (# 7) medium = gray (# 8) red = bright-red (# 9) green = bright-green (# 10) yellow = bright-yellow (# 11) blue = bright-blue (# 12) purple = bright-magenta (# 13) aqua = bright-cyan (# 14) light1 = white (# 15) In this case you could overload base-16 terminal palette to make colors more accurate.

There is a third way, i didn't mentioned. If you use urxvt-256-xresources you could overload 256-palette instead of switching to 16 colors. E.g.: URxvt.color167: #fb4934 URxvt.color142: #b8bb26 URxvt.color214: #fabd2f URxvt.color109: #83a598 URxvt.color175: #d3869b URxvt.color108: #8ec07c URxvt.color208: #fe8019 etc.

As I've already mentioned I'm going to update documentation soon. Do I recomend you to switch term colortheme to gruvbox and use g:gruvbox_termcolors=16 option? Sure. Do you have to? Nope, but colors wouldn't be that precise using default 256 palette.

morhetz commented 11 years ago

Default 256 colors gr256

Using 16-color palette from gruvbox terminal colorscheme gr16

P.S. Yep, as you can see I've failed at highlighting comment title; oughta fix this.

greduan commented 11 years ago

I don't know why but fold colors are weird in 256 color mode: screen shot 2013-10-03 at 10 04 42 am

Comments have exactly the same problem. For some reason it isn't invisible (or doesn't use same background as everything else: screen shot 2013-10-03 at 10 13 59 am

I'm using iTerm 2 on Mac OS X 10.7.

greduan commented 11 years ago

@morhetz Also damn you for being able to use Arch Linux. ;) Wish I could but this Mac makes it a royal pain in the ass.

morhetz commented 11 years ago

@Greduan That's probably because iTerm doesn't handle italic text and displays it inverted. Have you tried putting this string to disable italics to vimrc before setting colorsheme on?

let g:gruvbox_italic=0

I know, I know - I should put some term-detection and auto-disable italics if it's not rxvt. BTW, I quit using Arch and moved to Debian sid (unstable) for about a half year and not going back :)

greduan commented 11 years ago

That can happen. Wow all right. Fixed that. I miss urxvt. :(

Also what made you quit Arch? It is still my favorite distro of Linux, only problem is that it's practically impossible to use it on a Mac. At least within a reasonable time frame.

morhetz commented 11 years ago

@Greduan First of all, I can't say better then Allan McRae. Second reason was moving to mobile development: while Ubuntu is the most popular distro, every dev-software is provided with at least deb-package (and it's not just about development, there are a tons of deb-packages, sue you AUR). And sid just feels right. It runs smooth on my Elitebook Folio, I had no hw-related problems except TrackPoint driver (Synaptics TrackPoint is common problem). I've got used to apt-get faster then I expected. Speaking briefly Debian unstable has all Arch advantages without having inconveniences.

As far as I can see you've decided to use 256-color palette. Would you mind testing this experimental script gist:6822769 in iTerm? It should overload 256-palette same way urxvt-256-xresources would do, but using ANSI-escape codes instead.

UPD.: Could you please try it inside tmux and w/o tmux? If it doesn't help you could try replacing every "\e" with "\x1B" as pointed here.

greduan commented 11 years ago

Well it doesn't give me any errors, whether I use \e or \x1B.

Should I see any visible changes or is it just minor changes in the Vim theme?

morhetz commented 11 years ago

@Greduan Hmm. Yep it should be visible but the difference shouldn't be edgy. It's not changing vim theme - just overloading system colors. Especially changes in red color should be noticeable (compare red in my screenshots above). You could run side by side vim in iTerm and MacVim: before running script in term default 256-colors theme should be slightly pale-gray and differ from the MacVim. After running scripts their colors should be exactly the same. Have you tried it inside tmux and when tmux isn't running?

greduan commented 11 years ago

Oh yeah I notice that. It is so much prettier now. lol

And yes it does work with tmux and without tmux.

morhetz commented 11 years ago

@Greduan That's great! Thank you. The only thing: it drops color every time you restart term, so it'll be useful to start this script from .bashrc//.zshrc. I'll add this file to gruvbox repo, so if you are using Vundle or Neobundle it could be runned with something like

~/.vim/bundle/gruvbox/gruvbox_256palette.sh

greduan commented 11 years ago

All right. Yeah I added it to my .zshrc already. :)

Perhaps it would be smart to have two versions of the file, one with \e and another with \x1B.

morhetz commented 11 years ago

@Greduan Which version have you added to zshrc, with \x1B? Does \e works the same way for OS X? If so I suppose they've fixed escape sequence and I'll keep only \e version at repo until any related issues occurs (if so) and document this situation at README file. Otherwise, for sure, I'll add both.

greduan commented 11 years ago

I am using the \x1B version. I'll try it with \e right now... Yeah with \e it doesn't seem to work...

morhetz commented 11 years ago

Ok, thank you again, I'll add \x1B version.

greduan commented 11 years ago

You're welcome. :) Thanks for making this awesome theme. :)

krzkrzkrz commented 11 years ago

Hmm seems to work in ubuntu as well now. When you said "Using 16-color palette from gruvbox terminal colorscheme" at https://github.com/morhetz/gruvbox/issues/4#issuecomment-25623953 where do you suggest we set 16 color settings?

greduan commented 11 years ago

@krzkrzkrz Those 16 colors are set by the theme your terminal app is using

krzkrzkrz commented 11 years ago

Manually changing each color palette in gnome terminal -> preference. Is there a better way? Plus hard to identify the colors you are suggesting. i.e. what is "grey"? There are a few shades of grey.

Good job on the theme. I like it a lot. One other suggestion, would be to change the cursor background color when it is over a highlighted searched term. Does that make sense?

For example. I search for "foo". It highlights all text with "foo". The background color it assigns it is yellow. If I move my cursor on top of any "foo" word. The cursor turns black, which makes it look like the cursor went away.

greduan commented 11 years ago

@krzkrzkrz There is no better way AFAIK, unless you know how to edit the colorscheme file for your terminal directly. So until there's a theme someone makes using these colors this is the best way. :/

morhetz commented 11 years ago

@krzkrzkrz

  1. On Linux you could modify your Xresources file and set Terminal to use system colors. I've specified colors indexes ahd shades of grey already.
  2. The most recommended way using gruvbox at terminal is 256-color palette with gruvbox_256palette.sh shell-script set up at your bashrc (thanks to @Greduan for testing and inspirations)
  3. There is already issue#2 on search highlighting. Please be patient and don't mess all things at one issue. It's more convinient to create separate issues for each bug/suggestions/etc.
blueyed commented 10 years ago

@Greduan @morhetz is this supposed to work from inside of tmux? It does not for me.

And it seems like it needs a special sequence: printf_template="\ePtmux;\e\e]4;%d;rgb:%s\a\e\" (which works) (see http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)

I could not make it work in screen though: the doc says "Esc P" should trigger bypassing (http://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html)

Here's the gruvbox script in question: https://github.com/morhetz/gruvbox/blob/master/gruvbox_256palette.sh

morhetz commented 10 years ago

@blueyed It seems you're right, tmux handled it wrong. Though script works for screen correctly. So escape sequence for screen is \eP\e]4;%d;rgb:%s\a\e\ and for tmux \ePtmux;\e\e]4;%d;rgb:%s\a\e\.

blueyed commented 10 years ago

@morhetz Yes, screen handles it correctly. I was just using TERMscreen-256color-bce myself. See my pull request.

morhetz commented 10 years ago

@blueyed Awesome, thanks!

blueyed commented 10 years ago

FWIW: I've learnt that tmux should be able to handle this normally, per pane, and that only GNU screen needs these escape codes to be wrapped: https://github.com/chriskempson/base16-builder/pull/189