Add an automatic tmux session when using ssh
This commit is contained in:
+5
-1
@@ -21,7 +21,6 @@ export PATH="$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
|
||||
|
||||
# Nvm
|
||||
source /etc/profile.d/nvm.sh
|
||||
|
||||
# Auto-switch Node version when entering a directory with .nvmrc
|
||||
_nvm_auto_use() {
|
||||
if [[ -f .nvmrc ]]; then
|
||||
@@ -30,6 +29,11 @@ _nvm_auto_use() {
|
||||
}
|
||||
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }_nvm_auto_use"
|
||||
|
||||
# Auto-start or attach tmux for SSH interactive shells
|
||||
if [[ -n "$SSH_CONNECTION" && -z "$TMUX" && $- == *i* ]]; then
|
||||
exec tmux new-session -A -s main
|
||||
fi
|
||||
|
||||
# Zoxide
|
||||
eval "$(zoxide init bash)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user