Created
November 15, 2018 22:25
-
-
Save swdunlop/b3345e67f5ca75f8560cf498d1820bf2 to your computer and use it in GitHub Desktop.
A few Fish functions for browsing files using FZF, Highlight and RipGrep
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
#!/usr/bin/env fish | |
function fzf-files | |
fzf \ | |
--header 'Enter to open in Sublime, ctrl-y to copy path' \ | |
--bind 'enter:execute-silent:subl {}' \ | |
--bind 'ctrl-y:execute-silent:echo {} | pbcopy' \ | |
--preview 'highlight -O xterm256 -s darkbone -l {} 2>/dev/null || | |
cat {}' | |
end | |
function fzf-find | |
if count $argv >/dev/null | |
find $argv -type f | fzf-files | |
else | |
find . -type f | fzf-files | |
end | |
end | |
function fzf-rg | |
rg -l $argv | fzf-files | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love FZF, but adding key bindings and hacking around read in Fish seems.. Suboptimal. It's easier just to add a few functions, IMHO.