Browse Source

Automatically opens tmux on login

main
Zen 3 years ago
parent
commit
32cd776021
  1. 22
      init.sh
  2. 10
      resources/zshrc-extras

22
init.sh

@ -20,20 +20,22 @@ fi
echo "" echo ""
install_if_needed() { install_if_needed() {
if [ "$DISTRO" = "debian" ]; then
for package in "$@" for package in "$@"
do do
if [ -z $(which $package) ]; then if [ -z $(which $package) ]; then
echo "installing" $package echo "installing" $package
if [ "$DISTRO" = "debian" ]; then
sudo apt install -y $package sudo apt install -y $package
else else
echo $package 'already installed!' echo "Only working on Debian right now!"
fi fi
done
else else
echo "Only working on Debian right now!" echo $package 'already installed!'
fi fi
done
} }
echo "Making sure we've got the basics..." echo "Making sure we've got the basics..."
@ -48,13 +50,19 @@ echo ""
echo "Copying configuration files" echo "Copying configuration files"
mkdir -p $HOME/.vim/colors mkdir -p $HOME/.vim/colors
cp resources/solarized.vim $HOME/.vim/colors/ cp resources/solarized.vim $HOME/.vim/colors/
cp resouces/vimrc $HOME/.vimrc cp resources/vimrc $HOME/.vimrc
cp resouces/tmux.conf $HOME/.tmux.conf cp resources/tmux.conf $HOME/.tmux.conf
cp resouces/tmux-powerline-theme.sh $HOME/.tmux/tmux-powerline/themes/default.sh cp resources/tmux-powerline-theme.sh $HOME/.tmux/tmux-powerline/themes/default.sh
echo "" echo ""
echo "Installing Oh My Zsh for theming - this could take a moment" echo "Installing Oh My Zsh for theming - this could take a moment"
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
cat resources/zshrc-extras >> $HOME/.zshrc
echo ""
echo "Adding p10k for optimal dev experience" echo "Adding p10k for optimal dev experience"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's/^ZSH_THEME.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' $HOME/.zshrc sed -i 's/^ZSH_THEME.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' $HOME/.zshrc
echo ""
echo "...and we're back! Now that you've installed everything you need, try closing your connection to the terminal and re-opening."

10
resources/zshrc-extras

@ -0,0 +1,10 @@
# Extra Aliases
alias b='cd ..'
# Checks for active tmux
tmux ls &> /dev/null
if [ $? -eq 0 ] && [ -z "$TMUX" ]; then
echo "\nYou have an active tmux session! Run 'tmux attach' to restore it.\n"
elif [ -z "$TMUX" ]; then
tmux new -s "tmux"
fi
Loading…
Cancel
Save