From 39cd18a854056bf950b308719d0f6cb569ccb213 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Fri, 2 Dec 2022 12:23:32 +0000 Subject: Add some fzf functions --- nix-conf/home/includes/zsh.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 5c463c3..d69e4c2 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -136,6 +136,15 @@ stty -ixon function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) } + function fcd { cd $(fd -L --max-depth=''${1:-1} --type=d 2>/dev/null | fzf-tmux) } + + fif() { + if [ ! "$#" -gt 0 ]; then + echo "usage: fif " + return 1; + fi + rg --files-with-matches --no-messages "$1" | fzf $FZF_PREVIEW_WINDOW --preview "rg --ignore-case --pretty --context 10 '$1' {}" + } tre () { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; } -- cgit 1.4.1-2-gfad0