From 469b554a54f31931cfe171f05a2d9ba05afe2868 Mon Sep 17 00:00:00 2001 From: Tiago Almeida Date: Sat, 23 Nov 2019 00:02:59 +0000 Subject: [PATCH] Many changes envolving the themes and configs --- install.sh | 68 +++++++++++++----- themes/nano/config | 6 ++ themes/nano/gui | 0 themes/nano/keys | 0 themes/nano/{highlight => rules} | 7 +- themes/scopatz/config | 7 ++ themes/scopatz/gui | 0 themes/scopatz/keys | 0 themes/scopatz/{highlight => rules} | 17 +++-- themes/tpro/config | 107 ++++++++++++++++++++++++++++ themes/tpro/gui | 0 themes/tpro/keys | 0 themes/tpro/{highlight => rules} | 6 +- todo.md | 3 +- 14 files changed, 193 insertions(+), 28 deletions(-) create mode 100644 themes/nano/config delete mode 100755 themes/nano/gui delete mode 100755 themes/nano/keys rename themes/nano/{highlight => rules} (92%) create mode 100644 themes/scopatz/config delete mode 100755 themes/scopatz/gui delete mode 100755 themes/scopatz/keys rename themes/scopatz/{highlight => rules} (75%) create mode 100644 themes/tpro/config delete mode 100755 themes/tpro/gui delete mode 100755 themes/tpro/keys rename themes/tpro/{highlight => rules} (85%) diff --git a/install.sh b/install.sh index 725cf4f..a91a9e9 100755 --- a/install.sh +++ b/install.sh @@ -28,9 +28,10 @@ G_IFS=" " # Global Variables G_VERSION="2019.10.17" G_DEPS="unzip sed" +G_FILE="~/.nanorc" G_REPO_MASTER="https://github.com/scopatz/nanorc/archive/master.zip" G_REPO_RELEASE="https://github.com/scopatz/nanorc/archive/${G_VERSION}.zip" -unset G_DIR G_LITE G_VERBOSE G_UNSTABLE G_FILE +unset G_LITE G_UNSTABLE G_VERBOSE G_DIR G_THEME # Exit Values Help # 0 - OK @@ -40,22 +41,26 @@ unset G_DIR G_LITE G_VERBOSE G_UNSTABLE G_FILE # Show the usage/help f_menu_usage(){ - echo "Usage: $0 [ -d | -h | -l | -t | -u | -v ] [ -f FILE ]" + echo "Usage: $0 [ -h|-l|-u|-v|-w ] [ -d DIR ] [ -t THEME ]" echo echo "IMPROVED NANO SYNTAX HIGHLIGHTING FILES" echo "Get nano editor better to use and see." echo - echo "-d Give other directory for installation." - echo " Default: ~/.nano/nanorc/" echo "-h Show help or usage." echo "-l Activate lite installation." echo " We will take account your existing .nanorc files." - echo "-t Turn the script more verbose, often to tests." - echo "-u Use the unstable branch." + echo "-u Use the unstable branch (master)." echo "-v Show version, license and other info." - echo "-f FILE" - echo " The path of other file instead of the default .nanorc file." - + echo "-w Turn the script more verbose, often to tests." + echo + echo "-d DIR" + echo " Give other directory for installation." + echo " Default: ~/.nano/nanorc/" + echo + echo "-t THEME" + echo " Give other theme for installation." + echo " Default: scopatz" + echo " Options: nano, tpro" exit 1 } @@ -149,11 +154,14 @@ _update_nanorc_lite(){ # Sources: https://www.cyberciti.biz/faq/download-a-file-with-curl-on-linux-unix-command-line/ f_install(){ temp="temp.zip" + begin="# BEGIN" + end="# END" + theme="${G_DIR}/themes/${G_THEME}/" cd ~ mkdir -p $G_DIR - if [ ! -d "G_DIR" ]; then + if [ ! -d "$G_DIR" ]; then echo "Error: ${G_DIR} is not a directory or cannot be accessed or created." usage fi @@ -175,14 +183,42 @@ f_install(){ rm -rf "nanorc-${G_VERSION}" fi + if [ ! -d "$theme" ]; then + echo "Error: ${G_THEME} is not a theme or cannot be accessed." + usage + fi + + touch "$G_FILE" + + echo "$begin" >> $G_FILE + echo "" >> $G_FILE + echo "$end" >> $G_FILE + if [ "$G_LITE" = true ]; then + sed -n -i.bkp '/'"$begin"'/,/'"$end"'/ { + /'"$begin"'/n + /'"$end"'/ !{ + s/*// + r + } + # r theme + # write the includes + }' $G_FILE + _update_nanorc_lite else _update_nanorc fi } -# updat/create the nanorc +# update. +# write comments, options, gui, rebindings, includes highlights (according theme) +# lite = maintains the nano nanorc files' +# get the list of nano's files and include only ours (exclude). +# big change: update all nanorc +# big change: install "only" the themed nanorc files and .nanorc + +# next: update/re-create the nanorc # ============================ # @@ -196,22 +232,22 @@ f_check_deps && exit 1 # Menu # Getopts: https://www.shellscript.sh/tips/getopts/ -while getopts "d:hltvf:" c +while getopts "d:hlt:uvw" c case $c in d) f_set_variable G_DIR $OPTARG ;; h) f_menu_usage ;; l) f_set_variable G_LITE true ;; - t) f_set_variable G_VERBOSE true ;; - u) f_set_variable G_UNSTABLE true + t) f_set_variable G_THEME $OPTARG ;; + u) f_set_variable G_UNSTABLE true ;; v) f_menu_version ;; - f) f_set_variable G_FILE $OPTARG ;; + w) f_set_variable G_VERBOSE true ;; *) f_menu_usage ;; esac done # Set defaults if there is not. -[ -z "$G_FILE" ] && G_FILE="~/.nanorc" [ -z "$G_DIR" ] && G_DIR="~/.nano/nanorc/" +[ -z "$G_THEME" ] && G_THEME="scopatz" # Set verbose if [ "$G_VERBOSE" = true ]; then diff --git a/themes/nano/config b/themes/nano/config new file mode 100644 index 0000000..3e2fae3 --- /dev/null +++ b/themes/nano/config @@ -0,0 +1,6 @@ +# NANO +# ===================== +# NANORC Nano +# ===================== + +# This configuration is empty to mantain the original configuration. diff --git a/themes/nano/gui b/themes/nano/gui deleted file mode 100755 index e69de29..0000000 diff --git a/themes/nano/keys b/themes/nano/keys deleted file mode 100755 index e69de29..0000000 diff --git a/themes/nano/highlight b/themes/nano/rules similarity index 92% rename from themes/nano/highlight rename to themes/nano/rules index 17d3e2e..e457f4d 100755 --- a/themes/nano/highlight +++ b/themes/nano/rules @@ -1,6 +1,11 @@ #!/usr/bin/sed -f -# ORIGINAL + +# NANO +# ===================== +# NANORC Nano +# ===================== + ## Best approach to the original 'nanorc' files. ## If you want the original, uninstall these files, ## but you will lose many highlight instructions... diff --git a/themes/scopatz/config b/themes/scopatz/config new file mode 100644 index 0000000..6373530 --- /dev/null +++ b/themes/scopatz/config @@ -0,0 +1,7 @@ +# SCOPATZ +# ===================== +# NANORC Scopatz +# https://github.com/scopatz +# ===================== + +# This configuration have nothing, yet ... diff --git a/themes/scopatz/gui b/themes/scopatz/gui deleted file mode 100755 index e69de29..0000000 diff --git a/themes/scopatz/keys b/themes/scopatz/keys deleted file mode 100755 index e69de29..0000000 diff --git a/themes/scopatz/highlight b/themes/scopatz/rules similarity index 75% rename from themes/scopatz/highlight rename to themes/scopatz/rules index d527c5e..7f0ccee 100755 --- a/themes/scopatz/highlight +++ b/themes/scopatz/rules @@ -1,11 +1,10 @@ #!/usr/bin/sed -f -# PROJECT -## Our approach to nano's highlight. - -# GUI Colors -## No GUI colors available, yet... - +# SCOPATZ +# ===================== +# NANORC Scopatz +# https://github.com/scopatz +# ===================== # Text Colors ## Strings and Comments: @@ -40,6 +39,6 @@ s|EMAIL|magenta| # Macros -#s|^+TODO|color brightcyan "TODO:?"| -#s|^+LINT|color ,green "[[:space:]]+$"\ncolor ,red "\t*"| -#s|^+LONG-LINE-WARNING|color ,red "^.{81,}$"| +# s|^+TODO|color brightcyan "TODO:?"| +# s|^+LINT|color ,green "[[:space:]]+$"\ncolor ,red "\t*"| +# s|^+LONG-LINE-WARNING|color ,red "^.{81,}$"| diff --git a/themes/tpro/config b/themes/tpro/config new file mode 100644 index 0000000..3b3948a --- /dev/null +++ b/themes/tpro/config @@ -0,0 +1,107 @@ +# TPRO +# ===================== +# NANORC TiagoProgrammer +# https://github.com/TJProgrammer +# ===================== + +# This configuration activates some IDE-ish features: +# - the autoindent, +# - a emptyline in the end of files, +# - justify a big text at 50th character, +# - a guidestripe at 80th character, +# - the linenumbers, +# - the multibuffer to opens several files at same time, +# - the positionlog to continue where stay, +# - the suspend (like minimising), +# - no tabs, only spaces, +# - save on quit, +# - no save the changes in WriteOut menu (Discard Buffer), +# - no trail blanks, +# - save in unix format when possible, +# - delete the marked region without touch the cut buffer. +# And some rebindings to the most natural and usual shortcuts! + +# Nano Options +set afterends +set atblanks +set autoindent +set brackets ""')>»]}" +set emptyline +set fill 70 +set guidestripe 80 +set historylog +set linenumbers +set matchbrackets "(<«"“[{)>»"”]}" +set mouse +set multibuffer +set noconvert +set positionlog +set punct "!.?" +set quickblank +set smarthome +set softwrap +set suspend +set tabsize 2 +set tabstospaces +set tempfile +set trimblanks +set unix +set zap + +# Nano GUI Colors +# set ... fgcolor,bgcolor +# Colors are: white, black, blue, green, red, cyan, yellow, magenta and normal. +set errorcolor red +set functioncolor blue +set keycolor white +set numbercolor white +set selectedcolor ,cyan +set statuscolor magenta +set stripecolor ,blue +set titlecolor brightwhite,blue + +# Nano Rebindings +# bind key function menu/all +# unbind key menu/all +# ^ Ctrl ; M- Alt ; F function + +bind M-H help all +bind ^Q exit all +bind ^Q exit browser +bind M-S writeout all +bind ^S savefile all +# Note: "O" from "Open a new file" +bind ^O insert all + +bind ^F whereis main +bind ^D wherewas main +bind M-D findprevious main +bind M-F findnext main + +bind ^X cut main +bind ^C copy main +bind ^V paste main + +bind M-M mark main +bind ^W wordcount main + +bind ^J justify main +bind M-J fulljustify main + +bind M-/ comment main +bind ^Space complete all + +bind M-R recordmacro all +bind ^R runmacro all + +bind ^Z undo all +bind M-Z redo all + +bind F5 refresh all +bind ^T suspend all +bind ^D discardbuffer writeout +bind ^E browser all + + +# Nano Highlights +# include ~/.nano/nanorc/nanorc/*.nanorc diff --git a/themes/tpro/gui b/themes/tpro/gui deleted file mode 100755 index e69de29..0000000 diff --git a/themes/tpro/keys b/themes/tpro/keys deleted file mode 100755 index e69de29..0000000 diff --git a/themes/tpro/highlight b/themes/tpro/rules similarity index 85% rename from themes/tpro/highlight rename to themes/tpro/rules index e573a08..1d16fb4 100755 --- a/themes/tpro/highlight +++ b/themes/tpro/rules @@ -1,6 +1,10 @@ #!/usr/bin/sed -f # TPRO +# ===================== +# NANORC TiagoProgrammer +# https://github.com/TJProgrammer +# ===================== # Text Colors ## Strings and Comments: @@ -34,4 +38,4 @@ s|REMINDERS|brightwhite,yellow| s|EMAIL|magenta| # Macros -## No Macros in original ... +## No Macros yet ... diff --git a/todo.md b/todo.md index 70998f2..c86ed69 100644 --- a/todo.md +++ b/todo.md @@ -9,5 +9,6 @@ 4. Make the install file the oficial installaton and update it accordingly. 0. make the installation with more plesant wait -0. may be begin with version system 1.0.0 +0. maybe begin with version system 1.0.0 0. make a function for error output/echo +0. make a library for functions (it is necessary #! ?)