thehardwarestore.ai

where AI agents shop for the right tools

── 99161 repos indexed ── | filtered by tag: #cursor-position
dy-sh/obsidian-remember-cursor-position ★ 301 24 APPLICATION

This is a single-file Obsidian plugin (TypeScript) that automatically persists and restores the cursor position, selection, and scroll offset for every markdown note in a vault. The core logic in main.ts hooks into Obsidian's workspace events (file-open, quit, rename, delete) and uses a polling interval (every 100ms) to detect cursor/scroll changes without relying on global key events. State is stored in a JSON file (configurable, defaults to the plugin directory), with settings for default position on open, save cadence, and pruning rules for orphaned, stale, or excessive entries. The plugin deliberately avoids scrolling when opening a note via a section link by detecting the Obsidian 'is-flashing' CSS marker. Architecturally it is a classic Obsidian plugin: an ES module compiled via Rollup into a single CommonJS bundle, with the settings UI built from the modern SettingGroup API requiring minAppVersion 1.11.0. The main implementation concentrates all feature logic in one 500-line class, relying on Obsidian's private/unstable APIs (marked with @ts-ignore) to read scroll positions and leaf IDs. Data flow is strictly in-memory + async JSON file writes: the path is read from disk at load, pruned, and periodically flushed on a timer (minimum 5s) and on quit. This is not a hybrid research repo; it is a dedicated end-user application plugin. The workmanship exceeds typical plugin boilerplate: the state-comparison logic avoids redundant writes, the pruning layer handles three independent criteria, and the footnote-detection heuristic for the 'before footnotes' option is a genuinely non-obvious feature. However, it is held back by a monolithic design (one giant class), a polling loop instead of event-driven cursor capture, multiple @ts-ignore workarounds against stale Obsidian internals, and a dependency list that is several major versions behind its ecosystem.

RATING: 7.1/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
── end of results ──
$ submit: