Atom Packages Directory

a package directory for a text editor of the 21st Century

Fuzzy Grep

Install with:
    apm install atom-fuzzy-grep
  

atom-fuzzy-grep package

demo

Install

apm install atom-fuzzy-grep

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 fuzzy-grep:toggleLastSearch. You can map it in your keymap.cson:

'atom-workspace': 'ctrl-alt-shift-g': 'fuzzy-grep:toggleLastSearch'

To always open dialog with last search string check Preserve Last Search in package settings.

You can filter files in opened dialog. Toggle between grep/file mode with ctrl-f. To change this keybinding add following lines to your keymaps.cson:

'atom-workspace .atom-fuzzy-grep': '<your_keys_here>': 'fuzzy-grep:toggleFileFilter'

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
fuzzy-grep:toggle atom-workspace ‘ctrl-alt-g’ Open search dialog start typing and select item
fuzzy-grep:toggleLastSearch atom-workspace none Open dialog with last search string
fuzzy-grep:toggleFileFilter atom-workspace .atom-fuzzy-grep atom-text-editor ‘ctrl-f’ When search dialog opened toggle file name filtering on found results
fuzzy-grep:pasteEscaped body.platform-linux atom-workspace .atom-fuzzy-grep atom-text-editor, body.platform-win32 atom-workspace .atom-fuzzy-grep atom-text-editor ‘ctrl-v’ Paste text to dialog and escape it, you can disable this behavior with atom-fuzzy-grep.escapeOnPaste config
fuzzy-grep:pasteEscaped body.platform-darwin atom-workspace .atom-fuzzy-grep atom-text-editor ‘cmd-v’ Paste text to dialog and escape it, you can disable this behavior with atom-fuzzy-grep.escapeOnPaste config

Configs

Name Default Type Description
atom-fuzzy-grep.minSymbolsToStartSearch 3 number Start search after N symbol
atom-fuzzy-grep.maxCandidates 100 number Maximum count of displayed items
atom-fuzzy-grep.grepCommandString ‘ag -i –nocolor –nogroup –column’ string Grep command
atom-fuzzy-grep.detectGitProjectAndUseGitGrep false boolean Always use git grep when opened project is a git repository
atom-fuzzy-grep.gitGrepCommandString ‘git grep -i –no-color -n -E’ string git grep command used when detectGitProjectAndUseGitGrep is true
atom-fuzzy-grep.preserveLastSearch false boolean Use last search string as input for search dialog
atom-fuzzy-grep.escapeSelectedText true boolean Escape special characters when dialog opened with selected text
atom-fuzzy-grep.showFullPath false boolean Show full file path instead of file name
atom-fuzzy-grep.inputThrottle 50 integer Input throttle
atom-fuzzy-grep.escapeOnPaste true boolean Escape pasted text
atom-fuzzy-grep.fixEnv true boolean Will fix $PATH variable when running your favourite grep tool, environment package should be installed.

Contributing

Feel free to open issue or send pull request.

Keywords: fuzzy, grep, ag, pt, productivity, search, find Suggest keywords
Fork me on GitHub