common/setup-home.sh

49 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
relative() {
grealpath --relative-to=$1 $2
}
else
relative() {
realpath --relative-to=$1 $2
}
fi
# Calculate directory relative to $HOME
DIR=$HOME
BASE=$(relative $DIR $PWD)
pushd $HOME >> /dev/null
ln -vs $BASE/home/rustfmt.toml .rustfmt.toml
ln -vs $BASE/home/bashrc .bashrc
ln -vs $BASE/home/clang-format .clang-format
ln -vs $BASE/home/latexmkrc .latexmkrc
ln -vs $BASE/home/vimrc .vimrc
popd >> /dev/null
# Vim
DIR=$HOME/.vim/after/ftplugin
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
ln -vs $BASE/home/vim/after/ftplugin/tex.vim .
popd >> /dev/null
DIR=$HOME/.vim/colors
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
ln -vs $BASE/home/vim/vim-amino/amino.vim .
popd >> /dev/null
# Fish
DIR=$HOME/.config/fish
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
ln -vs $BASE/home/fish/config.fish .
ln -vs $BASE/home/fish/fishd_color .
ln -vs $BASE/home/fish/functions .
popd >> /dev/null