mirror of
https://github.com/boxpositron/absolute-dotfiles.git
synced 2026-02-28 11:40:37 +00:00
fix(zshrc): fix tmx function to switch to next session and kill current one, add support for no other sessions exist case
feat(zshrc): add TMUX= environment variable to new-session command in tmn function to allow running tmux commands outside of a tmux session
This commit is contained in:
16
.zshrc
16
.zshrc
@@ -199,6 +199,18 @@ function tml() {
|
||||
}
|
||||
|
||||
|
||||
function tmx(){
|
||||
current_session=$(tmux display-message -p '#S') # Get current session name
|
||||
next_session=$(tmux list-sessions | grep -v "^$current_session" | head -n1 | cut -d: -f1)
|
||||
|
||||
if [ -n "$next_session" ]; then
|
||||
tmux switch-client -t "$next_session" # Switch to next session
|
||||
tmux kill-session -t "$current_session" # Kill the current session
|
||||
else
|
||||
tmux kill-session -t "$current_session" # Kill the session if no others exist
|
||||
fi
|
||||
}
|
||||
|
||||
function tma() {
|
||||
|
||||
# If no argument is passed, show the list of tmux sessions with fzf
|
||||
@@ -235,7 +247,7 @@ function tmn() {
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new -s $1
|
||||
TMUX= tmux new-session -d -s $1
|
||||
}
|
||||
|
||||
_fzf_complete_tma() {
|
||||
@@ -296,3 +308,5 @@ fi
|
||||
if [ -d "$HOME/neovim/bin" ]; then
|
||||
export PATH="$HOME/neovim/bin:$PATH"
|
||||
fi
|
||||
|
||||
. "$HOME/.deno/env"
|
||||
|
||||
Reference in New Issue
Block a user