From 4d73cecaf110bd76fcf086aa58c109058b52b81f Mon Sep 17 00:00:00 2001 From: thek4n Date: Fri, 24 May 2024 21:45:45 +0300 Subject: [PATCH] tmux: remote config --- home/user/.bashrc | 10 +++++++++- home/user/.config/tmux/mappings.conf | 2 +- home/user/.config/tmux/remote.conf | 3 +++ home/user/.config/zsh/.zshrc | 10 +++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 home/user/.config/tmux/remote.conf diff --git a/home/user/.bashrc b/home/user/.bashrc index 8c66aa2..18f65ce 100644 --- a/home/user/.bashrc +++ b/home/user/.bashrc @@ -3,8 +3,8 @@ if \ [ "$(tty)" != "/dev/tty3" ] && \ - [ -z "$TMUX" ] && \ command -v tmux &>/dev/null && \ + [ -z "$TMUX" ] && \ tmux -N -L "$USER" list-sessions &>/dev/null then exec tmux -N -L "$USER" new-session @@ -12,4 +12,12 @@ fi if [ -f "$HOME/.config/bash/sourcer" ]; then source "$HOME/.config/bash/sourcer" +fi + +if \ + command -v tmux &>/dev/null && \ + [ -n "$TMUX" ] && \ + [ -n "$SSH_CLIENT" ] +then + tmux source-file "$XDG_CONFIG_HOME/tmux/remote.conf" fi \ No newline at end of file diff --git a/home/user/.config/tmux/mappings.conf b/home/user/.config/tmux/mappings.conf index 4aa7a22..538f1bc 100644 --- a/home/user/.config/tmux/mappings.conf +++ b/home/user/.config/tmux/mappings.conf @@ -50,7 +50,7 @@ bind R command-prompt -I '#S' -p "New session name:" "rename-session '%%'" # SSH Session -bind H command-prompt -p "Remote host:" "new-session -s 'ssh-%1' -A ssh %1 \; set default-command 'ssh %1' \; set remain-on-exit on \; set detach-on-destroy on" +bind H command-prompt -p "Remote host:" "new-session -s 'ssh-%1' -A ssh %1 \; set default-command 'ssh %1' \; set remain-on-exit on" # Call prompt via prefix ; diff --git a/home/user/.config/tmux/remote.conf b/home/user/.config/tmux/remote.conf new file mode 100644 index 0000000..9aa467f --- /dev/null +++ b/home/user/.config/tmux/remote.conf @@ -0,0 +1,3 @@ +# vim: ft=tmux + +set detach-on-destroy on \ No newline at end of file diff --git a/home/user/.config/zsh/.zshrc b/home/user/.config/zsh/.zshrc index 0a82591..be6f0fd 100644 --- a/home/user/.config/zsh/.zshrc +++ b/home/user/.config/zsh/.zshrc @@ -3,8 +3,8 @@ if \ [ "$(tty)" != "/dev/tty3" ] && \ - [ -z "$TMUX" ] && \ command -v tmux &>/dev/null && \ + [ -z "$TMUX" ] && \ tmux -N -L "$USER" list-sessions &>/dev/null then exec tmux -N -L "$USER" new-session @@ -12,4 +12,12 @@ fi if [ -f "$ZDOTDIR/sourcer" ]; then source "$ZDOTDIR/sourcer" +fi + +if \ + command -v tmux &>/dev/null && \ + [ -n "$TMUX" ] && \ + [ -n "$SSH_CLIENT" ] +then + tmux source-file "$XDG_CONFIG_HOME/tmux/remote.conf" fi \ No newline at end of file