Vim PDF
A minimal, dark-mode PDF viewer for VS Code and Cursor that you drive with vim keys.
Pages scroll continuously in a single column. A slim toolbar sits on the top, left or right edge (or stays hidden). The command line, pending keys and page number show in the editor's status bar, as VSCodeVim does.
Features
- Vim navigation:
j/k, d/u, gg/G, :42, counts (5j, 3J), and '' to jump back.
- Search:
/text, then n/N to step through matches. Matches are highlighted on the page. Searches ignore case unless the query contains a capital letter (smartcase).
- Clickable links: table-of-contents entries and cross-references jump within the PDF. Web and mail links open in your browser.
- Chapter list:
o opens the PDF's outline. Jumping to a chapter lands on its exact spot on the page.
- Marks:
ma sets a mark and 'a jumps to it. Marks are saved per file.
- Picks up where you left off: reopening a PDF restores your page, zoom, rotation and layout.
- Dark mode: pages are inverted with their colors kept roughly correct. Toggle with
i.
- Zoom:
+/-, pinch or Ctrl+scroll (zooms around the cursor), and 0 to fit the width.
- Rotate and two-page view:
r/R and s.
- Text selection: select text with the mouse and copy it with Cmd/Ctrl+C. Right-click shows the Copy menu when text is selected, or the shortcut list when it isn't.
- Docked toolbar: drag its grip to snap it to the top, left or right edge, and press
t to hide or show it. Its position is remembered.
- Status bar integration: "Vim PDF Command Line", "Vim PDF Pending Keys" and "Vim PDF Page" items. Hide any of them from the status bar's right-click menu.
- Auto-reload: the PDF reloads when the file changes on disk (handy for LaTeX or Typst) and keeps your place.
- Password-protected PDFs: you're prompted for the password.
- Large PDFs: pages render lazily, the PDF opens without reading every page first, and search reads pages in parallel batches and shows its progress.
- Correct text in more PDFs: bundles pdf.js's character maps and standard fonts, for PDFs that don't embed their fonts and for Chinese, Japanese and Korean text.
Hotkeys
Click inside the PDF first so it receives your keys. Shortcuts that use Cmd or Alt still go to the editor (for example, Cmd++/- zooms the whole window). Press ? or right-click to see this list inside the viewer.
Move
| Key |
Action |
j / k |
scroll down / up |
h / l |
scroll left / right (when zoomed in) |
d / u, Ctrl-d / Ctrl-u |
half a screen down / up |
f / b, Space / Shift-Space |
full screen down / up |
J / K |
next / previous page (two at a time in two-page view) |
gg / G |
first / last page |
42G, 42gg, :42 |
go to page 42 |
:+5 / :-5 |
5 pages forward / back |
'' |
jump back to where you were before the last jump |
A number before most keys repeats them, for example 5j, 3J or 2r.
Search
| Key |
Action |
/text then Enter |
search for "text" |
n / N |
next / previous match (wraps around the document) |
Esc or :noh |
clear the highlights |
Marks
| Key |
Action |
m then a letter |
set a mark (for example ma) |
' then a letter |
jump to that mark (` works too) |
:marks |
list the marks you've set |
View
| Key |
Action |
+ / - |
zoom in / out |
| pinch, Ctrl+scroll |
zoom around the cursor |
0 |
fit the page width |
r / R |
rotate clockwise / counterclockwise |
s |
two-page view on / off |
i |
dark mode on / off |
o |
chapter list (j/k to move, Enter to jump, Esc to close) |
t |
show / hide the toolbar |
yy |
copy the current page number |
? or :help |
shortcut list |
Commands
| Command |
Action |
:42 |
go to page 42 |
:$ |
last page |
:noh |
clear search highlights |
:marks |
list marks |
:dark |
dark mode on / off |
:help |
shortcut list |
Install
npm install
npm run package
code --install-extension vim-pdf-0.0.1.vsix
npm install also copies pdf.js, its character maps and standard fonts, and VS Code's codicons into media/. For Cursor, code points at Cursor's CLI when Cursor is your default editor. Use cursor --install-extension otherwise.
If another PDF extension opens your PDFs instead, right-click the PDF's tab, choose Reopen Editor With… and pick Vim PDF.
Troubleshooting
If a PDF won't open, the viewer shows the error in a red box. Every load step is also written to the Vim PDF output channel (View → Output → Vim PDF).
Not supported
- Printing
- Filling in PDF forms, and annotating or editing PDFs
- Embedded attachments and JavaScript in PDFs
Files
| Path |
What it is |
extension.js |
registers the editor and handles saved state, the status bar, passwords and opening links |
media/viewer.js |
the viewer: rendering, keys, search, toolbar, chapters and marks |
media/viewer.css |
styling |
media/pdfjs/, media/codicons/ |
copied from node_modules by npm install |
| |