[zsh] Update shell init: profile

This commit is contained in:
Eryn Wells 2021-12-31 12:00:16 -08:00
parent c30b46a88b
commit 2d896e1555
3 changed files with 25 additions and 31 deletions

10
profile
View file

@ -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

View file

@ -1,27 +1,15 @@
# .zprofile
# vim:ft=zsh
#
# Login shell setup
#
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
print_heading -l 1 'Initializing login shell'
shell-log 'Initializing Login Environment'
[ -e $HOME/.profile ] && source $HOME/.profile
list_tmux_sessions()
{
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
}
# 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
autoload list_tmux_sessions
list_tmux_sessions
[ -e $HOME/.profile.$SYS ] && source $HOME/.profile.$SYS
[ -e $HOME/.profile.local ] && source $HOME/.profile.local

View 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 "$@"