dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 2014db1c0e1ab4c1aa1f33eb97253cdff1e69ad0
parent 252fc58d55444a7669514946520b819c2d262ac9
Author: Janis Pagel <janis.pagel@ims.uni-stuttgart.de>
Date:   Mon, 22 Jun 2020 14:18:36 +0200

Add option to not start tmux at zsh start

Also fix bug that falsely included /etc/hosts in ssh/scp completion

Diffstat:
Mzsh/zshrc | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/zsh/zshrc b/zsh/zshrc @@ -44,9 +44,6 @@ zstyle ':completion:*' rehash true zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache -# Get completion for hostname if in ~/.ssh/config -_hosts() { compadd $(getent hosts | tr -s ' ' '\t' | cut -f2) } - ####################### ### Options ########### ####################### @@ -134,12 +131,14 @@ RPROMPT='$(bg_process) $(git_prompt_string) %(?..[%?]) [%1~/]' ################# # TMUX -if [[ -z "$TMUX" ]] && [[ -n "$DISPLAY" ]]; then # Test if tmux is running - ID="$( tmux ls | grep -vm1 attached | cut -d: -f1 )" # get the id of a deattached session - if [[ -z "$ID" ]]; then # if not available create a new one - tmux new-session - else - tmux attach-session -t "$ID" # if available attach to it +if [[ -z $TMUXAUTOATTACH ]]; then # Prevent from running if variable is set + if [[ -z "$TMUX" ]] && [[ -n "$DISPLAY" ]]; then # Test if tmux is running + ID="$( tmux ls | grep -vm1 attached | cut -d: -f1 )" # get the id of a deattached session + if [[ -z "$ID" ]]; then # if not available create a new one + tmux new-session + else + tmux attach-session -t "$ID" # if available attach to it + fi fi fi if [ -n "$TMUX" ]; then # If tmux is running