You are not logged in.
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 muttI 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
"urxvtc -e mutt" skips running your shell. Maybe there's something in your shell startup (.bashrc?) that helps the right colors get loaded?
Offline
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
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 termand vim shows me
term=rxvt-unicode-256colorindicating what terminal vim thinks I am running.
If I do
:set termcapvim shows a bunch of variable settings of which one is
t_Co=256which 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 -? 256to 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
Try the following:
urxvtc -e bash -i -c muttIf 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
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.
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
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.
Offline
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. ![]()
"...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