diff options
Diffstat (limited to 'tmux')
-rw-r--r-- | tmux/.config/tmux/tmux.conf | 2 | ||||
-rwxr-xr-x | tmux/.local/bin/tm | 13 | ||||
-rwxr-xr-x | tmux/.local/bin/tmux-sessions | 8 | ||||
-rwxr-xr-x | tmux/.local/bin/tmux-tree | 16 |
4 files changed, 26 insertions, 13 deletions
diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index 204382e..def47ff 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -6,6 +6,7 @@ set -g detach-on-destroy off set -g prefix C-a bind-key f run-shell ~/.local/bin/tmux-sessionizer +bind-key F run-shell ~/.local/bin/tmux-sessions bind-key e new-window -Sn nvim nvim set -g @plugin 'tmux-plugins/tpm' @@ -15,6 +16,7 @@ set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @resrrect-dir "$XDG_DATA_DIR/tmux/resurrect" set -g @resurrect-strategy-nvim 'session' if "test ! -d $XDG_CONFIG_HOME/tmux/plugins/tpm" \ diff --git a/tmux/.local/bin/tm b/tmux/.local/bin/tm deleted file mode 100755 index 5c976d3..0000000 --- a/tmux/.local/bin/tm +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" -session=$( - tmux list-sessions -F "#{session_name}" 2>/dev/null | - sed "/^$(tmux display-message -p '#S' 2>/dev/null)$/d" | - fzf --query="$1" --select-1 --exit-0 -) && - tmux $change -t "$session" || - ( - tmux new-session -d -s $session && - tmux $change -t "$session" - ) diff --git a/tmux/.local/bin/tmux-sessions b/tmux/.local/bin/tmux-sessions new file mode 100755 index 0000000..68fec47 --- /dev/null +++ b/tmux/.local/bin/tmux-sessions @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" + +session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | + fzf-tmux -p -- --reverse --exit-0 --preview='tmux-tree {} | bat --style plain') && + tmux $change -t "$session" || exit 0 + diff --git a/tmux/.local/bin/tmux-tree b/tmux/.local/bin/tmux-tree new file mode 100755 index 0000000..d60bb44 --- /dev/null +++ b/tmux/.local/bin/tmux-tree @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +tmux ls -F'#{session_id}' | while read -r s; do + S=$(tmux ls -F'#{session_id}#{session_name}: #{T:tree_mode_format}' | grep ^"$s") + session_info=${S##$s} + session_name=$(echo "$session_info" | cut -d ':' -f 1) + if [[ -n "$1" ]] && [[ "$1" == "$session_name" ]]; then + echo -e "\033[1;34m$session_info\033[0m" + else + echo -e "\033[1m$session_info\033[0m" + fi + tmux lsw -t"$s" -F'#{window_id}' | while read -r w; do + W=$(tmux lsw -t"$s" -F'#{window_id}#{T:tree_mode_format}' | grep ^"$w") + echo " ${W##$w}" + done +done |