Tue, 30 May 2017 16:51:55 -0400
use ltag over lselect
448 | 1 | #!/bin/sh |
2 | set -eu | |
3 | ||
4 | case ${1:-} in *help|-h) | |
5 | exec perldoc -T $0;; | |
6 | esac | |
7 | ||
8 | name=${1:-$(basename `pwd`)} | |
9 | ||
473
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
10 | if ! tmux has-session -t "$name" 2>/dev/null; then |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
11 | tmux new -d -s "$name" |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
12 | fi |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
13 | |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
14 | if [ -n "${TMUX:-}" ]; then |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
15 | exec tmux switch-client -t "$name" |
448 | 16 | else |
473
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
17 | exec tmux attach -t "$name" |
448 | 18 | fi |
19 | ||
20 | :<<=cut | |
21 | =head1 NAME | |
22 | ||
473
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
23 | tmuxs - tmux session |
448 | 24 | |
25 | =head1 SYNOPSIS | |
26 | ||
27 | tmuxs foobaz | |
28 | ||
29 | cd ~/proj/quux | |
30 | tmuxs | |
473
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
31 | # aka: tmuxs quux |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
32 | |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
33 | =head1 DESCRIPTION |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
34 | |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
35 | tmuxs attaches or switches to a session of the given name, or the cwd's name, |
049e9d356e16
Fix for new session while in tmux
Meredith Howard <mhoward@roomag.org>
parents:
448
diff
changeset
|
36 | creating it if necessary. |
448 | 37 | |
38 | =cut |