51 lines
1.6 KiB
Bash
51 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# This script sets up the configuration from this repository
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
APT=`command -v apt`
|
|
DNF=`command -v dnf`
|
|
|
|
function check_or_install {
|
|
CMD=`command -v $1`
|
|
PKG=$2
|
|
if [[ -z "$CMD" ]]; then
|
|
if [[ -n "$APT" ]]; then
|
|
sudo apt install -y $PKG
|
|
elif [[ -n "$DNF" ]]; then
|
|
sudo dnf install -y $PKG
|
|
fi
|
|
fi
|
|
|
|
}
|
|
|
|
# Set up Neovim
|
|
check_or_install nvim "neovim python3-neovim"
|
|
mkdir -p ~/.config
|
|
cd ~/.config
|
|
ln -s $DIR/nvim
|
|
curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
# Set up Git
|
|
check_or_install git git
|
|
git config --global alias.co checkout
|
|
git config --global alias.ci "commit -a"
|
|
git config --global alias.st status
|
|
git config --global alias.br "checkout -b"
|
|
git config --global alias.rv "reset --hard HEAD"
|
|
git config --global alias.pum "pull upstream master"
|
|
git config --global alias.pom "push origin master"
|
|
git config --global alias.rbm "rebase master"
|
|
git config --global alias.last "log -1 HEAD"
|
|
git config --global alias.unstage "reset HEAD --"
|
|
git config --global alias.uncommit "reset --soft HEAD^"
|
|
git config --global alias.changelog "!_() { t=$(git describe --abbrev=0 --tags); git log ${t}..HEAD --no-merges --pretty=format:'* %s'; }; _"
|
|
git config --global pull.rebase false
|
|
|
|
# Set up ZSH
|
|
check_or_install zsh zsh
|
|
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
|
|
cd ~/.oh-my-zsh/custom
|
|
ln -s $DIR/zsh/themes
|
|
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="raoul"/' ~/.zshrc
|