You are not logged in.

#1 2012-07-06 21:56:19

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

Hi,

I'm having some strange behavior with colors when replying to an email using mutt + urxvtc + vim. If I launch mutt using

urxvtc -e mutt

I get the "wrong" colors, so to speak. But if I first launch urxvtc, and then run mutt, I get the right colors.

Here are the two colors compared: http://imgur.com/a/Zf7Tu. The top image shows the correct colors, and the bottom image shows the incorrect colors.

I have no idea why they'd be different. I'd prefer to use the "urxvtc -e mutt" way, since I have a key binding for that, but I don't like the colors. (When I'm replying to an email with lots of quoted text, I want it to be that dark grey, not the bright cyan.)

FYI, I'm using the molokai colorscheme, and in both cases, ":colorscheme" shows that molokai is being used. (So it's not a case of "urxvtc -e mutt" failing to load molokai.vim.)

Any thoughts?

Brian

Last edited by brianb (2012-07-06 22:05:53)

Offline

#2 2012-07-06 22:17:56

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

"urxvtc -e mutt" skips running your shell. Maybe there's something in your shell startup (.bashrc?) that helps the right colors get loaded?

Offline

#3 2012-07-06 23:58:05

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

Not that I can tell.

By the way, I'm currently writing this reply in urxvt + vim, using my browser (dwb)'s external editor command, which I've bound to "urxvt -e vim dwb_uri".

The colors are the same as the "wrong" ones above: e.g., the tildes are blue instead of grey. So it's not mutt-related.

I'm almost 100% sure that the colorscheme being used is "default", even though it says "molokai".

Offline

#4 2012-07-07 07:55:39

rockin turtle
Member
From: Montana, USA
Registered: 2009-10-22
Posts: 227

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

I'll take a stab at this.

When vim starts, it somehow sets the variable t_Co that affect the colors.

For instance, when I start vim I can do a

:set term

and vim shows me

term=rxvt-unicode-256color

indicating what terminal vim thinks I am running.

If I do

:set termcap

vim shows a bunch of variable settings of which one is

t_Co=256

which indicates that the terminal is capable of displaying 256 colors.

I believe that the molokai.vim syntax file sets colors conditionally based on the value contained in the variable t_Co:

if &t_Co > 255
	...

In otherwords, if the variable t_Co has a value less than 256, it sets up a different set of colors for everything.

Most likely, mutt determines what terminal you are running by looking at environment variables.  When you run "urxvtc -e mutt" the environment is set differently than if you do "urxvtc" + "mutt". Thus mutt doesn't know what your terminal is capable of and likewise vim doesn't either.

I don't have mutt installed on my system and I know it has a ton of configuration options, but you may be able to do something like

urxvtc -e mutt -? 256

to tell mutt that you are running in a 256 color capable terminal.

You would have to look at mutt's man page or other documentation to determine what the actual command line switch would be.

Offline

#5 2012-07-07 08:14:50

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

Try the following:

urxvtc -e bash -i -c mutt

If that works, then there's something in your bashrc that's enabling correct colours.

Just one suggestion, -e mutt works correctly for me, and I set the TERM variable in .Xresources (.Xdefaults will also work), and not in any of the bash start-up files.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#6 2012-07-07 14:00:25

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

Wow, thanks guys - you've figured it out!

Indeed, the problem was that I was exporting TERM to "rxvt-unicode-256color" in my .bashrc, and molokai.vim is sensitive to whether term is set to "urxvt" or "rxvt-unicode-256color".

When using "urxvtc -e mutt", ":set term" gave "urxvt", and when using "urxvtc" + "mutt", ":set term" gave "rxvt-unicode-256color".

I've removed the export line from my .bashrc, and now everything is working beautifully: term is always "rxvt-unicode-256color".

Thank you all!

Brian

P.S.

skanky wrote:

I set the TERM variable in .Xresources (.Xdefaults will also work), and not in any of the bash start-up files.

For me, the term variable gets set automatically when urxvt is launched, with no need to set it in .Xresources. (Conversely, if I launch xterm, then "echo $TERM" returns "xterm".) Is there any advantage to setting it in .Xresources?

Last edited by brianb (2012-07-07 14:01:17)

Offline

#7 2012-07-07 20:33:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

brianb wrote:

Is there any advantage to setting it in .Xresources?

Setting a term variable anywhere is inadvisable*, it leads to the sort of unforseen issues you experienced...



* the one exception (that I am aware of) is in a multiplexer like tmux.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2012-07-07 21:16:44

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: vim colors in mutt reply: "urxvtc -e mutt" vs. "urxvtc" + "mutt"

Interesting, I'll remove it from my Xresources file and see what happens. Though my recollection is that I added it to solve a problem, that was a couple or more years ago, so it could no longer be applicable. neutral


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

Board footer

Powered by FluxBB