Last active
May 26, 2022 22:17
-
-
Save bkono/7c7a5c1f30a54d80c751d0782be82f6e to your computer and use it in GitHub Desktop.
Some useful FZF fish funcs
This file contains hidden or 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
function f -d "Fuzzy-find and open a file in current directory" | |
set file (fzf --height 40% --info inline --border --reverse --preview 'bat {}') | |
if test -n "$file" | |
nvim $file | |
end | |
end |
This file contains hidden or 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
function fb -d "Fuzzy-find and checkout a branch" | |
git rev-parse HEAD > /dev/null 2>&1 || return | |
git branch --all --sort=-committerdate | grep -v HEAD | string trim | fzf -d 15 --reverse --preview='git show --color=always --stat --patch {1}' | read -l result | |
if test -n "$result" | |
if string match "remotes/*" "$result" | |
git checkout -t "$result" | |
else | |
git checkout "$result" | |
end | |
end | |
end |
This file contains hidden or 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
function fl -d "Fuzzy-search through git log" | |
_fzf_search_git_log | |
end |
This file contains hidden or 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
function fs -d "Switch tmux session" | |
tmux list-sessions -F "#{session_name}" | fzf | read -l result; and tmux switch-client -t "$result" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment