I’ve been using xpdf and xdvi for reading documents I’ve downloaded or my LaTeX-generated documents on the laptop more and more these days due to their speed. The one thing I require (desire) in all programs I use on a day to day basis, especially when I have to navigate the file, is to have emacs keybindings.
To do so for the two readers, first, add the following to ~/.Xresources
:
<pre class="src src-sh">! look<span style="color: #00ffff;"> in</span> man xdvi
xdvi.mainTranslations: #override Ctrlv: down-or-next()n Altv: up-or-previous()n Alt Shift <: goto-page(1)n Alt Shift >: goto-page()n Ctrlf: right(0.015)n Ctrlb: left(0.015)n Ctrln: down(0.015)n Ctrlp: up(0.015)n l: right(0.015)n h: left(0.015)n j: down(0.015)n k: up(0.015)n Ctrls: find()n xdvigeometry: 1350×700 xdvishrinkFactor: 4
! look in man xpdf and xpdfrc; ~/.xpdfrc xpdfgeometry: 1350×700 xpdfinitialZoom: width
Also, create and add the following to ~/.xpdfrc
:
<pre class="src src-sh">initialZoom width
continuousView yes bind ctrl-v any pageDown bind alt-v any pageUp bind alt-shift-< any gotoPage(1) bind alt-shift-> any gotoLastPage bind ctrl-n any scrollDown(16) bind ctrl-p any scrollUp(16) bind ctrl-f any scrollRight(16) bind ctrl-b any scrollLeft(16) bind h any scrollLeft(16) bind l any scrollRight(16) bind k any scrollUp(16) bind j any scrollDown(16) bind ctrl-s any find
Now I can at least navigate the file with emacs keybindings.
I would also like to get this to work on ghostview (for postscript files) or djview (for djvu files), but have yet to find out how to do so on these programs (or found programs for these formats that allow custom keybindings). I’ve written about using emacs’ doc-view to view all my files, but it can be sub-optimal:
- the conversion process on large files can take a long time,
- no “continuous” view mode,
- searching the text does not highlight the text,
- and the file doesn’t update when the dvi or pdf file is updated (or have a keybinding to update) for use with LaTeX (editing and updating files). UPDsATE: actually, you can refresh using the
r
keybinding; it works quite fast and stays on the same page you are on.
Please do let me know if you know how to make custom keybindings on ghostview or djview (or similar, fast programs). Also let me know if I am not aware of any features in doc-view that would make my life easier. Thanks!
I use zathura, which uses VIM keybindings so it’s not too bad. I’d use docview if the anti-aliasing/rendering of fonts weren’t so horrible, if anyone knows of an option to improve that let us know. You’ll want to change your code so < and > aren’t displayed as < and >
@Scott: thanks for sharing about Zathura. Too bad it only displays pdf. I would like a more uniform interface for viewing all these files (pdf/dvi/ps/djvu).
Please confirm the syntax appearing on this page (explicit HTML character entities and so on) is intended.
Thanks for these keybindings. I have started using xpdf as my main pdf browser. I still print with acroread because it has a booklet mode.
Anyway, the one keybinding that I sorely missed was one for save as. So I wrote one and I thought others might find it useful. bind alt-s any “run( cp %f ~/pdfs/
zenity --entry --text='Current name %f'
)” zenity creates the dialog that asks you for the desired filename. I save all my pdfs to the same directory, so this works very well for me. The program zenity is just one of the many notification programs that are available. You could definitely create a similar dialog box using kdialog or gdialog. You can even have the current filename as the default text by adding –entry-text=’%f’.