all repos — dotfiles-base @ 4143f443190bce542a389f280c2dd6d5b328560c

base important configs that can safely be used almost anywhere

place-dotfiles-base.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
#!/bin/sh
# place-dotfiles-base.sh: simple script to symlink my core dotfiles
# by x1phosura

dotfiles_root="$HOME"/73h4x/dotfiles/dotfiles-base  # where dotfiles live
#dotfiles_root="$PWD"                               # alternative (for testing)
dest="$HOME"                                        # usually $HOME

die() {
    echo "$@"; exit 1
}


[ ! -d "$dotfiles_root" ] && \
    die "ERROR: $dotfiles_root doesn't exist. Aborting..."

# TODO: change '[[' to '[', test...
#[[ "$(realpath $dotfiles_root)" = "$(realpath $dest)" ]] && \
#    die " ERROR: dotfiles_root and dest are the same directory! Aborting..."

# TODO: maybe, maybe not place .bash_prompt
dotfiles_base_list=".bash_profile \
.bashrc \
.gdbinit \
.lynxrc \
.tmux.conf \
.config/fish \
.config/nvim \
.config/helix"

# Note: directly symlink items to .config instead of symlinking .config itself
# because I don't want to preserve everything that programs create there
mkdir -p "$dest"/.config

# link dotfiles in home directory
for file in $dotfiles_base_list ; do
    # TODO: only link after checking file's existence in dotfiles_root
    ln -svfn "$dotfiles_root"/"$file" "$dest"/"$file"
done

# handle neovim-to-vimrc symlink
ln -svfn "$dotfiles_root"/.config/nvim/vimrc.vim "$dest"/.vimrc