updated naming conventions and format based on comments

This commit is contained in:
Wes Key
2021-12-23 22:24:02 -05:00
committed by Koichi Murase
parent 4f4fd5df8c
commit dc01861a1a
4 changed files with 37 additions and 6 deletions

View File

@ -0,0 +1,8 @@
# tmux plugin
The tmux plugin will either attach or create a new tmux session for each bash session. If a session already exists, it will simply attach.
## OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR
| exit | This will completely close out your shell session, including your terminal, but keep your tmux sessions intact. This will also close your session if you detach. |
| detach | This will allow you to detach from the tmux screen without closing the terminal or shell session. |

View File

@ -0,0 +1,29 @@
# @chopnico 2021
#
# tmux-autoattach.plugin.sh
#
# A tmux plugin that will automatically attach itself to a bash session.
[ -z "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" ] && export OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR="detach"
_osh_plugin_tmux_autoattach_exit() {
[ -z "$TMUX" ] && tmux -2u new -A && exit
}
_osh_plugin_tmux_autoattach_detach() {
[ -z "$TMUX" ] && tmux -2u new -A
}
if [ "$DISPLAY" ] || [ "$WAYLAND_DISPLAY" ]; then
case "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" in
"exit")
_osh_plugin_tmux_autoattach_exit
;;
"detach")
_osh_plugin_tmux_autoattach_detach
;;
*)
_osh_plugin_tmux_autoattach_detach
;;
esac
fi

View File

@ -1,3 +0,0 @@
# tmux plugin
The tmux plugin will either attach or create a new tmux session for each bash session. If a session already exists, it will simply attach.

View File

@ -1,3 +0,0 @@
# @chopnico 2021
[ -z "$TMUX" ] && { tmux -2 -u attach || exec tmux -2 -u new-session && exit;}