feat(tmux-sessionizer): fuzzy match input

This commit is contained in:
Moritz Böhme 2023-04-26 11:23:28 +02:00
parent 35c5d5ed4b
commit 0b7e18a3f5

View file

@ -9,11 +9,15 @@ let
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ]; runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ];
text = '' text = ''
#!/usr/bin/env bash #!/usr/bin/env bash
options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*")
if [[ $# -eq 1 ]]; then if [[ -z $options ]]; then
selected=$1 return 1
elif [[ $(wc -l <<< "$options") -eq 1 ]]; then
selected="$options"
else else
selected=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf) echo "$options" | fzf --query="$*"
fi fi
if [[ -z $selected ]]; then if [[ -z $selected ]]; then