You are not logged in.

#1 2009-02-17 04:21:04

HashBox
Member
Registered: 2009-01-22
Posts: 271

urxvt alternative font per application

As a heavy terminal user, prefering to use plain Vim as opposed to gVim, I was wondering, is there any way of temporarily changing the terminal font while vim is running? or a way to change the font at all without restarting urxvt?
I may be mistaken but yaourt seems to do this when it prints descriptions.

Is what I'm after possible?

Offline

#2 2009-02-17 04:44:36

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: urxvt alternative font per application

HashBox wrote:

As a heavy terminal user, prefering to use plain Vim as opposed to gVim, I was wondering, is there any way of temporarily changing the terminal font while vim is running? or a way to change the font at all without restarting urxvt?
I may be mistaken but yaourt seems to do this when it prints descriptions.

Is what I'm after possible?

Yes. You can set up profiles for different options in most things that get their settings from .Xdefaults. The follow is mine. Anything that is prefixed with 'URxvt' will work in all terminals. Anything prefixed with 'urxvt' will work in the default terminal that's called with the 'urxvt' command. Anything with the EDITOR prefix is called by 'urxvt -name EDITOR'. That's the one that I use for vim. I use a larger font size for all of my editing, as well as darker colors. I also set the background white and foreground black. And for understanding, when you call 'urxvt' from the command line, it's the same as 'urxvt -name urxvt'.

URxvt*scrollBar:            false
URxvt*colorUL:              rgb:64/98/cd

urxvt*saveLines:            10000
urxvt*background:           rgb:00/00/00
urxvt*foreground:           rgb:ff/ff/ff
urxvt*font:                 xft:DejaVu Sans Mono-9
urxvt*scrollTtyOutput:      false
urxvt*scrollWithBuffer:     true
urxvt*scrollTtyKeypress:    true
urxvt*perl-lib:             /usr/lib/urxvt/perl
urxvt*perl-ext-common:      default,matcher,clipboard
urxvt*urlLauncher:          firefox
urxvt*keysym.C-q:           exit\n

EDITOR*background:          rgb:ff/ff/ff
EDITOR*foreground:          rgb:00/00/00
EDITOR*geometry:            80x36
EDITOR*font:                xft:DejaVu Sans Mono-10

! Black
EDITOR*color0:              rgb:00/00/00
EDITOR*color8:              rgb:00/00/00

! Red
EDITOR*color1:              rgb:80/00/00
EDITOR*color9:              rgb:80/00/00

! Green
EDITOR*color2:              rgb:00/80/00
EDITOR*color10:             rgb:00/80/00

! Yellow
EDITOR*color3:              rgb:80/80/00
EDITOR*color11:             rgb:80/80/00

! Blue
EDITOR*color4:              rgb:00/00/80
EDITOR*color12:             rgb:00/00/80

! Magenta
EDITOR*color5:              rgb:80/00/80
EDITOR*color13:             rgb:80/00/80

! Cyan
EDITOR*color6:              rgb:00/80/80
EDITOR*color14:             rgb:00/80/80

! White
EDITOR*color7:              rgb:ff/ff/ff
EDITOR*color15:             rgb:ff/ff/ff

Offline

#3 2009-02-17 04:56:21

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: urxvt alternative font per application

Thank you for your reply, this wasn't exactly what I was after, since I was wanting the font to be able to change without restarting or starting a new instance of urxvt, but I just realised I can use this method anyway, and bind vim to something like "exec urxvtc -name vim" which will hopefully be seamless enough.

Thanks again smile

Offline

#4 2009-02-17 13:45:01

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: urxvt alternative font per application

This is probably what you want

#!/bin/bash

newfont="xft:DejaVu Sans Mono:pixelsize=8"
oldfont="xft:inconsolata:pixelsize=12"

echo -e '\e]710;'${newfont}'\007'
$*
echo -e '\e]710;'${oldfont}'\007'

edit: now it works.

Last edited by scj (2009-02-17 13:59:35)

Offline

#5 2009-02-17 13:54:42

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: urxvt alternative font per application

That looks exactly like what I'm after, thank you so much!

Edit: For future reference, here's what my version looks like, in my .zshrc:

vim_font() {
    echo -e '\e]710;xft:Terminus:style=Regular\007'
    vim $*
    echo -e '\e]710;xft:lime:style=Regular\007'
}
alias vim='vim_font'

Last edited by HashBox (2009-02-17 14:11:41)

Offline

Board footer

Powered by FluxBB