tmux mapping choose session
This commit is contained in:
parent
9d0568160d
commit
0f001c52d5
@ -1,6 +1,6 @@
|
||||
declare -r -A TARGETS=(
|
||||
["colors"]=".config/terminal-colors.d"
|
||||
["tmux"]=".config/tmux .tmux .config/systemd/user/tmux.service .local/bin/tmux_start_session.sh .local/bin/tmux_attach_session.sh"
|
||||
["tmux"]=".config/tmux .tmux .config/systemd/user/tmux.service .local/bin/tmux_start_session.sh .local/bin/tmux_attach_session.sh .local/bin/tmux_choose_session.sh"
|
||||
["bash"]=".config/bash .bashrc .profile %tmux %colors"
|
||||
["zsh"]="%bash .config/zsh .zshenv .inputrc"
|
||||
["alacritty"]=".config/alacritty"
|
||||
|
||||
@ -24,9 +24,6 @@ bind WheelDownPane send-keys -N 2 scroll-Down
|
||||
bind F12 send-keys F12
|
||||
|
||||
|
||||
bind s choose-tree-index
|
||||
|
||||
|
||||
# View current pane in editor
|
||||
bind-key y {
|
||||
capture-pane -J
|
||||
@ -193,4 +190,6 @@ bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
|
||||
|
||||
|
||||
# Session managment
|
||||
bind f display-popup -EE '~/.local/bin/tmux_start_session.sh'
|
||||
bind s display-popup -w 80% -h 80% -EE -T 'Attach existing session' '~/.local/bin/tmux_choose_session.sh'
|
||||
bind f display-popup -EE -T 'Start new session' '~/.local/bin/tmux_start_session.sh'
|
||||
bind a choose-tree-index
|
||||
31
home/user/.local/bin/tmux_choose_session.sh
Executable file
31
home/user/.local/bin/tmux_choose_session.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
export FZF_DEFAULT_OPTS="\
|
||||
--cycle \
|
||||
--pointer='' \
|
||||
--marker='+' \
|
||||
--color='pointer:green' \
|
||||
--bind \
|
||||
ctrl-/:toggle-preview,\
|
||||
ctrl-a:toggle-all,\
|
||||
ctrl-p:preview-up,\
|
||||
ctrl-n:preview-down,\
|
||||
ctrl-u:clear-query,\
|
||||
ctrl-q:toggle+down,\
|
||||
tab:replace-query,\
|
||||
shift-tab:toggle\
|
||||
"
|
||||
|
||||
declare sessions
|
||||
sessions="$(tmux list-session -F '#S')"
|
||||
readonly sessions
|
||||
|
||||
|
||||
declare session
|
||||
session="$(echo "${sessions}" | fzf +m --preview-window 75%,follow --preview 'tmux capture-pane -p -e -t {1}')"
|
||||
readonly session
|
||||
|
||||
if [[ -n "${session}" ]]; then
|
||||
tmux switch-client -t "${session}"
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user