README file from
GithubObsidian Line Search Plugin
Line Search is a high-performance, community plugin for Obsidian that lets you search and rank individual lines across all Markdown files in your vault. It supports typo-tolerant prefix matching and out-of-order multi-word matching while maintaining a lightweight in-memory index that updates incrementally in real time.
Key Features
-
Single-Line Centric Search:
- Searches every line of every Markdown file as an independent search unit.
- Shows matching lines directly in the suggestions list.
-
Advanced Matching & Ranking:
- Out-of-Order Multi-Word Search: Querying space-separated terms (e.g.
hello world) matches lines containing all terms in any order (AND search). - Exact Substring Match: High-priority matching for exact term matches in the line.
- Typo-Tolerant Word Prefix Match: For query terms of 3-5 characters, matches words with up to 1 typo; for terms of 6 or more characters, matches words with up to 2 typos.
- Dynamic Scoring:
- Higher scores for exact matches and word-boundary starts.
- Sequence order bonus (+20 score) when terms appear in the same order as the query.
- Slighly penalizes long lines (by 0.01 per character) to favor short and concise matches.
- Typo penalty applied for fuzzy matches based on Levenshtein distance.
- Out-of-Order Multi-Word Search: Querying space-separated terms (e.g.
-
Premium Suggestion UI:
- Native integration with Obsidian's Command Palette suggestions layout.
- Highlight rendering showing precisely which characters in the line matched your query.
- Shows metadata badge for the file path and the line number.
-
Editor Navigation:
- Hitting
Enteror clicking on a suggestion opens the note. - Automatically scrolls the editor to center the target line and moves the cursor directly to the line.
- Support for opening files in new tabs/panes by holding the
Ctrl/Cmdmodifier key.
- Hitting
-
Optimized Background Indexer:
- Skips empty lines to reduce memory consumption.
- Keeps pre-lowercased line references in memory to maximize performance.
- Updates incrementally in the background using vault event listeners (
create,modify,delete, andrename), avoiding full re-indexing steps.
How to Use
- Open the Command Palette (
Ctrl/Cmd + P), typeLine Search: Open line search, and pressEnter. (Alternatively, click the magnifying glass ribbon icon on the left sidebar). - Type your search terms (separated by spaces).
- Use the arrow keys to navigate matching lines, and hit
Enterto open and jump directly to that line.
Settings
- Minimum query length: The minimum characters you need to type before the search starts.
- Maximum results: The maximum number of results to display in the list (defaults to
10to keep rendering fast). - Exclude folders: Comma-separated list of directories (e.g.,
templates, archive) to ignore during line indexing.
Security & Privacy
Vault Enumeration & Data Access
This plugin uses the Obsidian API (app.vault.getMarkdownFiles) to enumerate files in your vault.
- Why it is needed: This is required to discover Markdown files, read their content, and build a local, in-memory index of all lines so they can be searched instantly.
- Privacy & Local-First: All indexing, scanning, and search matching run entirely on your local machine. No vault data, file paths, or search queries ever leave your device or get transmitted over the internet.
License
This project is licensed under the MIT License.
Local Development & Installation
Building From Source
If you are compiling this plugin from source:
- Clone or download the repository files.
- Open a terminal in the plugin directory and run:
npm install - Compile and bundle the plugin:
This will generate anpm run buildbuild/folder containing the compiled code bundle (main.js), metadata (manifest.json), and stylesheets (styles.css).
Loading into Obsidian
- Copy the
buildfolder into your Obsidian vault's plugins folder under the nameline-search:cp -r build <path-to-your-vault>/.obsidian/plugins/line-search - Open Obsidian and go to Settings -> Community plugins.
- Enable Line Search from the list of installed plugins.