README file from
GithubZathura's keys in Obsidian's PDF view: read a book without touching the mouse. Also a dark recolor, a status bar, marks, last-page memory, and a study split that puts the PDF next to your notes.
Keys
In a PDF tab, with the page focused:
| Keys | What they do |
|---|---|
J K |
next / previous page |
j k ↓ ↑ |
scroll |
d u Ctrl-d Ctrl-u |
half a page down / up |
h l Ctrl-h Ctrl-l ← → |
scroll sideways |
gg G {n}G {n}gg |
first page, bottom, page n |
z = + / Z - |
zoom in / out |
W Ctrl-0 / H |
fit width / fit page |
D |
dual page |
r |
rotate |
i |
recolor: dark pages, colours keep their hue |
b |
status bar on / off |
Tab T |
table of contents |
/ then Enter, n N |
search (Enter goes back to the page), next, previous |
m{x} '{x} |
set a mark / go back to it (per file) |
R |
reload |
Esc |
drop a count |
Counts work like in zathura: 3J, 5j, 12G. Keys typed in a note, a search box or a dialog are left alone.
- Status bar:
file [page/pages] percent, at the bottom of each PDF. - Last page read: a PDF opens again where you left it, like zathura's database.
- Recolor, status bar, marks and last pages are kept per device, so two devices syncing the same vault don't fight over them.
Commands
Bind them to hotkeys (or vimrc maps, see below):
- Study split: PDF | note (toggle): from a PDF, opens your last note beside it; from a note, your last PDF. Again: back to one pane, the one you are in.
- Previous tab or pane (PDF ⇄ note): like Vim's
Ctrl-^; when that tab was closed, reopens the last file of the other kind. - Scroll the PDF beside the note down / up half a page, Next / Previous page of the PDF beside the note: read on without leaving the note you type in.
- Toggle recolor, Toggle the status bar.
- Open PDFs in the external program on this device (toggle): see below.
Settings
- Scroll step, Sideways step, Zoom step.
- Alt+Tab and Ctrl+6: previous tab or pane: these keys anywhere, even while typing (Alt is Option on macOS). Off by default.
- Alt+. and Alt+, drive the PDF from the note: half a page down / up, with Shift a whole page. Off by default.
- Focus mode: while a PDF is on screen, sidebars, tabs, status bar and title bar go away; the PDF toolbar shows when you point at the top.
- External program: open PDFs in a real PDF reader instead of Obsidian's view, from the file list, links (
[[book.pdf#page=12]]opens page 12), the quick switcher. Arguments take{file}and{page}; for zathura,--page={page} {file}. It is turned on per device with the command above, so a desktop can open zathura while a laptop keeps Obsidian's view.
The recolor and the status bar can be restyled in a CSS snippet:
body { --pz-recolor-bg: #1e1e2e; --pz-status-bg: #181825; --pz-status-fg: #cdd6f4; }
The body gets classes for your own snippets too: pz-study (a PDF is on screen), pz-split (next to a note), pz-pdf-active (the PDF has focus).
Vim
The keys work on their own; no Vim mode needed. With Obsidian's Vim mode on, the editor keeps its own keys: these only act while a PDF has focus.
With Vim Motions, its leader sequences (Space f f…) still work from a PDF, and a bare g goes to it (gg, gt, gT). Leader maps for the commands:
nnoremap <leader>p :obcommand pdf-zathura:study-split<CR>
nnoremap <leader>ba :obcommand pdf-zathura:alternate<CR>
Install
Until it is in the community plugins list, either:
- use BRAT: add
confuserdotcom/obsidian-pdf-zathura, or - download
main.js,manifest.jsonandstyles.cssfrom the latest release into<vault>/.obsidian/plugins/pdf-zathura/, then enable PDF Zathura Keys in Settings → Community plugins.
Desktop only.
Development
No build step: main.js is the plugin.
npm test # unit tests: every key on a fake PDF view, settings, external program arguments
node e2e-isolated.mjs # real key presses in a separate Obsidian with a throwaway vault and tools/sample.pdf (macOS)
Support
The plugin is free and stays free. If it saves you time, you can support it here.