-
-
Save knoxknox/5081b7e283170060139673bcb0138a59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
# Interactive search. | |
# Usage: `ff` or `ff <folder>`. | |
# | |
[[ -n $1 ]] && cd $1 # go to provided folder or noop | |
RG_DEFAULT_COMMAND="rg -i -l --hidden --no-ignore-vcs" | |
selected=$( | |
FZF_DEFAULT_COMMAND="rg --files" fzf \ | |
-m \ | |
-e \ | |
--ansi \ | |
--phony \ | |
--reverse \ | |
--bind "ctrl-a:select-all" \ | |
--bind "f12:execute-silent:(subl -b {})" \ | |
--bind "change:reload:$RG_DEFAULT_COMMAND {q} || true" \ | |
--preview "rg -i --pretty --context 2 {q} {}" | cut -d":" -f1,2 | |
) | |
[[ -n $selected ]] && subl $selected # open multiple files in editor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment