From c153a755072265b8a7c8c29db245ba9416cfe6bc Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 31 Jan 2024 17:47:55 +0300 Subject: [PATCH] Tmux & Container : Use current dir name when attaching by default instead of main. --- .config/bash/module/Container.sh | 5 +++-- .config/bash/module/Tmux.sh | 5 +++-- .doc/Bash.md | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.config/bash/module/Container.sh b/.config/bash/module/Container.sh index e77553e..f36d02e 100644 --- a/.config/bash/module/Container.sh +++ b/.config/bash/module/Container.sh @@ -1,11 +1,12 @@ # Attach/create container box in current directory with specified name. -# Uses `main` name by default. +# By default uses current dir name. # Usage: ca [NAME] function ca() { local name="${1}" # Set default name. - [[ "${name}" = "" ]] && name="main" + # [[ "${name}" = "" ]] && name="main" + [[ "${name}" = "" ]] && name="${PWD##*/}" # Append box prefix. name="box-${name}" diff --git a/.config/bash/module/Tmux.sh b/.config/bash/module/Tmux.sh index 5060fbe..eca625c 100644 --- a/.config/bash/module/Tmux.sh +++ b/.config/bash/module/Tmux.sh @@ -1,11 +1,12 @@ # Create/attach to named session. -# By default uses name `main`. +# By default uses current dir name. # Usage: ta [NAME] function ta() { local name="${1}" # Set default name. - [[ "${name}" = "" ]] && name="main" + # [[ "${name}" = "" ]] && name="main" + [[ "${name}" = "" ]] && name="${PWD##*/}" # Create session. tmux new-session -s "${name}" -d &> /dev/null diff --git a/.doc/Bash.md b/.doc/Bash.md index 38eeebe..2b531b5 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -78,7 +78,7 @@ Command|Description Command|Description ---|--- -`ca [NAME]`|Attach/create container box in current directory with specified name. Uses `main` name by default. +`ca [NAME]`|Attach/create container box in current directory with specified name. By default uses current dir name. `ck [NAME]`|Remove container box with specified name. By default uses `main` name. `cka`|Remove all container boxes. `cl`|List all container boxes. @@ -367,7 +367,7 @@ Command|Description Command|Description ---|--- -`ta [NAME]`|Create/attach to named session. By default uses name `main`. +`ta [NAME]`|Create/attach to named session. By default uses current dir name. `td`|Detach from running session. `tda`|Detach all other tmux clients. `tl`|List running sessions.