1
0
mirror of https://github.com/scopatz/nanorc synced 2024-10-31 23:00:00 +01:00

modified install shell to install to xdg-config-dirs to comply with xdg standards

This commit is contained in:
andrew 2023-10-06 12:03:58 +08:00
parent 1aa64a86cf
commit 6b4617fcd1

View File

@ -6,11 +6,12 @@ if [ ! "$(command -v unzip)" ]; then
exit 1 exit 1
fi fi
_fetch_sources(){ _fetch_sources(){
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
mkdir -p ~/.nano/ mkdir -p ~/.config/nano/
cd ~/.nano/ || exit cd ~/.config/nano/ || exit
unzip -o "/tmp/nanorc.zip" unzip -o "/tmp/nanorc.zip"
mv nanorc-master/* ./ mv nanorc-master/* ./
rm -rf nanorc-master rm -rf nanorc-master
@ -18,21 +19,21 @@ _fetch_sources(){
} }
_update_nanorc(){ _update_nanorc(){
touch ~/.nanorc touch ~/.config/nano/nanorc
# add all includes from ~/.nano/nanorc if they're not already there # add all includes from ~/.config/nano/nanorc if they're not already there
while read -r inc; do while read -r inc; do
if ! grep -q "$inc" "${NANORC_FILE}"; then if ! grep -q "$inc" "${NANORC_FILE}"; then
echo "$inc" >> "$NANORC_FILE" echo "$inc" >> "$NANORC_FILE"
fi fi
done < ~/.nano/nanorc done < ~/.config/nano/nanorc
} }
_update_nanorc_lite(){ _update_nanorc_lite(){
sed -i '/include "\/usr\/share\/nano\/\*\.nanorc"/i include "~\/.nano\/*.nanorc"' "${NANORC_FILE}" sed -i '/include "\/usr\/share\/nano\/\*\.nanorc"/i include "~\/.conig.\/nano\/*.nanorc"' "${NANORC_FILE}"
} }
NANORC_FILE=~/.nanorc NANORC_FILE=~/.config\/nano\/nanorc
case "$1" in case "$1" in
-l|--lite) -l|--lite)