Created
March 12, 2019 09:09
-
-
Save c02y/cdbfbe42656fbaf6457c9a67c4598ead to your computer and use it in GitHub Desktop.
config.fish
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
function t -d 'if tmux is running, attach it, if not, create a new tmux session, and check $SHELL' | |
if not command -sq tmux | |
echo tmux is not installed, please install it! | |
return 1 | |
end | |
if test (basename $SHELL) = "bash" | |
if test -f ~/anaconda3/bin/fish | |
set -gx SHELL ~/anaconda3/bin/fish | |
else if command -sq fish | |
set -gx SHELL (which fish) | |
else | |
echo "No fish is installed, using old $SHELL as SHELL!" | |
end | |
end | |
# attach a session if it exists, it failed, tmux a new one, if failed, echo message | |
tmux attach ^/dev/null; or tmux ^/dev/null; or echo "Already inside a tmux session, $SHELL!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment