diff options
Diffstat (limited to 'tmux')
-rw-r--r-- | tmux/.config/tmux/tmux.conf | 13 | ||||
-rwxr-xr-x | tmux/.local/bin/tmux-sessions | 24 | ||||
-rwxr-xr-x | tmux/.local/bin/tmux-tree | 16 |
3 files changed, 8 insertions, 45 deletions
diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index 396e23a..8fa0f6a 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -14,13 +14,15 @@ set -g prefix C-a set -g base-index 1 set -g pane-base-index 1 set -g detach-on-destroy off +set -g status-keys vi bind-key -N "Switch last session" A switch-client -l bind-key -N "Clock" T clock-mode -bind-key -N "Host: switch" s run-shell ~/.local/bin/tmux-sshr -bind-key -N "Session: new" f run-shell ~/.local/bin/tmux-projectr -bind-key -N "Session: switch" F run-shell ~/.local/bin/tmux-sessions -bind-key -N "Window: new" t new-window +bind-key -N "Host" s run-shell ~/.local/bin/tmux-sshr +bind-key -N "Session" f run-shell ~/.local/bin/tmux-projectr +bind-key -N "Window" t new-window +bind-key -N "Switch" w choose-tree -Zws -F \ + "#(echo '#{tree_mode_format}' | sed 's%##{session_windows} windows%##{s|$HOME|~|:session_path}%')" # i3/sway style window navigation bind-key '!' if-shell 'tmux swapw -t :1 -d' '' 'movew -t :1' @@ -45,7 +47,8 @@ if "test ! -d $XDG_CONFIG_HOME/tmux/plugins/tpm" \ run '$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm' -set-hook -g session-created 'if -F "#{m/r:^[0-9]+$,#{session_name}}" "rename-session \"#{b:session_path}\""' +set -g status-left-length 30 +set -g status-left "#[bg=#A89984, fg=#3C3836]#{?client_prefix,#[bg=#fe8019],#[bg=#A89984]} #{s|~/||:#{s|$HOME|~|:session_path}} " %if #{m:*ssh,#{socket_path}} source "$XDG_CONFIG_HOME/tmux/ssh.conf" diff --git a/tmux/.local/bin/tmux-sessions b/tmux/.local/bin/tmux-sessions deleted file mode 100755 index a6b3c48..0000000 --- a/tmux/.local/bin/tmux-sessions +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -if [ "$#" -eq 0 ]; then - FZF_CMD="sshr -tE -L default" - - # shellcheck disable=2016,2046 - set -- $( - $FZF_CMD | - fzf-tmux "$FZF_TMUX_OPTS" -- --tac --select-1 --exit-0 \ - --bind "ctrl-q:execute(tmux kill-session -t{})+reload($FZF_CMD)" \ - --bind 'focus:transform-header(tmux display -t{} -p "#{session_path}")' \ - --preview-window=right,80% --preview='tmux capture-pane -ep -t{}:' - ) -fi - -if [ "$#" -eq 0 ]; then - exit 0 -fi - -if [ -z "$TMUX" ]; then - tmux attach-session -t "$1" -else - tmux switch-client -t "$1" -fi diff --git a/tmux/.local/bin/tmux-tree b/tmux/.local/bin/tmux-tree deleted file mode 100755 index 600fd61..0000000 --- a/tmux/.local/bin/tmux-tree +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 |