mirror of
https://github.com/scopatz/nanorc
synced 2024-11-27 12:25:53 +01:00
Add -l|--lite option to install which includes new syntax files with lower precedence
This commit is contained in:
parent
19cbb486b1
commit
e5a675d762
|
@ -8,7 +8,7 @@ These should be placed inside of the ``~/.nano/`` directory.
|
||||||
Alternatively::
|
Alternatively::
|
||||||
|
|
||||||
git clone git@github.com:scopatz/nanorc.git ~/.nano
|
git clone git@github.com:scopatz/nanorc.git ~/.nano
|
||||||
|
|
||||||
*Note - if you have any issues, alternatively use::
|
*Note - if you have any issues, alternatively use::
|
||||||
|
|
||||||
git clone https://github.com/scopatz/nanorc.git ~/.nano
|
git clone https://github.com/scopatz/nanorc.git ~/.nano
|
||||||
|
@ -24,7 +24,7 @@ You can also append the contents of ``~/.nano/nanorc`` into your
|
||||||
``~/.nanorc`` to include all languages::
|
``~/.nanorc`` to include all languages::
|
||||||
|
|
||||||
cat ~/.nano/nanorc >> ~/.nanorc
|
cat ~/.nano/nanorc >> ~/.nanorc
|
||||||
|
|
||||||
Finally, you can run an automatic installer using the following code::
|
Finally, you can run an automatic installer using the following code::
|
||||||
|
|
||||||
$ curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
|
$ curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
|
||||||
|
@ -32,3 +32,8 @@ Finally, you can run an automatic installer using the following code::
|
||||||
or alternatively::
|
or alternatively::
|
||||||
|
|
||||||
$ wget https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh -O- | sh
|
$ wget https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh -O- | sh
|
||||||
|
|
||||||
|
*Note -
|
||||||
|
some syntax definitions which exist in Nano upstream may be preferable to the ones provided by this package.
|
||||||
|
The install.sh script may be run with ``-l`` or ``--lite`` to insert the included syntax definitions from this package
|
||||||
|
with lower precedence than the ones provided by the standard package.
|
||||||
|
|
63
install.sh
63
install.sh
|
@ -1,27 +1,52 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
function _fetch_sources() {
|
||||||
if [ ! -d ~/.nano/ ]
|
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
|
||||||
then
|
if [ ! -d ~/.nano/ ]
|
||||||
|
then
|
||||||
mkdir ~/.nano/
|
mkdir ~/.nano/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ~/.nano/
|
cd ~/.nano/
|
||||||
|
|
||||||
unzip -o "/tmp/nanorc.zip"
|
unzip -o "/tmp/nanorc.zip"
|
||||||
mv nanorc-master/* ./
|
mv nanorc-master/* ./
|
||||||
rm -rf nanorc-master
|
rm -rf nanorc-master
|
||||||
rm /tmp/nanorc.zip
|
rm /tmp/nanorc.zip
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -f ~/.nanorc ]
|
function _update_nanorc() {
|
||||||
then
|
if [ ! -f ~/.nanorc ]
|
||||||
touch ~/.nanorc
|
then
|
||||||
fi
|
touch ~/.nanorc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add all includes from ~/.nano/nanorc if they're not already there
|
||||||
|
while read inc; do
|
||||||
|
if ! grep -q "$inc" "${NANORC_FILE}"; then
|
||||||
|
echo "$inc" >> $NANORC_FILE
|
||||||
|
fi
|
||||||
|
done < ~/.nano/nanorc
|
||||||
|
}
|
||||||
|
|
||||||
|
function _update_nanorc_lite() {
|
||||||
|
sed -i '/include "\/usr\/share\/nano\/\*\.nanorc"/i include "~\/.nano\/*.nanorc"' "${NANORC_FILE}"
|
||||||
|
}
|
||||||
|
|
||||||
# add all includes from ~/.nano/nanorc if they're not already there
|
|
||||||
NANORC_FILE=~/.nanorc
|
NANORC_FILE=~/.nanorc
|
||||||
while read inc; do
|
|
||||||
if ! grep -q "$inc" "${NANORC_FILE}"; then
|
case "$1" in
|
||||||
echo "$inc" >> $NANORC_FILE
|
-l|--lite)
|
||||||
fi
|
UPDATE_LITE=1;;
|
||||||
done < ~/.nano/nanorc
|
-h|--help)
|
||||||
|
echo "Install script for nanorc syntax highlights"
|
||||||
|
echo "Call with -l or --lite to update .nanorc with secondary precedence to existing .nanorc includes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_fetch_sources;
|
||||||
|
if [[ $UPDATE_LITE ]]; then
|
||||||
|
_update_nanorc_lite;
|
||||||
|
else
|
||||||
|
_update_nanorc;
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user