Vi keys in Xpdf

keyboard shortcutspdf

The Xpdf man page says that it can be customized to work with Vi style keybindings:

Previous  versions  of  xpdf  included  a  "viKeys" X resource.  It is no
longer available, but the following bindings are equivalent:

   bind h any scrollLeft(16)
   bind l any scrollRight(16)
   bind k any scrollUp(16)
   bind j any scrollDown(16)

But nothing happens after I add those lines to ~/.xpdfrc. What could be going on?

Best Answer

Had version 3.03 installed. At least here .xpdfrc was opened and read, according to strace, but no settings had any effect. Downloaded and tested version 3.04 and here bindings work fine.

Quick to do:

wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.04.tar.gz
tar xzvf xpdf-3.04.tar.gz
cd xpdf-3.04

Install FreeType 2 dev and Motif dev. For debian and the like something like:

apt-get install libmotif-dev libfreetype6-dev libfreetype6

Configure and make:

# Read INSTALL
./configure --with-freetype2-includes=/usr/include/freetype2
make

Test:

./xpdf/xpdf Path_to_some.pdf

Includes:

pdfdetach  pdfimages  pdftohtml  pdftoppm   pdftotext  
pdffonts   pdfinfo    pdftopng   pdftops    xpdf

Also had a quick look at zathura as recommended by @Peterph.

Looks nice, and if you want vi(m) bindings it have a lot of default bindings that are same as in vim. E.g. h, j, k, l, :, /, gg, G etc. Both key-bindings and other things are configurable.

Related Question