edit function set_editor for syntax-highlighting in nano

This commit is contained in:
2025-09-26 13:28:31 +02:00
parent c45aaa5bce
commit 5fa9a2c53f

View File

@@ -155,7 +155,25 @@ set_editor() {
whiptail --msgbox "Installation von ${editor_pkg[$choice]}..." 8 50
sudo apt update
sudo apt install -y "${editor_pkg[$choice]}"
if command -v "$choice" >/dev/null 2>&1; then
# Speziell für nano: Syntax-Highlighting installieren
if [[ "$choice" == "nano" ]]; then
NANO_DIR="$HOME/.nano"
NANORC="$HOME/.nanorc"
if [[ -d "$NANO_DIR/.git" ]]; then
git -C "$NANO_DIR" pull --quiet
else
git clone https://github.com/scopatz/nanorc.git "$NANO_DIR"
fi
if ! grep -q "include $NANO_DIR" "$NANORC" 2>/dev/null; then
{
echo "## nano syntax highlighting"
echo "include $NANO_DIR/*.nanorc"
} >> "$NANORC"
fi
fi
whiptail --msgbox "$choice erfolgreich installiert." 8 50
jq --arg ed "$choice" '.editor = $ed' "$GLOBAL_CONFIG" >"$GLOBAL_CONFIG.tmp" && mv "$GLOBAL_CONFIG.tmp" "$GLOBAL_CONFIG"
return
@@ -167,6 +185,7 @@ set_editor() {
done
}
# ===============================
# Projektverwaltung
# ===============================