diff options
| author | bh <qn+git@epicurus.dev> | 2026-03-23 21:25:25 +0800 |
|---|---|---|
| committer | bh <qn+git@epicurus.dev> | 2026-03-23 21:25:25 +0800 |
| commit | 5d6c031afabf5f43ed7d5ae03bad8abbc8c7c6c6 (patch) | |
| tree | 07960c78a55b8862b291d03561bb41b5ddc04ee8 /.install/editor | |
| parent | aab30b6d22cfc035ada1d085715de84992cd8142 (diff) | |
Automatically install nvim and emacs config via installer
Diffstat (limited to '.install/editor')
| -rwxr-xr-x | .install/editor | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/.install/editor b/.install/editor new file mode 100755 index 0000000..bd9a8ab --- /dev/null +++ b/.install/editor @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +NVIM_DIR="${HOME}/.config/nvim" +EMACS_DIR="${HOME}/.config/emacs" + +clone_repo() { + local repo_url="$1" + local target_dir="$2" + + mkdir -p "$(dirname "$target_dir")" + + if [[ -d "$target_dir" ]]; then + if [[ -d "$target_dir/.git" ]]; then + echo "Skipping $target_dir (already a git repo)." + return 0 + fi + + if [[ -n "$(ls -A "$target_dir")" ]]; then + echo "Refusing to clone into non-empty directory: $target_dir" >&2 + return 1 + fi + fi + + echo "Cloning $repo_url into $target_dir" + git clone "$repo_url" "$target_dir" +} + +clone_repo "https://github.com/QuixoticNapoleon/QuixoticNeovim" "$NVIM_DIR" +clone_repo "https://github.com/QuixoticNapoleon/NapoleonMacs" "$EMACS_DIR" + +echo "Editor configs installed." |
