[ Content | View menu ]

256 colours in screen

February 10, 2007

I noticed that, within screen, I was not getting the full syntax highlighting in vim that I was expecting. Something had to be up, and it wasn’t long before I found this tip on getting full colour support for vim in screen.

After so poking about, I only used a subset of those instructions. I added this to my .screenrc:

attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"

My .vimrc got updated with this:

set t_Co=256

It did a great job, and now everything looks as it should.

blog - Comments closed

Trouble with AdBlock

February 8, 2007

I discovered an interesting new tactic in the website ad game. Like most people using Firefox, I use the AdBlock Plus extension. A short while ago, I found that Flickr stopped working very well – it was obvious to me that the CSS stylesheet wasn’t loading. After investigating, I found the reason. Some time ago, tired of Yahoo!-based banner ads, I blocked the domain yimg.com. Well, since Yahoo! bought Flickr, they have decided, ingeniously, to host the stylesheet for Flickr on yimg.com. So now, I have to unblock that domain or face an ugly Flickr. On many sites I’d be happy to deal with the ugly, but on an AJAX-intensive photo site, ugly doesn’t cut the mustard. It’s an interesting tactic, and I wonder if other companies will start to use it.

blog - Comments closed

More on screen

February 7, 2007

While I don’t have a screen for a graphical user environment (like X), I do have screen for the terminal, and it rocks.

Here’s how I use it; I have four primary email accounts, each with their own .muttrc. I open a screen session for each account, plus one session as a scratch pad, for the variety of non-mail activities that I do each day. (If you’re thinking that one session for all non-mail activities is too few, you’d be right most of the time, but I have a solution for that too.) I start all of these sessions by calling screen with a special config file, which I call .myscreenrc, to separate it from the regular .screenrc. It looks like this:

autodetach on
shell -$SHELL
screen -t scratch
screen -t uoft u
screen -t nerd n
screen -t witteman w
screen -t woolgathering wg

The -t option givens me a title for each session within screen – which helps me keep everything straight. I call this with a line in my .xinitrc, like so:

sleep 1 && urxvt -geometry 80x56+0+0 -e screen -c .myscreenrc &

The delay helps it come up after my backdrop is drawn, so I don’t have a blank behind my transparent terminal.

All of this is now nicely set up, and I am in mutt (the last email account). I hop between instances in three ways: Ctrl-a " for a list of sessions to scroll through, Ctrl-a ' and the number of the session I want to be in or Ctrl-a n or Ctrl-a p for the next and previous session. If I need a fresh session, it’s as easy as Ctrl-a c.

There are a couple of problems with this setup. The mutt sessions only lasts as long as mutt is open, so if my fingers, from long training, close mutt, then I lose that session as well, and I have to start it afresh. The solution, rather than training my fingers, was to prevent mutt from closing. I remapped q in the browser and index modes to be the equivalent of c?, which means that I can only close mutt from the pager by hitting x. Fine by me, and it lets me have long-lived sessions.

Now, whether I am sitting at my machine or ssh-ing in from work, I have all the same things at my disposal, and I can comfortably leave aspects of my work open when changing locations. If I have left my sessions running at home, I simply call screen -x when at work, and I am in my familiar environment. If I have detached at home then screen -r is the right call.

However, if I have detached at home and stopped my X session, I run into the other problem. When I started screen via my .xinitrc I also set the $DISPLAY variable in each session. As such, when I am logged in remotely without X running, certain programs throw errors because I am not able to reach the X session. The sidestep for this is to unset DISPLAY if I am going to be using programs that care about that variable, most notably vim.

It sounds like work, but it is actually extremely sweet, and really easy.

blog,config - Comments closed