dotfiles/setup.sh
Thomas Preisner 07be5a4e7a separate vim config from nvim config again and simplify it
Separating vim's config from neovim's config simplifies the deployment
of lua for neovim's configuration. At the same time, clean up current
neovim config by removing all outdated options and options with equal or
even better defaults. Furthermore, the 'old' vim configuration should be
kept as-is to ensure compability with older systems if needed.
2022-10-14 23:30:30 +02:00

151 lines
2.5 KiB
Bash
Executable file

#!/bin/sh
# set for dryrun
#dryrun=
installed()
{
type "$1" >/dev/null 2>&1
}
link()
{
local src="$(pwd)/$1"
local dst="$2"
if test -e "$dst"; then
if ! test -L "$dst"; then
echo "File $dst exists and is no symlink."
echo "Ignore and continue? (y/N)"
read answer
case $answer in
[Yy]*)
return
;;
*)
exit 1
;;
esac
else
# symlink already exists and will be removed
rm "$dst"
fi
fi
if installed printf; then
printf "%-48s -> %s\n" "$dst" "$src"
else
echo "Linking $dst -> $src"
fi
[ -z "${dryrun+x}" ] && ln -sf "$src" "$dst"
}
# generic config
link pam_environment ~/.pam_environment
# application-specific config
if installed vim; then
echo "Setting up vim:"
link vimrc ~/.vimrc
link vim ~/.vim
echo
fi
if installed nvim; then
echo "Setting up nvim:"
mkdir -p ~/.config
link config/nvim ~/.config/nvim
echo
fi
if installed zsh; then
echo "Setting up zsh:"
link zshrc ~/.zshrc
link zsh ~/.zsh
echo
fi
if installed tmux; then
echo "Setting up tmux:"
link tmux.conf ~/.tmux.conf
echo
fi
if installed git; then
echo "Setting up git:"
link gitconfig ~/.gitconfig
echo
fi
if installed ssh; then
echo "Setting up ssh:"
mkdir -p ~/.ssh
link ssh/config ~/.ssh/config
link ssh/conf.d ~/.ssh/conf.d
echo
fi
if installed gpg || installed gpg2; then
echo "Setting up gpg:"
mkdir -p ~/.gnupg
link gnupg/gpg-agent.conf ~/.gnupg/gpg-agent.conf
link gnupg/gpg.conf ~/.gnupg/gpg.conf
echo
fi
if installed X; then
echo "Setting up X:"
link xinitrc ~/.xinitrc
link xsession ~/.xsession
link Xresources ~/.Xresources
echo
fi
if installed herbstluftwm; then
echo "Setting up herbstluftwm:"
mkdir -p ~/.config/herbstluftwm
link config/herbstluftwm/autostart ~/.config/herbstluftwm/autostart
link config/herbstluftwm/panel.sh ~/.config/herbstluftwm/panel.sh
link config/herbstluftwm/q3terminal.sh ~/.config/herbstluftwm/q3terminal.sh
link config/herbstluftwm/icons ~/.config/herbstluftwm/icons
link config/herbstluftwm/icons_large ~/.config/herbstluftwm/icons_large
# barpyrus
mkdir -p ~/.config/barpyrus
link config/barpyrus/config.py ~/.config/barpyrus/config.py
echo
fi
if installed i3; then
echo "Setting up i3:"
mkdir -p ~/.config/i3
link config/i3/config ~/.config/i3/config
mkdir -p ~/.config/i3status
link config/i3status/config ~/.config/i3status/config
fi
if installed redshift; then
echo "Setting up redshift:"
link config/redshift.conf ~/.config/redshift.conf
fi