Add .dotfiles/bin directory and tat command
This commit is contained in:
22
bin/tat
Executable file
22
bin/tat
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Attach or create tmux session named the same as current directory.
|
||||
|
||||
session_name="$(basename "$PWD" | tr . -)"
|
||||
|
||||
session_exists() {
|
||||
tmux list-sessions | sed -E 's/:.*$//' | grep -q "^$session_name$"
|
||||
}
|
||||
|
||||
not_in_tmux() {
|
||||
[ -z "$TMUX" ]
|
||||
}
|
||||
|
||||
if not_in_tmux; then
|
||||
tmux new-session -As "$session_name"
|
||||
else
|
||||
if ! session_exists; then
|
||||
(TMUX='' tmux new-session -Ad -s "$session_name")
|
||||
fi
|
||||
tmux switch-client -t "$session_name"
|
||||
fi
|
||||
@@ -7,6 +7,7 @@ set -g -x EDITOR "emacsclient"
|
||||
set -g -x ALTERNATE_EDITOR "vim"
|
||||
|
||||
# Setup PATH
|
||||
ensure_path ~/.dotfiles/bin
|
||||
ensure_path ~/bin
|
||||
ensure_path ~/.emacs.d/bin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user