feat: auto connect to tmux if ssh
This commit is contained in:
		| @@ -112,16 +112,6 @@ if ! shopt -oq posix; then | |||||||
|   fi |   fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
| if ! command -v tmux &> /dev/null |  | ||||||
| then |  | ||||||
|     echo "<the_command> could not be found" |  | ||||||
|     exit |  | ||||||
| else |  | ||||||
|   # Auto connect to tmux session of ssh |  | ||||||
|   if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then |  | ||||||
|     tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux |  | ||||||
|   fi |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| [ -z $DISPLAY ] && export DISPLAY=127.0.0.1:0.0 | [ -z $DISPLAY ] && export DISPLAY=127.0.0.1:0.0 | ||||||
| . "$HOME/.cargo/env" | . "$HOME/.cargo/env" | ||||||
|   | |||||||
| @@ -75,5 +75,16 @@ fi | |||||||
| # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | ||||||
| [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Auto connect to tmux session of ssh | ||||||
|  | if command -v tmux &> /dev/null | ||||||
|  | then | ||||||
|  |   if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then | ||||||
|  |     tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux | ||||||
|  |   fi | ||||||
|  | fi | ||||||
|  |  | ||||||
| export PNPM_HOME="$HOME/.local/share/pnpm" | export PNPM_HOME="$HOME/.local/share/pnpm" | ||||||
| export PATH="$PNPM_HOME:$PATH" | export PATH="$PNPM_HOME:$PATH" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user