edit function set_editor for syntax-highlighting in nano
This commit is contained in:
@@ -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
|
||||
# ===============================
|
||||
|
||||
Reference in New Issue
Block a user