mirror of
https://codeberg.org/leana8959/.files.git
synced 2026-02-03 07:29:41 +00:00
fish: refactored tmux_sessionizer
This commit is contained in:
parent
d2d49f9de4
commit
d78f5b9043
7 changed files with 74 additions and 78 deletions
|
|
@ -1,20 +1,19 @@
|
|||
function tmux_home
|
||||
# echo "---home---" >> /tmp/TMUX_DEBUG
|
||||
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
|
||||
echo (tmux display-message -p '#S') >/tmp/TMUX_LAST
|
||||
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
|
||||
function tmux_home \
|
||||
--description "Take me back to ~"
|
||||
|
||||
# create session if doesn't exist
|
||||
if ! tmux has-session -t="home" 2>/dev/null
|
||||
set session_name home
|
||||
|
||||
if [ -n "$TMUX" ]
|
||||
__tmux_register_session
|
||||
end
|
||||
|
||||
if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null
|
||||
tmux \
|
||||
new-session -ds home \; \
|
||||
new-window -t home \; \
|
||||
select-window -t "home":1
|
||||
end
|
||||
|
||||
if [ -z $TMUX ]
|
||||
tmux attach-session -t home
|
||||
else
|
||||
tmux switch-client -t home
|
||||
end
|
||||
__tmux_attach_or_switch $session_name
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue