Auto-start tmux when on a remote connection
This commit is contained in:
parent
b11f399843
commit
b6c5f55079
@ -1,5 +1,8 @@
|
|||||||
## todo.sh
|
## todo.sh
|
||||||
alias taz='todo.sh add "(Z)"'
|
alias taz='todo.sh add "(Z)"'
|
||||||
|
tap() {
|
||||||
|
todo.sh add "($1) $2"
|
||||||
|
}
|
||||||
alias t='todo.sh'
|
alias t='todo.sh'
|
||||||
alias hw='t hw'
|
alias hw='t hw'
|
||||||
alias hwr="hw rel"
|
alias hwr="hw rel"
|
||||||
|
@ -14,4 +14,4 @@ mcd() { mkdir -p "$1" && cd "$1"; }
|
|||||||
alias irc='ssh ag tmux a -t irc'
|
alias irc='ssh ag tmux a -t irc'
|
||||||
|
|
||||||
#quick alias for enabling bluetooth
|
#quick alias for enabling bluetooth
|
||||||
alias ebluetooth="sudo modprobe btusb;blueman-manager"
|
alias ebluetooth="sudo modprobe btusb;ssy start bluetooth;blueman-manager"
|
||||||
|
34
.zshrc
34
.zshrc
@ -21,24 +21,6 @@ source $HOME/.aliases/general
|
|||||||
# Various Options
|
# Various Options
|
||||||
CORRECT_IGNORE="_*"
|
CORRECT_IGNORE="_*"
|
||||||
stty -ixon #disable XON/XOFF, which breaks C-s
|
stty -ixon #disable XON/XOFF, which breaks C-s
|
||||||
|
|
||||||
# Keybindings
|
|
||||||
my-backward-kill-word () {
|
|
||||||
local WORDCHARS=${WORDCHARS/\//}
|
|
||||||
zle backward-kill-word
|
|
||||||
}
|
|
||||||
zle -N my-backward-kill-word
|
|
||||||
bindkey '^H' my-backward-kill-word
|
|
||||||
|
|
||||||
# Inserts 'sudo ' at the beginning of the line.
|
|
||||||
function prepend-sudo() {
|
|
||||||
if [[ "$BUFFER" != su(do|)\ * ]]; then
|
|
||||||
BUFFER="sudo $BUFFER"
|
|
||||||
(( CURSOR += 5 ))
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
zle -N prepend-sudo
|
|
||||||
bindkey "^X^S" prepend-sudo
|
|
||||||
setopt no_share_history
|
setopt no_share_history
|
||||||
|
|
||||||
#load fasd if it exists
|
#load fasd if it exists
|
||||||
@ -48,3 +30,19 @@ hash fasd 2>/dev/null && eval "$(fasd --init auto)"
|
|||||||
unalias run-help
|
unalias run-help
|
||||||
autoload run-help
|
autoload run-help
|
||||||
|
|
||||||
|
# Auto start tmux if a remote connection
|
||||||
|
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && [[ -n "$SSH_TTY" ]]
|
||||||
|
then
|
||||||
|
tmux_session='zim'
|
||||||
|
tmux start-server
|
||||||
|
# Create a 'prezto' session if no session has been defined in tmux.conf.
|
||||||
|
if ! tmux has-session 2> /dev/null; then
|
||||||
|
tmux \
|
||||||
|
new-session -d -s "$tmux_session" \; \
|
||||||
|
set-option -t "$tmux_session" destroy-unattached off &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attach only to the prezto session
|
||||||
|
exec tmux new-session -A -s $tmux_session
|
||||||
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user