Created
December 22, 2021 23:00
-
-
Save vitorbertulucci/f627538a9c44d7950ec55b9ae84e456a to your computer and use it in GitHub Desktop.
Fuzifinder tmux helper
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
#!/usr/bin/env bash | |
# I took this code from https://github.com/awesome-streamers/awesome-streamerrc/blob/master/ThePrimeagen/tmux2 | |
# And updated it to my use-case | |
if [[ $# -eq 1 ]]; then | |
selected=$1 | |
else | |
items=`find ~/Projects -maxdepth 1 -mindepth 1 -type d` | |
selected=`echo "$items" | fzf` | |
fi | |
dirname=`basename $selected` | |
tmux switch-client -t $dirname | |
if [[ $? -eq 0 ]]; then | |
exit 0 | |
fi | |
tmux new-session -c $selected -d -s $dirname && tmux switch-client -t $dirname || tmux new -c $selected -A -s $dirname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment