20 lines
610 B
Fish
Executable file
20 lines
610 B
Fish
Executable file
#!/usr/bin/env fish
|
|
set pipe (mktemp --dry-run)
|
|
mkfifo $pipe
|
|
|
|
fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec-batch dirname {} | tee $pipe >/dev/null &
|
|
fd . ~/ --min-depth 1 --max-depth 3 --type d --exec-batch realpath {} | tee $pipe >/dev/null &
|
|
set selected (cat $pipe | awk '!seen[$0]++' | fzf --query "$argv")
|
|
rm -f "$pipe"
|
|
|
|
set selected_name (basename $selected 2>/dev/null | string replace "." "_")
|
|
|
|
if not test -n "$selected_name"
|
|
exit 1
|
|
end
|
|
|
|
if ! tmux has-session -t $selected_name 2> /dev/null
|
|
tmux new-session -ds $selected_name -c $selected
|
|
end
|
|
|
|
tmux-switch $selected_name
|