fixed tmux start script default-tmux-session
changed tmux keymaps for pane splitting to start pane in the same directory
This commit is contained in:
@@ -1,23 +1,31 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SESSION='quak'
|
DEFAULT_SESSION='quak'
|
||||||
# dont forget the '-d' option, otherwise the rest of
|
DUMMY_SESSION='dummy'
|
||||||
# the commands will get executed after the session is closed
|
|
||||||
|
|
||||||
if $(tmux has-session -t ${SESSION}); then
|
# start dummy session to avoid error messages on `has-session`
|
||||||
echo "default session ${SESSION} already exists"
|
tmux new-session -d -s "$DUMMY_SESSION"
|
||||||
|
|
||||||
# return 1 to report error and abort the `dmux` alias
|
# check if the default session exists
|
||||||
return 1
|
# redirect stderr to /dev/null because `session not found` is
|
||||||
|
# not a relevant error in this case
|
||||||
|
if $(tmux has-session -t ${DEFAULT_SESSION} 2>/dev/null); then
|
||||||
|
echo "default session <${DEFAULT_SESSION}> already exists"
|
||||||
|
# no action needed if the session exists, the attach command is run externally
|
||||||
else
|
else
|
||||||
tmux new-session -d -s "$SESSION" -n "temp"
|
# dont forget the '-d' option, otherwise the session is closed
|
||||||
tmux new-window -t "$SESSION" -n "dotfiles" -c $HOME/dotfiles
|
# before the rest of the commands are executed
|
||||||
tmux new-window -t "$SESSION" -n "docs" -c $HOME/collection
|
tmux new-session -d -s "$DEFAULT_SESSION" -n "dotfiles" -c "$HOME/dotfiles"
|
||||||
tmux new-window -t "$SESSION" -n "stuff" -c $HOME
|
tmux new-window -t "$DEFAULT_SESSION" -n "docs" -c "$HOME/collection"
|
||||||
tmux kill-window -t "temp"
|
tmux new-window -t "$DEFAULT_SESSION" -n "stuff" -c "$HOME"
|
||||||
|
|
||||||
# this causes the script to exit only, when the session is ended or detached
|
# this causes the script to exit only, when the session is ended or detached
|
||||||
# it also causes the tmux detach command with hang up signal to fail
|
# it also causes tmux's detach command with hang up signal to fail
|
||||||
# therefore the following line is commented out and an alias setup in .bashrc
|
# therefore the following line is commented out
|
||||||
#tmux attach -t "$SESSION"
|
# an `alias` is created in `.bashrc` which calls this script and runs
|
||||||
|
# `tmux attach` on successful execution
|
||||||
|
|
||||||
|
#tmux attach -t "$DEFAULT_SESSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
tmux kill-session -t "$DUMMY_SESSION"
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ unbind x
|
|||||||
bind x kill-pane -t +0
|
bind x kill-pane -t +0
|
||||||
|
|
||||||
# keymaps for splitting
|
# keymaps for splitting
|
||||||
bind v split-pane -v
|
bind v split-pane -v -c "#{pane_current_path}"
|
||||||
bind h split-pane -h
|
bind h split-pane -h -c "#{pane_current_path}"
|
||||||
bind b break-pane
|
bind b break-pane
|
||||||
unbind t
|
unbind t
|
||||||
bind t command-prompt -p "move pane to window:" "join-pane -t '%%'"
|
bind t command-prompt -p "move pane to window:" "join-pane -t '%%'"
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
# use interactive shell instead of login shell
|
# use interactive shell instead of login shell
|
||||||
set-option -g default-command "/bin/bash"
|
set-option -g default-command "/bin/bash"
|
||||||
|
|
||||||
|
# ..
|
||||||
|
set-option -s exit-unattached off
|
||||||
|
|
||||||
# enable rgb colors
|
# enable rgb colors
|
||||||
set-option -sa terminal-features ',xterm-256color:RGB'
|
set-option -sa terminal-features ',xterm-256color:RGB'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user