atom-search-everywhere

Fuzzy grep project using ag, pt, ack, grep, ripgrep, or git-grep, Converted from atom-fuzzy-gerp.

frapples

4,251

1

1.1.0

MIT

GitHub

atom-search-everywhere package

This project was converted from https://github.com/geksilla/atom-fuzzy-grep.

  1. Written in ES6, easier to maintain.
  2. Fix the problem of searching for non-ASCII characters such as Chinese.
  3. Fix the problem of detecting git repository under Windows.
  4. More new features.

Note: Due to porting from coffeescript, the feature has not been fully tested and there may be unknown bugs.

Feature

Atom-search-everywhere performs a full-text search of the project, similar to InfinJ IDEA's Find-in-Path.

Enter a regular expression in the input, full-text search results for the project from active text editor will be displayed.

Currently supports three searchers:

  1. gitgrep. Use the git grep command to search. Faster, can eliminate files that do not need to be searched (by identifying the .gitignore file).
  2. grep. Search using grep, ag, pt, etc. High performance, but may search for files that should not be searched.
  3. builtin. Use the built-in search API of atom. Slow speed and good compatibility. Suitable for use in unfamiliar system environments.

When searching, it will intelligently detect the appropriate searcher. The default detection order is gitgrep, grep, builtin, and it can be modified by the custom searcherPriority option.

Install

apm install atom-search-everywhere

Or search via Settings View -> Install

Usage

Hit ctrl-alt-g or , f f in vim-mode to toggle panel.

To open dialog with last searched string there is the command search-everywhere:toggleLastSearch. You can map it in your keymap.cson:

'atom-workspace':
  'ctrl-alt-shift-g': 'search-everywhere:toggleLastSearch'

Configuration

You can specify any command you want by Grep Command String option in package settings, ag is used by default.

If you want to setup another one instead of ag here few examples:

pt

pt -i --nocolor --nogroup --column

ack

ack -i --nocolor --nogroup --column

grep

grep -r -n --color=never

ripgrep

rg -i -n -H --no-heading --column

git grep

git grep -n -E

git grep used by default for git projects if you don't want to use it uncheck Detect Git Project And Use Git Grep option in package settings.

Check package settings for more info.

Caveats

Commands

Name Selector Key Map Description
search-everywhere:toggle atom-workspace 'ctrl-alt-g' Open search dialog start typing and select item
search-everywhere:toggleLastSearch atom-workspace none Open dialog with last search string
search-everywhere:toggleWordUnderCursor atom-workspace 'cmd-*' Open dialog with word under cursor
search-everywhere:pasteEscaped body.platform-linux atom-workspace .atom-search-everywhere atom-text-editor, body.platform-win32 atom-workspace .atom-search-everywhere atom-text-editor 'ctrl-v' Paste text to dialog and escape it, you can disable this behavior with atom-search-everywhere.escapeOnPaste config
search-everywhere:pasteEscaped body.platform-darwin atom-workspace .atom-search-everywhere atom-text-editor 'cmd-v' Paste text to dialog and escape it, you can disable this behavior with atom-search-everywhere.escapeOnPaste config

Configs

Name Default Type Description
atom-search-everywhere.minSymbolsToStartSearch 3 number Start search after N symbol
atom-search-everywhere.maxCandidates 100 number Maximum count of displayed items
atom-search-everywhere.grepCommandString 'ag -i --nocolor --nogroup --column' string Grep command
atom-search-everywhere.searcherPriority "gitgrep", "grep", "builtin" array The plugin will look up the first available searcher in order for the search.
atom-search-everywhere.gitGrepCommandString 'git grep -i --no-color -n -E' string git grep command used when detectGitProjectAndUseGitGrep is true
atom-search-everywhere.preserveLastSearch true boolean Use last search string as input for search dialog
atom-search-everywhere.escapeSelectedText true boolean Escape special characters when dialog opened with selected text
atom-search-everywhere.showFullPath false boolean Show full file path instead of file name
atom-search-everywhere.inputThrottle 50 integer Input throttle
atom-search-everywhere.escapeOnPaste true boolean Escape pasted text

Contributing

Feel free to open issue or send pull request.