mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-09-21 02:17:11 +00:00
removed checks and updated read me
- checks have been removed to in favor of conditional plugin loading - .gitignore has been updated to ignore .tmp files - main README has been updated to reflect conditional plugin loading - tmux-autoattach plugin README has been updated to reflect conditional plugin loading options
This commit is contained in:
parent
fd7fadb2fb
commit
e327e66c02
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,3 +16,4 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.disabled
|
*.disabled
|
||||||
.idea/
|
.idea/
|
||||||
|
*.tmp
|
||||||
|
10
README.md
10
README.md
@ -50,6 +50,16 @@ For example, this line might begin to look like this:
|
|||||||
plugins=(git bundler osx rake ruby)
|
plugins=(git bundler osx rake ruby)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### With Conditionals
|
||||||
|
|
||||||
|
You may want to control when and/or how plugins should be enabled.
|
||||||
|
|
||||||
|
For example, if you want the `tmux-autoattach` plugin to only run on SSH sessions, you could employ a trivial conditional that checks for the `$SSH_TTY` variable. Just make sure to remove the plugin from the larger plugin list.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
[ "$SSH_TTY" ] && plugins+=(tmux-autoattach)
|
||||||
|
```
|
||||||
|
|
||||||
#### Using Plugins
|
#### Using Plugins
|
||||||
|
|
||||||
Most plugins (should! we're working on this) include a __README__, which documents how to use them.
|
Most plugins (should! we're working on this) include a __README__, which documents how to use them.
|
||||||
|
@ -6,7 +6,35 @@ This tmux plugin will automatically attach a tmux session to your shell session.
|
|||||||
|
|
||||||
#### OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR
|
#### OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR
|
||||||
|
|
||||||
| Setting | Description |
|
| Setting | Description |
|
||||||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `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` (default) | This will allow you to detach from the tmux screen without closing the terminal or shell session. |
|
||||||
| `detach` (default) | This will allow you to detach from the tmux screen without closing the terminal or shell session. |
|
| `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. |
|
||||||
|
|
||||||
|
## Common Enable Conditions
|
||||||
|
|
||||||
|
*Note* If you prefer to manually start your desktop session using tools like `startx`, you may run into problems starting your desktop session inside of a tmux terminal. You can employ conditionals to control when this plugin should be enabled.
|
||||||
|
|
||||||
|
**SSH**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[ "$SSH_TTY" ] && plugins+=(tmux-autoattach)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Wayland**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[ "$DISPLAY_WAYLAND" ] && plugins+=(tmux-autoattach)
|
||||||
|
```
|
||||||
|
|
||||||
|
**X11**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[ "$DISPLAY" ] && plugins+=(tmux-autoattach)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Multiple**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
{ [ "$DISPLAY" ] || [ "$SSH" ]; } && plugins+=(tmux-autoattach)
|
||||||
|
```
|
||||||
|
@ -14,13 +14,11 @@ _osh_plugin_tmux_autoattach_detach() {
|
|||||||
[ -z "$TMUX" ] && tmux -2u new -A
|
[ -z "$TMUX" ] && tmux -2u new -A
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$DISPLAY" ] || [ "$WAYLAND_DISPLAY" ] || [ "$SSH_TTY" ]; then
|
case "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" in
|
||||||
case "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" in
|
"exit")
|
||||||
"exit")
|
_osh_plugin_tmux_autoattach_exit
|
||||||
_osh_plugin_tmux_autoattach_exit
|
;;
|
||||||
;;
|
"detach" | *)
|
||||||
"detach" | *)
|
_osh_plugin_tmux_autoattach_detach
|
||||||
_osh_plugin_tmux_autoattach_detach
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user