URI Grep is a lightweight VS Code extension that allows you to trigger the built-in "Search in Files" feature (Global Search) using a custom URI scheme. It's designed for seamless integration with external scripts, batch files, or automation tools.
| Editor | How |
|---|---|
| VS Code | Marketplace — or code --install-extension mfujita47.uri-grep |
| Forks (Antigravity IDE, VSCodium, Cursor, …) | Open VSX — or <editor> --install-extension mfujita47.uri-grep |
| Any editor, offline | Download the .vsix from the latest release, then code --install-extension uri-grep-<version>.vsix |
- 🚀 External Integration: Launch complex searches directly from your terminal, scripts, or other applications.
- ⚙️ Deep Customization: Control every aspect of the search, including regex, case sensitivity, file inclusion/exclusion, and context lines.
- 🔄 Smart Fallbacks: Intelligent priority system: URI Parameter > VS Code Setting > left untouched.
- 📋 Context-Aware: Support for showing surrounding lines (context) in search results.
vscode://mfujita47.uri-grep/search?query=<search_term>&[parameters]
| Parameter | Description | Default (Setting) |
|---|---|---|
query |
(Required) The string or regex to search for. | - |
filesToInclude |
Glob pattern for files to search in (e.g., src/**/*.ts). |
urigrep.defaultFilesToInclude |
filesToExclude |
Glob pattern for files to skip (e.g., **/node_modules/**). |
urigrep.defaultFilesToExclude |
isRegex |
Treat query as a regular expression (true/false). |
urigrep.defaultIsRegex |
isCaseSensitive |
Perform case-sensitive search (true/false). |
urigrep.defaultIsCaseSensitive |
matchWholeWord |
Match whole words only (true/false). |
urigrep.defaultMatchWholeWord |
contextLines |
Number of surrounding lines to show. Opens the Search Editor instead of the search panel (see note below). | urigrep.defaultContextLines |
useExcludeSettingsAndIgnoreFiles |
Respect .gitignore and exclude settings. |
urigrep.defaultUseExcludeSettingsAndIgnoreFiles |
triggerSearch |
Execute search immediately (true) or just fill panel (false). |
urigrep.defaultTriggerSearch (always applied, default true) |
Boolean parameters accept true/1/yes/on and false/0/no/off (case-insensitive).
A parameter written without a value — &isRegex — means true. Anything else is reported in the
URI Grep output channel and ignored.
The URI path must be /search; any other path is rejected with an error message.
Forks register their own URL protocol, so vscode:// only reaches VS Code itself. Replace the
scheme with the fork's urlProtocol (found in its resources/app/product.json):
| Editor | URI |
|---|---|
| VS Code | vscode://mfujita47.uri-grep/search?query=TODO |
| VS Code Insiders | vscode-insiders://mfujita47.uri-grep/search?query=TODO |
| Antigravity IDE | antigravity-ide://mfujita47.uri-grep/search?query=TODO |
Forks usually pull extensions from Open VSX rather than the VS Code Marketplace, so install from
Open VSX — e.g.
antigravity-ide --install-extension mfujita47.uri-grep — or from a downloaded .vsix.
A parameter is only sent to VS Code when the URI specifies it, or when the corresponding
urigrep.default* setting has been set explicitly. Anything else is not sent at all, so the
Search panel keeps whatever it currently holds — a URI can change just the query without wiping
the "files to include" box you typed by hand.
The exception is triggerSearch, which is always sent (defaulting to true); without it VS Code
would only fill in the Search panel without running the search.
If you want a search to be fully reproducible regardless of the panel's current state, spell out
every relevant parameter in the URI, or pin them via the urigrep.default* settings.
VS Code's search panel command (workbench.action.findInFiles) does not accept a contextLines
argument — only the Search Editor supports context lines. Therefore:
- If
contextLinesis present in the URI, the search is opened in a Search Editor (search.action.openEditor, reusing an existing Search Editor if there is one). - Otherwise, the search is opened in the usual search panel.
The urigrep.defaultContextLines setting on its own does not switch to the Search Editor;
it only supplies a value when the URI specifies contextLines without a valid number.
The query string is taken literally except for percent-encoding, so + is kept as +
(unlike application/x-www-form-urlencoded, where + means a space). This means regular
expressions such as \d+ and searches such as C++ work as typed.
Consequences:
- Use
%20for a space. A literal+is not a space. &and#cannot appear directly in a value — VS Code decodes the URI before the extension sees it, so they would split the query. Encode them twice (%2526for&,%2523for#).- On some shells,
&,^and%also need shell-level quoting or escaping.
Search for console.log in TypeScript files:
vscode://mfujita47.uri-grep/search?query=console\.log&filesToInclude=src/**/*.ts&isRegex=true
Launch from Command Line:
- Command Prompt (cmd.exe):
start "" "vscode://mfujita47.uri-grep/search?query=TODO&isCaseSensitive=true"
- PowerShell:
Start-Process "vscode://mfujita47.uri-grep/search?query=FIXME&contextLines=3"
Values used when the URI does not specify a parameter. Settings you never touch have no effect: the parameter is simply not sent, and the Search panel keeps its current value.
urigrep.defaultQuery: Search term.urigrep.defaultFilesToInclude: Inclusion pattern.urigrep.defaultFilesToExclude: Exclusion pattern.urigrep.defaultIsRegex: Regex.urigrep.defaultIsCaseSensitive: Case sensitivity.urigrep.defaultMatchWholeWord: Whole word.urigrep.defaultUseExcludeSettingsAndIgnoreFiles: Respect.gitignoreand exclude settings.urigrep.defaultContextLines: Fallback used when the URI specifiescontextLineswithout a valid number. Does not by itself switch to the Search Editor.urigrep.defaultTriggerSearch: Whether to run the search immediately (Default:true). Unlike the others, this one always applies.
Every version is published as a GitHub Release
with its notes and a downloadable .vsix. The full history lives in CHANGELOG.md.