[zsh] Update shell init: profile
This commit is contained in:
parent
c30b46a88b
commit
2d896e1555
3 changed files with 25 additions and 31 deletions
10
profile
10
profile
|
@ -1,10 +0,0 @@
|
||||||
# .profile
|
|
||||||
# vim: ft=zsh
|
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
|
||||||
|
|
||||||
# Start SSH agent for password-less logins
|
|
||||||
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
|
|
||||||
print_info -l 1 'Starting ssh-agent'
|
|
||||||
eval `ssh-agent -s`
|
|
||||||
trap "kill $SSH_AGENT_PID" 0
|
|
||||||
fi
|
|
30
zprofile
30
zprofile
|
@ -1,27 +1,15 @@
|
||||||
# .zprofile
|
#!/usr/bin/env zsh
|
||||||
# vim:ft=zsh
|
|
||||||
#
|
|
||||||
# Login shell setup
|
|
||||||
#
|
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
print_heading -l 1 'Initializing login shell'
|
shell-log 'Initializing Login Environment'
|
||||||
|
|
||||||
[ -e $HOME/.profile ] && source $HOME/.profile
|
# Start SSH agent for password-less logins
|
||||||
|
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
|
||||||
list_tmux_sessions()
|
print_info -l 1 'Starting ssh-agent'
|
||||||
{
|
eval `ssh-agent -s`
|
||||||
tmux_out=`tmux list-sessions 2>/dev/null`
|
trap "kill $SSH_AGENT_PID" 0
|
||||||
[[ -z "$tmux_out" || -n "$TMUX" ]] && return
|
fi
|
||||||
|
|
||||||
echo "You have the following active tmux sessions:"
|
|
||||||
for session in ${(f)tmux_out}; do
|
|
||||||
echo " $session"
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
|
autoload list_tmux_sessions
|
||||||
list_tmux_sessions
|
list_tmux_sessions
|
||||||
|
|
||||||
[ -e $HOME/.profile.$SYS ] && source $HOME/.profile.$SYS
|
|
||||||
[ -e $HOME/.profile.local ] && source $HOME/.profile.local
|
|
||||||
|
|
16
zsh/func/list_tmux_sessions
Normal file
16
zsh/func/list_tmux_sessions
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
function list_tmux_session
|
||||||
|
{
|
||||||
|
local tmux_out=`tmux list-sessions 2>/dev/null`
|
||||||
|
[[ -z "$tmux_out" || -n "$TMUX" ]] && return
|
||||||
|
|
||||||
|
echo "You have the following active tmux sessions:"
|
||||||
|
for session in ${(f)tmux_out}; do
|
||||||
|
echo " $session"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
list_tmux_session "$@"
|
Loading…
Add table
Add a link
Reference in a new issue