tmux: Use sesh for tmux session management
The zsh tmux plugin has been removed and instead fzf is shown to select a session.
This commit is contained in:
@@ -73,3 +73,5 @@ bind-key -n M-7 select-window -t 7
|
|||||||
bind-key -n M-8 select-window -t 8
|
bind-key -n M-8 select-window -t 8
|
||||||
bind-key -n M-9 select-window -t 9
|
bind-key -n M-9 select-window -t 9
|
||||||
bind-key -n M-0 select-window -t 10
|
bind-key -n M-0 select-window -t 10
|
||||||
|
|
||||||
|
bind-key "a" run-shell "sesh-select"
|
||||||
|
|||||||
17
zsh/dot-local/bin/sesh-select
Executable file
17
zsh/dot-local/bin/sesh-select
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
exec </dev/tty
|
||||||
|
exec <&1
|
||||||
|
local session
|
||||||
|
session=$(sesh list -i | fzf-tmux -p 70%,60% \
|
||||||
|
--no-sort --ansi --border-label ' Select session ' --prompt '⚡ ' \
|
||||||
|
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
|
||||||
|
--bind 'btab:down,tab:up' \
|
||||||
|
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list -i)' \
|
||||||
|
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t -i)' \
|
||||||
|
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c -i)' \
|
||||||
|
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z -i)' \
|
||||||
|
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
|
||||||
|
--bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list -i)')
|
||||||
|
[[ -z "$session" ]] && return
|
||||||
|
sesh connect $session
|
||||||
@@ -22,7 +22,6 @@ plugins=(
|
|||||||
# Disabled because the highlighting conflicts with autosuggestions
|
# Disabled because the highlighting conflicts with autosuggestions
|
||||||
# history-substring-search
|
# history-substring-search
|
||||||
vi-mode
|
vi-mode
|
||||||
tmux
|
|
||||||
colored-man-pages
|
colored-man-pages
|
||||||
command-not-found
|
command-not-found
|
||||||
zsh-autopair
|
zsh-autopair
|
||||||
@@ -43,10 +42,6 @@ VI_MODE_SET_CURSOR=true
|
|||||||
# Might cause issues?
|
# Might cause issues?
|
||||||
KEYTIMEOUT=1
|
KEYTIMEOUT=1
|
||||||
|
|
||||||
ZSH_TMUX_AUTOSTART=true
|
|
||||||
ZSH_TMUX_AUTOCONNECT=false
|
|
||||||
ZSH_TMUX_FIXTERM=true
|
|
||||||
|
|
||||||
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
||||||
autoload -U compinit && compinit
|
autoload -U compinit && compinit
|
||||||
source "$ZSH/oh-my-zsh.sh"
|
source "$ZSH/oh-my-zsh.sh"
|
||||||
@@ -142,3 +137,15 @@ for km in viopp visual; do
|
|||||||
bindkey -M $km $c select-bracketed
|
bindkey -M $km $c select-bracketed
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
ZSH_TMUX_AUTOSTART=true
|
||||||
|
if (( $+commands[tmux] )); then
|
||||||
|
if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then
|
||||||
|
if (( $+commands[sesh] )); then
|
||||||
|
sesh-select
|
||||||
|
else
|
||||||
|
tmux new-session
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user