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:
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
|
||||
# history-substring-search
|
||||
vi-mode
|
||||
tmux
|
||||
colored-man-pages
|
||||
command-not-found
|
||||
zsh-autopair
|
||||
@@ -43,10 +42,6 @@ VI_MODE_SET_CURSOR=true
|
||||
# Might cause issues?
|
||||
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
|
||||
autoload -U compinit && compinit
|
||||
source "$ZSH/oh-my-zsh.sh"
|
||||
@@ -142,3 +137,15 @@ for km in viopp visual; do
|
||||
bindkey -M $km $c select-bracketed
|
||||
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