fix(tmux): refactor
This commit is contained in:
parent
06e80254bd
commit
7519995398
@ -214,7 +214,6 @@ bind-key f copy-mode \; send-keys -X search-backward \
|
|||||||
|
|
||||||
|
|
||||||
# Session managment
|
# Session managment
|
||||||
bind a display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/tmux_attach_session.sh'
|
bind a display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/attach_session.sh'
|
||||||
bind s display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/tmux_start_session.sh'
|
bind s display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/start_session.sh'
|
||||||
bind S display-popup -EE -w 40% -h 80% -B '~/.config/tmux/scripts/tmux_start_projects.sh'
|
bind S display-popup -EE -w 40% -h 80% -B '~/.config/tmux/scripts/start_projects.sh'
|
||||||
bind k display-popup -EE -w 80% -h 80% -B '~/.config/tmux/scripts/tmux_kill_sessions.sh'
|
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
readonly tmux_list_sessions_script="${HOME}/.config/tmux/scripts/tmux_list_sessions.sh"
|
readonly tmux_list_sessions_script="${HOME}/.config/tmux/scripts/list_sessions.sh"
|
||||||
|
readonly tmux_kill_session_script="${HOME}/.config/tmux/scripts/kill_session.sh"
|
||||||
|
|
||||||
export FZF_DEFAULT_OPTS="\
|
export FZF_DEFAULT_OPTS="\
|
||||||
${FZF_DEFAULT_OPTS}
|
${FZF_DEFAULT_OPTS}
|
||||||
@ -14,7 +15,7 @@ ${FZF_DEFAULT_OPTS}
|
|||||||
--preview-window=follow
|
--preview-window=follow
|
||||||
--preview='tmux capture-pane -p -e -t {1}'
|
--preview='tmux capture-pane -p -e -t {1}'
|
||||||
--bind
|
--bind
|
||||||
ctrl-x:execute\(tmux\ kill-session\ -t\ {1}\)+reload\(${tmux_list_sessions_script}\),\
|
ctrl-x:execute\(${tmux_kill_session_script}\ {1}\)+reload\(${tmux_list_sessions_script}\),\
|
||||||
load:reload\(${tmux_list_sessions_script}\;sleep\ 1\)\
|
load:reload\(${tmux_list_sessions_script}\;sleep\ 1\)\
|
||||||
"
|
"
|
||||||
|
|
||||||
7
home/user/.config/tmux/scripts/kill_session.sh
Executable file
7
home/user/.config/tmux/scripts/kill_session.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "${1}" = "landing" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmux kill-session -t "${1}"
|
||||||
@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
readonly tmux_list_sessions_script="${HOME}/.config/tmux/scripts/tmux_list_sessions.sh"
|
|
||||||
|
|
||||||
export FZF_DEFAULT_OPTS="\
|
|
||||||
${FZF_DEFAULT_OPTS}
|
|
||||||
--multi
|
|
||||||
--border=rounded
|
|
||||||
--border-label-pos=bottom
|
|
||||||
--border-label=' Kill sessions '
|
|
||||||
--color='border:red,label:red'
|
|
||||||
--preview-window=follow
|
|
||||||
--preview='tmux capture-pane -p -e -t {1}'
|
|
||||||
--bind
|
|
||||||
ctrl-x:execute\(tmux\ kill-session\ -t\ {1}\)+reload\(${tmux_list_sessions_script}\)\
|
|
||||||
"
|
|
||||||
|
|
||||||
sessions_to_kill="$(~/.config/tmux/scripts/tmux_list_sessions.sh | fzf | awk '{printf $1"\n"}')"
|
|
||||||
readonly sessions_to_kill
|
|
||||||
|
|
||||||
if [ -n "${sessions_to_kill}" ]; then
|
|
||||||
echo "${sessions_to_kill}" | xargs -n 1 tmux kill-session -t
|
|
||||||
fi
|
|
||||||
Loading…
x
Reference in New Issue
Block a user