feat(zsh): add Atuin integration and new gitconfig script

This commit is contained in:
2025-06-23 09:22:15 +02:00
parent f5624a02e8
commit 61a177e8b5
7 changed files with 40 additions and 4 deletions

31
scripts/gitconfig Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
CONFIG_DIR="$DOTFILES_INSTALL_DIR/.gitconfig.d"
echo
echo "[+] Generating Gitconfig"
echo
rm -f "$HOME/.gitconfig"
for config in "$CONFIG_DIR"/*.gitconfig; do
[ -e "$config" ] || continue
filename=$(basename "$config")
domain="${filename%.gitconfig}"
# Skip example.gitconfig
if [[ "$filename" == "example.gitconfig" ]]; then
echo "Skipping $filename"
continue
fi
echo "Create config for $domain"
cat <<EOF >> "$HOME/.gitconfig"
[includeIf "hasconfig:remote.*.url:https://**$domain/**"]
path = $config
EOF
done

47
scripts/install Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e
git config core.autocrlf false
APT_CMD="apt"
if [ "$(id -u)" -ne 0 ]; then
APT_CMD="sudo apt"
fi
echo
echo "[+] Updating System Packages..."
echo
$APT_CMD update -qq
echo
echo "[+] Installing Dependencies..."
echo
$APT_CMD install -yqq \
zsh \
curl \
exa \
direnv \
bat \
btop \
stow \
tmux \
dos2unix
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo
echo "[+] Installing Oh My Zsh..."
echo
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
if [ -f "$HOME/.zshrc" ] && [ ! -L "$HOME/.zshrc" ]; then
rm "$HOME/.zshrc"
fi
mkdir -p "$HOME/.ssh"
echo "Include $HOME/.config/ssh/*" >> "$HOME/.ssh/config"
cp post-merge .git/hooks/
./setup

3
scripts/post-merge Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./setup

28
scripts/setup Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
echo "[+] Cloning submodules..."
git submodule update --init --recursive
find . -type d -name '.git*' -prune -o -type f -print0 | xargs -0 dos2unix > /dev/null 2>&1
echo "[+] Creating Gitconfigs..."
(
for config in $PWD/.gitconfig.d/*.gitconfig; do
echo "[include]"
echo " path = $config"
done;
) > "$HOME/.gitconfig"
echo "[+] Creating symlinks..."
if [ ! -f "$PWD/.zshenv" ]; then
cp "$PWD/.zshenv.template" "$PWD/.zshenv"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
sed -i "s|^export DOTFILES_INSTALL_DIR=.*|export DOTFILES_INSTALL_DIR=${SCRIPT_DIR}|" .zshenv
fi
stow .