Skip to content

Instantly share code, notes, and snippets.

@gmolveau
Created February 8, 2020 21:18
Show Gist options
  • Save gmolveau/31d6410507b0d59095065102c6f8ef3d to your computer and use it in GitHub Desktop.
Save gmolveau/31d6410507b0d59095065102c6f8ef3d to your computer and use it in GitHub Desktop.
How to fuzzy find something in text files

Install skim : https://github.com/lotabout/skim

Install ag : https://github.com/ggreer/the_silver_searcher


Use this command to find anything from your current repository recursively :

sk --ansi -i -c 'ag --color "{}"'

If you want to find and preview the file :

you can add this script to your $PATH - https://github.com/junegunn/fzf.vim/blob/master/bin/preview.sh

and then use this command :

sk --ansi -i -c 'ag --color "{}"' --preview "preview.sh {}"

If you want to find and edit in sublime text - assuming you already have sublime in your $PATH -

use this command to bind the shortcut control+p to open sublime

sk --ansi -i -c 'ag --color "{}"' --bind 'ctrl-p:execute-silent(sublime {1})'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment