VIM-like navigation while reading PDF's on macOS Preview app. No need to prefix
VIM commands with Ctrl
or Shift
, just open the Preview app and start navigating
comfortably through PDF's. Keybinds are only available when Preview is in focus (i.e beign used).
- Download the latest release
- Drag
Hammerspoon.app
from yourDownloads
folder toApplications
brew cask install hammerspoon
On a Terminal window:
-
git clone https://github.com/emanuel2718/mac_preVIew.git
-
mkdir ~/.hammerspoon
-
ln -s <path-to-mac_preVIew-folder>/init.lua ~/.hammerspoon/init.lua
Open Hammerspoon application either with a Spotlight search or by Right
clicking Hammerspoon application in Finder and selecting Open
.
Then, press Shift + Cmd + R
to reaload Hammerspoon configuration.
At this point VIM keybinds should be enabled while using Preview.
TLDR: Open
Hammerspoon appllication and press Shift + Cmd + R
.
In order for the VIM navigation keybinds to work; Preview app must be opened and in focus.
If you want to use a PDF reader other than Preview:
Open init.lua
in your editor of choice and change the value of the READER
variable to the exact name (case sensitive) of the PDF Reader of your choice.
For example: README = 'Adobe Acrobat Reader DC'
-
h
: Scroll Left -
j
: Scroll Down -
k
: Scroll Up -
l
: Scroll Right -
i
: Enter Insert Mode -
ESC
: Enter Normal Mode -
g
: Scroll Top of PDF -
SHIFT+g
: Scroll Bottom of PDF -
CTRL+f
: Scroll to next page -
CTRL+b
: Scroll to previous page
- Create documentation on how to install
- Insert and Normal mode.
- Add gg, G vim navigation commands (Go to bottom and top of pdf)
- CTRL+f, CTRL+b (Scroll to the next page or the previous)
- Add SHIFT+
key
to scroll faster than normal scrolling speed. - Disable all hotkeys when spotlight is beign used.
- Add a list of application that the vim like commands will be used?
- Refactor code (Maybe use hs.modal for Normal and Insert modes)
This project couldn't have been possible without Hammerspoon, which is a powerful OSX automation tool.
Visit their Website for more imformation.