Expandomatic

approved

by Onsi Fakhouri

This plugin has not been manually reviewed by Obsidian staff. Expand selection outward through word, sentence, paragraph, section, document — like VSCode's expand selection.

100 downloadsUpdated 11d agoMIT

Expandomatic

An Obsidian plugin that progressively expands the selection outward, modelled after VSCode's Expand Selection (Alt+Shift+→).

Usage

You'll need to assign the keybindings to Expand Selection and Shrink Selection yourself.

Press ⌃⇧⌘→ (Control+Shift+Command+Right Arrow) repeatedly to grow the selection one unit at a time. Each press wraps the current selection in the next larger syntactic unit. Moving the cursor or changing the selection manually resets the expansion.

Press ⌃⇧⌘← (Control+Shift+Command+Left Arrow) to shrink back through the expansion history one step at a time. Shrink only works while the selection exactly matches the last expanded selection — any manual change to the cursor or selection clears the history.

Expansion levels

Prose (default)

PressSelects
1stWord under cursor
2ndFull URL (if cursor is inside one), otherwise sentence
3rdSentence
4thParagraph (blank-line bounded)
5th+Innermost section (heading + content), then parent sections outward
LastEntire document

Sentence detection uses punctuation heuristics (. ! ? followed by a capital letter or end of text). Single-letter abbreviations like U.S. and Dr. are not treated as sentence boundaries.

Inside a table

PressSelects
1stWord
2ndCell content (between `
3rdEntire row
4thEntire table

Inside a fenced code block

PressSelects
1stWord
2ndEntire line
3rdEntire fenced block (from ``` to ```)

Inside a math block ($$...$$ or inline $...$)

Inline $...$:

PressSelects
1stWord/token
2ndTerm (operator-bounded: + - * / = ^ , ( ) [ ] { })
3rdEntire $...$ (including delimiters)
4thEntire line

Block $$...$$:

PressSelects
1stWord/token
2ndTerm
3rdEntire line
4thEntire $$ block

Installation

  1. Build: npm install && npm run build
  2. Copy main.js and manifest.json into <vault>/.obsidian/plugins/expandomatic/
  3. Enable the plugin in Settings → Community Plugins

Hotkeys can be rebound under Settings → Hotkeys by searching for "Expand Selection" or "Shrink Selection". The defaults are ⌃⇧⌘→ (expand) and ⌃⇧⌘← (shrink).

Development

npm install
npm run dev   # watch mode, rebuilds on save
npm run build # production build

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.