#!/usr/bin/env fish # This is a small zellij project switcher # # This script is strongly inspired by the Tmux Sessionizer of @ThePrimaegen: # https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer # # For defining project folders export the variable $PROJECT_FOLDERS in your favourite shell # The folders should by delimited by a : # Fish example: set -x PROJECT_FOLDERS ~/projects:~/Downloads/My Folder set -l IFS ':' set folders (string split ':' -- $PROJECT_FOLDERS | string replace -r '^~' $HOME) if count $argv > 1 set selected $argv[1] else set selected (fd --type d --max-depth 1 . $folders | fzf --preview='') end set selected_name (basename "$selected" | tr . _) if test -n "$ZELLIJ_SESSION_NAME" echo -e "You are in a Zellij Session!\nPlease use the session manager to switch sessions.">&2 else cd $selected; zellij --layout zellij-ps attach -c $selected_name options end