xlongfeng1 downloadsAdds vim-style scrolling (j/k, Ctrl+D/U, gg, G) in reading mode when vim key bindings are enabled.
An Obsidian plugin that adds vim-style scrolling in reading mode when Obsidian's vim key bindings are enabled.
Obsidian's built-in vim key bindings (powered by CodeMirror's vim mode) are active in source and live preview modes — but reading mode renders static HTML with no editor, so vim navigation keys (j, k, Ctrl+D, Ctrl+U, gg, G) do nothing there.
This plugin fills that gap: it intercepts those keystrokes in reading mode and scrolls the viewport directly, giving you consistent vim muscle memory regardless of which mode you are in.
It also handles a common friction point: after scrolling in reading mode, switching back to source mode may leave the cursor far from the visible content. The plugin corrects the cursor position so it matches what you were reading.
| Key | Action |
|---|---|
j |
Scroll down one line |
k |
Scroll up one line |
Ctrl+D |
Scroll down half a page |
Ctrl+U |
Scroll up half a page |
gg |
Scroll to the top of the document |
G |
Scroll to the bottom of the document |
Keys are only active when:
Scrolling is instant — scrollTop is set directly with no CSS smooth-scroll or animation. This is intentional:
j or k) scroll continuously without animation queuing lag.Holding a key (e.g., j) produces repeated keydown events. Each event is handled independently — no debouncing or rate-limiting is applied — so the viewport scrolls smoothly as long as the key is held.
gg DetectionThe gg command is triggered by pressing g twice within 500 ms. After the first g, the timer starts. If a second g arrives within the window, the view scrolls to the top.
When you switch from reading mode to source mode, the CodeMirror editor restores the cursor to its last known position, which may no longer be visible (because you scrolled in reading mode). The plugin corrects this after the editor initialises:
This ensures the editor opens with the cursor near the content you were reading.
j/k, Ctrl+D/Ctrl+U, gg, and G to navigate.main.js and manifest.json from the latest release.<Vault>/.obsidian/plugins/obsidian-vim-scrolling/.git clone https://github.com/xlongfeng/obsidian-vim-scrolling
cd obsidian-vim-scrolling
npm install
npm run dev # watch mode — compiles src/main.ts → main.js