Building ViM With OpenMotif and Xft Support on Debian

Here I will describe how to get Xft font support in gvim (anti-aliased fonts) and nice GUI elements besides by compiling against OpenMotif in Debian.

First edit /etc/apt/sources.list and make sure you have the non-free section, eg.:

deb http://mirrors.kernel.org/debian/ unstable main contrib non-free
deb-src http://mirrors.kernel.org/debian/ unstable main contrib non-free

Now install some necessary packages:

sudo aptitude update
sudo aptitude install vim-common vim-gui-common \
  vim-runtime ttf-dejavu ttf-dejavu-extra
sudo apt-get build-dep vim-common
sudo aptitude purge lesstif2 lesstif2-dev
sudo aptitude install libmotif-dev 

Build the binary:

apt-get source vim
cd vim-7.2.148
fakeroot debian/rules binary VARIANT=lesstif

After a while, it may fail, but that's ok because the binary is all you need.

cd src/lesstif
strip lesstif
sudo cp lesstif /usr/local/bin/gvim

Now add the following to your ~/.gvimrc

set vb t_vb=
set title
hi Normal guifg=lightgrey guibg=black
set guifont=DejaVu\ Sans\ Mono\ 11

Now when you run gvim you will get the OpenMotif GUI with a nice anti-aliased font.

The font doesn't look the same as what I get in rxvt-unicode, to get that I probably need to fiddle some X resources. But it looks nice enough anyway.

Also I haven't found a GUI colorscheme that I like yet or that matches 256_darkdot.vim with my custom urxvt color resources. Once I make one I'll post it here.


Last modified: 2017-1-8 (日) at 9:14 pm