Home » Questions » Computers [ Ask a new question ]

Vim-like navigation n Adobe Acrobat Reader

Vim-like navigation n Adobe Acrobat Reader

Adobe Acrobat Reader is currently one of the good PDF readers available on the Linux platform. xpdf and Evince do their job well, but Acrobat's display seems to be better.

Asked by: Guest | Views: 61
Total answers/comments: 3
Guest [Entry]

"This AutoHotKey script I wrote supports hjkl, gg, G, C-e, C-y, C-f, and C-b, along with /, n, and N for searching. Pressing / takes you into search mode, and Esc, Enter, and Ctrl-[ will put you back in normal mode. If things aren't working like they should, try pressing Escape to get back into normal mode.

#IfWinActive ahk_class AcrobatSDIWindow
h::
if (inAcrobatSearchMode)
Send h
else Send {Left}
return

j::
if (inAcrobatSearchMode)
Send j
else Send {Down}
return

k::
if (inAcrobatSearchMode)
Send k
else Send {Up}
return

l::
if (inAcrobatSearchMode)
Send l
else Send {Right}
return

n::
if (inAcrobatSearchMode)
Send n
else Send {F3}{Esc}
return

+n::
if (inAcrobatSearchMode)
Send N
else Send +{F3}{Esc}
return

+g::
if (inAcrobatSearchMode)
Send G
else Send {End}
return

; see http://stackoverflow.com/questions/1794258/detect-a-double-key-press-in-autohotkey

g::
if (inAcrobatSearchMode)
Send g
else {
if (A_PriorHotkey <> ""g"" or A_TimeSincePriorHotkey > 400) {
; Too much time between presses, so this isn't a double-press.
KeyWait, g
return
}
Send {Home}
}
return

/::
if (inAcrobatSearchMode)
Send /
else {
inAcrobatSearchMode := true
Send ^f
}
return

Esc::
inAcrobatSearchMode := false
Send {Esc}
return

^[::
inAcrobatSearchMode := false
Send {Esc}
return

Enter::
if (inAcrobatSearchMode) {
inAcrobatSearchMode := false
}
Send {Enter}
return

;go back into normal mode after scrolling with any control command

^e::
inAcrobatSearchMode := false
Send {Esc}{Down}
return

^y::
inAcrobatSearchMode := false
Send {Esc}{Up}
return

^f::
inAcrobatSearchMode := false
Send {Esc}{PgDn}
return

^b::
inAcrobatSearchMode := false
Send {Esc}{PgUp}
return

#IfWinActive

Here's a Gist

Please leave short bug reports or suggestions in the comments!

There are some known issues with holding down the Ctrl movement commands for long periods that have to do with AutoHotKey not being able to translate the input fast enough, but the non Ctrl movement commands shouldn't have this problem.

Unfortunately, I don't know enough about Linux or Mac OS X to be able to provide solutions for them as well. If anyone manages to port this to other operating systems, please either add your own answer or suggest an edit to this one with instructions. :)"
Guest [Entry]

"Sounds like a job for IronAHK!

k::send {up}
j::send {down}
l::send {right}
h::send {left}

I know basic hotkey functionality like this works, but some of the more complex commands are not yet supported by IronAHK."
Guest [Entry]

"Meh, this question is one year old, I'll give it a try nevertheless.

Slightly off topic, because I don't know how to do it in acroread, but you might want to try Apvlv:

""Apvlv is a PDF/DJVU/UMD Viewer Under Linux/WIN32 and its behaviour [is] like Vim.""

If you're willing to leave acroread, this pdf-reader will give you lots of vim-love.

Apvlv is based on libpoppler (same back-end as evince and now also xpdf), so you might encounter the same display issues that you mentioned. But it certainly fires up more quickly than acroread, which is the slowest in the industry! Good luck.

Disclaimer: I once wrote a piece of documentation for this project."