From 8e3c3adaa5469d5a6a2ab7ca6facaee136652db2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 17 Sep 2021 22:38:00 +0100 Subject: [PATCH] Remove tat command and automatically loading tmux This isn't needed now that the tmux-sessioniser is working, and it also means that there isn't a weird "System32" session automatically created within WSL2, or with my username in Pop!_OS. --- bin/bin/tat | 31 ------------------------------- zsh/.zsh/configs/tmux.zsh | 11 ----------- 2 files changed, 42 deletions(-) delete mode 100755 bin/bin/tat delete mode 100644 zsh/.zsh/configs/tmux.zsh diff --git a/bin/bin/tat b/bin/bin/tat deleted file mode 100755 index 901f252..0000000 --- a/bin/bin/tat +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# Attach or create tmux session named the same as current directory. - -path_name="$(basename "$PWD" | tr . -)" -session_name=${1-$path_name} - -not_in_tmux() { - [ -z "$TMUX" ] -} - -session_exists() { - tmux has-session -t "=$session_name" -} - -create_detached_session() { - (TMUX='' tmux new-session -Ad -s "$session_name") -} - -create_if_needed_and_attach() { - if not_in_tmux; then - tmux new-session -As "$session_name" - else - if ! session_exists; then - create_detached_session - fi - tmux switch-client -t "$session_name" - fi -} - -create_if_needed_and_attach diff --git a/zsh/.zsh/configs/tmux.zsh b/zsh/.zsh/configs/tmux.zsh deleted file mode 100644 index cb3b1e4..0000000 --- a/zsh/.zsh/configs/tmux.zsh +++ /dev/null @@ -1,11 +0,0 @@ -ensure_tmux_is_running() { - if _not_inside_tmux; then - tat - fi -} - -_not_inside_tmux() { - [[ -z "$TMUX" ]] -} - -ensure_tmux_is_running