dotfiles/prepare.sh

66 lines
2.5 KiB
Bash

#!/bin/sh
# copying all the needed stuff in place.
DOTFILES=${HOME}/.dotfiles
# copying zshrc file
if [[ ! -f "$HOME/.zshrc" ]]; then
# no first setup done
# Determining operating system so we can quickly setup basic configuration
if uname -a | grep -qi 'debian'; then
# Debian
sudo apt install -y zsh-autosuggestions zsh-syntax-highlighting
ln -sf ${DOTFILES}/zsh/distro/debian.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'ubuntu'; then
# TODO: complete instructions for Ubuntu
ln -sf ${DOTFILES}/zsh/distro/ubuntu.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'manjaro'; then
# TODO: complete instructions for Manjaro
pamac install manjaro-zsh-config
ln -sf ${DOTFILES}/zsh/distro/manjaro.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'archlinux'; then
pacman -S zsh-autosuggestions zsh-syntax-highlighting
ln -sf ${DOTFILES}/zsh/distro/archlinux.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if [[ -f /etc/redhat-release ]] && grep -qi centos /etc/redhat-release; then
# TODO: installation on centos.
ln -sf ${DOTFILES}/zsh/distro/centos.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
# Installing better ssh completion with fzf and ssh_config Include with:
# https://github.com/sunlei/zsh-ssh
mkdir -p ${DOTFILES}/zsh/external
git clone https://github.com/sunlei/zsh-ssh.git ${DOTFILES}/zsh/external/zsh-ssh
ln -sf ${DOTFILES}/zsh/external/zsh-ssh/zsh-ssh.zsh ${DOTFILES}/zsh/plugins/zsh-ssh.plugin.zsh
# Using Antigen for plugins
# https://github.com/zsh-users/antigen
git clone https://github.com/zsh-users/antigen.git ${DOTFILES}/zsh/external/antigen
ln -sf ${DOTFILES}/zsh/external/antigen/antigen.zsh ${DOTFILES}/zsh/plugins/antigen.plugin.zsh
cp "${DOTFILES}/zshrc" "$HOME/.zshrc"
fi
# Copying tmux configuration file and initialize plugins.
if [[ ! -f "$HOME/.tmux.conf" ]]; then
mkdir -p ${HOME}/.config/tmux/plugins
git clone https://github.com/tmux-plugins/tpm ${HOME}/.config/tmux/plugins/tpm
ln -sf "${DOTFILES}/tmux.conf" "$HOME/.config/tmux/tmux.conf"
echo "Please, open Tmux and run 'prefix I'."
fi
# Vim - configure vundle and install plugins.
if [[ ! -f "${HOME}/.vimrc" ]]; then
ln -sf ${DOTFILES}/vimrc ${HOME}/.vimrc
ln -sf ${DOTFILES}/vim ${HOME}/.vim
# Installing vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Installing vim-plug and relative plugins
vim +PlugInstall +qall
fi