Smart Selection

pending

by sabotagedninja

Expand or shrink selections intelligently by pressing a hotkey.

Updated 5mo agoMITDiscovered via Obsidian Unofficial Plugins
View on GitHub

Smart Selection

Smart Selection makes selecting text in Obsidian more intuitive and efficient.
It lets you expand or shrink selections step by step — from cursor to a single line to an entire paragraph — using keyboard shortcuts.

📰 Latest news

16-10-2025 — New release 0.7.0 is out now!

Awaiting review and inclusion into the official community plugins list — exciting 😄

✨ Features

  • Expand or shrink selections logically by pressing a key combination

    (e.g Ctrl + A / Ctrl + Shift + A — you must set these manually after installation, see Setup).

  • Works with words, lines, paragraphs, lists and other elements.

  • Mimics modern IDE selection behavior (e.g., VS Code, IntelliJ).

  • Compatible with both Live Preview and Source Mode.

  • Fully configurable keyboard shortcuts.

  • Compatible with Obsidian v1.0.0 and later (due to API compatibility with the Editor abstraction in obsidian.d.ts for CodeMirror 6).

🪄 Roadmap

  • Selecting a single word — Right now, a line is the smallest increment. (release 0.7.0)
  • Heading + Section support — Selecting Heading + Section combo as a logical unit.
  • Code block support — Selecting entire code block as a logical unit (does not work right now when the code block contains multiple consecutive blank lines).
  • Selecting text between delimiters like "quotes", (parentheses), <{[brackets]}>, but also **asterisks** and _other_ ==characters== — very useful when editing markdown.
  • Table support — Selecting contents of a cell, row, and the entire table.
  • Mobile support via buttons in the ribbon menu — Now only supported via the Command palette.

⚙️ Installation

  1. In Obsidian, go to Settings → Community Plugins.
  2. Turn Safe Mode off if needed.
  3. Click Browse and search for Smart Selection.
  4. Click Install, then Enable the plugin.

Or clone this repository and run it locally — See Local development for details.

🔧 Setup

Important: You must set keyboard shortcuts manually after installation, or this plugin won't do anything!

Sadly, providing default keyboard shortcuts is strongly discouraged in the plugin guidelines (the reasoning is understandable) and ultimately not allowed during the review process of adding the plugin to the official community plugins list.

Proposed keyboard shortcuts:

ActionWindows/LinuxmacOS            
Expand selectionCtrl + A
Shift + Alt + Right 1)
Shift + Alt + Up 2)
⌘ A
⌃ ⇧ ⌘ → 1)
⌥ ↑ 2)
Shrink selectionCtrl + Shift + A
Shift + Alt + Left 1)
Shift + Alt + Down 2)
⌘ ⇧ A
⌃ ⇧ ⌘ ← 1)
⌥ ↓ 2)

1) VS Code 2) IntelliJ

You can change these in Settings → Hotkeys → Smart Selection.

Disclaimer: I have not tested this plugin nor the proposed keyboard shortcuts on Linux and macOS — Any feedback is welcome!

🧩 Using the plugin

Each time you press the shortcut, Smart Selection analyzes the current cursor position and expands (or shrinks) the selection to the next logical boundary.

Remember: You must set keyboard shortcuts manually after installation (see Setup).

Example 1: Expand selection

# The Raven - by Edgar Allan Poe

Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore — 
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
"'Tis some visiter," I muttered, "tapping at my chamber door — 
		Only this and nothing more."

. . .

With the cursor placed on midnight on the first line Once upon a midnight dreary…:

PressSelection becomes
Ctrl + AThe word:
midnight
Ctrl + A againThe first line:
Once upon a midnight dreary, while I pondered, weak and weary,
Ctrl + A againThe entire paragraph:
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint...
Ctrl + A againThe entire document

Example 2: Shrink selection

# The Raven - analysis

- THEME: Grief, loss, and the descent into madness.
- NARRATIVE VOICE: First-person, unreliable narrator mourning his lost love, Lenore.
- SYMBOLISM:
    - The raven = unrelenting memory, death, or fate.
    - Lenore = idealized, unattainable beauty or lost purity.
    - Midnight/Darkness = mental despair.
- TONE: Melancholic, eerie, and obsessive.
- STRUCTURE: 18 stanzas of six lines each; trochaic octameter with internal rhyme and refrain (“Nevermore”).
- MOOD PROGRESSION: Calm → curious → desperate → hopeless.
- CENTRAL CONFLICT: Rational mind vs. emotional torment; search for meaning in suffering.
- ENDING: Final acceptance of eternal grief—soul trapped beneath the shadow of the raven.

With the cursor placed on the fourth line directly after - The raven and pressing Ctrl + A three times to select the entire document:

PressSelection becomes
Ctrl + Shift + AThe entire paragraph with all the bullet points
Ctrl + Shift + A againThe fourth line:
- The raven = unrelenting memory, death, or fate.
Ctrl + Shift + A againThe word: raven
Ctrl + Shift + A againRestores the original cursor position after raven

🧠 Core concepts

  • Logical boundaries
    The plugin expands or shrinks the current selection based on text structure rather than fixed character counts. Boundaries can be words, quoted strings, parentheses, list items, lines, code blocks, or paragraph sections, depending on context.

  • Origin cursor
    The position of the caret before the first expansion is remembered as the origin. All subsequent expand/shrink operations are computed relative to this origin. It acts as the center of the selection behavior.

  • Origin retention rule
    The origin is kept only if it remains inside the current selection. A hidden side-effect to this is that if the user makes a selection while keeping the origin within the selection, the origin is still valid and expand/shrink operations will work, keeping the origin. If the user moves the selection so that the origin falls outside it, the origin resets to the current selection anchor (the fixed end of the selection). This ensures consistent direction and prevents erratic jumps.

  • Stateless operation
    The plugin keeps no persistent state between commands (except for the origin cursor). Each invocation recalculates the selection purely from the editor’s current selection and cursor positions. There is no undo stack or memory of previous boundaries beyond what is visible in the editor.

  • Pure selection logic
    It never changes the document text. Only the highlighted range changes. Typing, deleting, or moving the cursor interrupts the Smart Selection flow naturally, since new selections become the new basis for calculation.

  • Symmetric expansion and shrinking
    Expand (Ctrl+A) moves outward to the next logical unit. Shrink (Ctrl+Shift+A) reverses that step, returning to the previous boundary — as long as it can be computed from the current selection and origin relationship.

🧪 Troubleshooting

If the plugin doesn’t seem to respond:

  • Verify the plugin is enabled in Settings → Community Plugins.
  • Check for hotkey conflicts under Settings → Hotkeys.
  • Ensure you are in the editor (not the preview pane).
  • Have you tried turning it off and on again?
  • Try restarting Obsidian.
  • If all else fails, throw the computer out the window (I'm not liable for any damages caused).

Disclaimer: I have not tested this plugin nor the proposed keyboard shortcuts on Linux and macOS — Any feedback is welcome!

⚠️ Known issues

  • May behave unexpectedly in tables or complex embedded elements.
  • Expansion logic may vary slightly between Live Preview and Source Mode.

🤝 Contributing

Contributions via bug reports, bug fixes, documentation, and general improvements are always welcome. For more major feature work, make an issue about the feature idea / reach out to me so we can judge feasibility and how best to implement it.

Local development

The codebase is written in TypeScript and uses node / esbuild for compilation; for a first time set up, all you should need to do is pull, install, and build:

$ git clone git@github.com:sabotagedninja/obsidian-smart-selection.git
$ cd obsidian-smart-selection
$ npm install
$ npm run dev

This will install libraries and build the plugin. This will also put esbuild in watch mode, so any changes to the code will be re-compiled.

Tip: Clone the repository inside the .obsidian/plugins/ folder. Use the Plugin Reloader plugin in Obsidian to manually reload the plugin after any change you want to test (faster than restarting Obsidian).

💰 Support

If you are enjoying this plugin then please support my work and enthusiasm by buying me a coffee. Ninjas need coffee too :)

Buy Me A Coffee Buy Me a Coffee at ko-fi.com

📄 License

MIT License © 2025 sabotagedninja

Smart Selection is an open-source community plugin for Obsidian.

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.