ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Search in Project

by deese ST4

Use ag, ack, grep, ripgrep and git grep directly from Sublime Text 4

Labels search

Details

Installs

  • Total 16K
  • Win 6K
  • Mac 6K
  • Linux 4K
Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6
Windows 0 2 2 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 2 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1
Mac 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Just in case you found this project by accident you have to know that..

Search in Project

This plugin for Sublime Text 4 Build 4500 or higher lets you use your favorite search tool (grep, ack, ag, pt, rg, git grep, or findstr) to find strings across your entire current Sublime Text project.

It opens a quick selection panel to browse results, highlights matches inside files, and supports double-clicking results to jump directly to the matching line.

Usage

  1. Call Search in Project: Search from the command palette, or use a key binding (see Key Bindings below).
  2. An options panel appears first, letting you toggle Case sensitive and Use regex before searching. Select → Search… to proceed.
  3. Enter the search query and hit Enter.
  4. A quick panel lists the results. Select any entry to open the file at the matching line. The search string is highlighted with an outline and a circle symbol in the gutter.
  5. The first item in the quick panel is — List all results in view —. Select it to open all results in a dedicated editor view. From that view, press Enter or double-click any result line to navigate to it.

If you select text before running Search in Project, the selection is pre-filled as the search query. For example, to search for a word project-wide: ⌘D, ⌘⌥⇧F, ↩.

If you run Search in Project again, the last search string is remembered, so repeating a search is just ↩ away.

Search options

By default the search runs immediately after you enter the query. You can enable an options panel that appears before each search by setting search_in_project_show_options_panel to true in your user settings:

{
  "search_in_project_show_options_panel": true
}

When enabled, the options panel lets you toggle search options before entering the query:

Option Description
Case sensitive Match exact casing. Off by default.
Use regex Treat the query as a regular expression. Off by default.

Options are persisted between searches. They can also be set directly in user settings via search_in_project_case_sensitive and search_in_project_use_regex.

Installation

Via Package Control (recommended)

This package is not yet in the official Package Control registry. To install it directly from this repository:

  1. Open the command palette (Ctrl+Shift+P / ⌘⇧P) and run Package Control: Add Repository.
  2. Enter the following URL and confirm: “ https://raw.githubusercontent.com/deese/SearchInProject_SublimeText/master/repository.json
3. Open the command palette again and run **Package Control: Install Package**.
4. Search for **Search in Project** and install it.

### Manual installation

Download an [archive of the repository](https://github.com/deese/SearchInProject_SublimeText/archive/master.zip) and unzip into the Sublime Text Packages folder.

### Search engines

| Name | Description | Key |
|---|---|---|
| **[ripgrep](https://github.com/BurntSushi/ripgrep)** | **Extremely fast, recommended.** | `ripgrep` |
| **[pt (The Platinum Searcher)](https://github.com/monochromegane/the_platinum_searcher)** | **Fast, binaries for every platform.** | `the_platinum_searcher` |
| **[ag (The Silver Searcher)](http://geoff.greer.fm/ag/)** | **Equally fast, 3rd party binaries on Windows.** | `the_silver_searcher` |
| [ack](http://beyondgrep.com/) | Requires Perl, not ideal on Windows. | `ack` |
| [git grep](http://git-scm.com/docs/git-grep) | Bundled with Git, only works in Git repos. | `git_grep` |
| [grep](https://en.wikipedia.org/wiki/Grep) | Available on Linux/macOS. | `grep` |
| [findstr](https://technet.microsoft.com/en-us/library/Bb490907.aspx) | Built-in on Windows. Default on Windows if no engine is set. | `findstr` |

Set the engine in settings via `search_in_project_engine`. Leave empty to use the platform default (`findstr` on Windows, `grep` on Linux/macOS).

## Configuration

Open `Preferences → Package Settings → Search in Project → Settings` to edit your user configuration. The left panel shows all available options with their defaults.

Key settings:

| Setting | Default | Description |
|---|---|---|
| `search_in_project_engine` | `""` | Engine to use. Empty = platform default. |
| `search_in_project_show_options_panel` | `false` | Show the options panel before each search. |
| `search_in_project_case_sensitive` | `false` | Case-sensitive search. |
| `search_in_project_use_regex` | `false` | Treat query as a regular expression. |
| `search_in_project_show_list_by_default` | `false` | Always open results in a view instead of quick panel. |
| `search_in_project_max_quick_panel_results` | `100` | Switch to results view automatically above this count. |

Per-engine paths and options are configured under `search_in_project_engines`:

```json
{
  "search_in_project_engines": {
    "ripgrep": {
      "path": "rg",
      "mandatory_options": "--column --no-heading --color never",
      "common_options": ""
    }
  }
}

Issues with locating executables

On macOS, if Search in Project cannot find an executable, install the Fix Mac Path plugin.

You can always set the full path in search_in_project_engines.<engine>.path as a fallback.

Key Bindings

No key bindings are active by default to avoid conflicts with other packages.

Suggested bindings are included in Example.sublime-keymap:

  • Windows/Linux: Ctrl+Alt+Shift+F
  • macOS: ⌥⌘⇧F

To activate one, open Preferences → Package Settings → Search in Project → Key Bindings, copy the matching line for your platform from the left panel to your user keymap on the right.


Originally made by Leonid Shevtsov

ST4 version by Javi/DeeSe