/atom-fuzzy-grep

Find files by keywords, regexp using ag, grep, ack or git-grep.

Primary LanguageCoffeeScriptMIT LicenseMIT

atom-fuzzy-grep package

⚠️ Looking for maintainers! ⚠️

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 -i --nocolor --nogroup --column
ack -i --nocolor --nogroup --column

grep

grep -r -n --color=never
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

  • Search folder detects on project path from active text editor.
  • When no editors opened or Untitled first project root path used.
  • When you have opened several projects and want to search through it you need to open any file from this project and start search dialog.
  • When active item not in project home directory used as root dir.
  • When no projects opened home directory used as root dir.

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:toggleWordUnderCursor atom-workspace 'cmd-*' Open dialog with word under cursor
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.