init
This commit is contained in:
40
.zprezto/modules/screen/README.md
Normal file
40
.zprezto/modules/screen/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
GNU Screen
|
||||
==========
|
||||
|
||||
Defines [GNU Screen][1] aliases and provides for auto launching it at start-up.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Auto-Start
|
||||
|
||||
Starts a GNU Screen session automatically when Zsh is launched.
|
||||
|
||||
To enable this feature when launching Zsh in a local terminal, add the
|
||||
following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:screen:auto-start' local 'yes'
|
||||
|
||||
To enable this feature when launching Zsh in a SSH connection, add the
|
||||
following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:screen:auto-start' remote 'yes'
|
||||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
- `scr` is short for `screen`.
|
||||
- `scrl` lists sessions/socket directory.
|
||||
- `scrn` starts a new session.
|
||||
- `scrr` attaches to a session if one exists or start a new one.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][2].*
|
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
- [Georges Discry](https://github.com/gdiscry)
|
||||
|
||||
[1]: http://www.gnu.org/software/screen/
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
42
.zprezto/modules/screen/init.zsh
Normal file
42
.zprezto/modules/screen/init.zsh
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Defines GNU Screen aliases and provides for auto launching it at start-up.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
# Georges Discry <georges@discry.be>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
if (( ! $+commands[screen] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Auto Start
|
||||
#
|
||||
|
||||
if [[ -z "$STY" && -z "$EMACS" && -z "$VIM" ]] && ( \
|
||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' remote ) ||
|
||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:screen:auto-start' local ) \
|
||||
); then
|
||||
session="$(
|
||||
screen -list 2> /dev/null \
|
||||
| sed '1d;$d' \
|
||||
| awk '{print $1}' \
|
||||
| head -1)"
|
||||
|
||||
if [[ -n "$session" ]]; then
|
||||
exec screen -x "$session"
|
||||
else
|
||||
exec screen -a -A -U -D -R -m "$SHELL" -l
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Aliases
|
||||
#
|
||||
|
||||
alias scr='screen'
|
||||
alias scrl='screen -list'
|
||||
alias scrn='screen -U -S'
|
||||
alias scrr='screen -a -A -U -D -R'
|
Reference in New Issue
Block a user