2009-01-30

urxvt meta character gotcha

I recently switched from xterms to rxvt-unicode, unfortunately the added unicode support broke some key bindings I used to navigate tabs in vim.

Originally I had:
...
map <A-1> 1gt
map <A-2> 2gt
map <A-3> 3gt
map <A-4> 4gt
map <A-5> 5gt
map <A-6> 6gt
map <A-7> 7gt
map <A-8> 8gt
map <A-9> 9gt
map <A-0> 10g
...
Allowing me to switch between tabs with alt 1-10, like firefox.

The way urxvt handles unicode, treats the alt sequence as an escape sequence.

The rxvt-unicode --meta8 option didn't help, neither did anything I found googling.

A little python foo and we have a fix.
$ python -c 'for i in xrange(1, 11): print "map \x1b%d %dgt" %((i%10), i)' >> ~/.vimrc
I now have the following in my .vimrc:
...
map ^[1 1gt
map ^[2 2gt
map ^[3 3gt
map ^[4 4gt
map ^[5 5gt
map ^[6 6gt
map ^[7 7gt
map ^[8 8gt
map ^[9 9gt
map ^[0 10gt
...

No comments: