Many changes envolving the themes and configs

This commit is contained in:
Tiago Almeida 2019-11-23 00:02:59 +00:00
parent 2f9ddebc39
commit 469b554a54
14 changed files with 193 additions and 28 deletions

View File

@ -28,9 +28,10 @@ G_IFS=" "
# Global Variables # Global Variables
G_VERSION="2019.10.17" G_VERSION="2019.10.17"
G_DEPS="unzip sed" G_DEPS="unzip sed"
G_FILE="~/.nanorc"
G_REPO_MASTER="https://github.com/scopatz/nanorc/archive/master.zip" G_REPO_MASTER="https://github.com/scopatz/nanorc/archive/master.zip"
G_REPO_RELEASE="https://github.com/scopatz/nanorc/archive/${G_VERSION}.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 # Exit Values Help
# 0 - OK # 0 - OK
@ -40,22 +41,26 @@ unset G_DIR G_LITE G_VERBOSE G_UNSTABLE G_FILE
# Show the usage/help # Show the usage/help
f_menu_usage(){ 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
echo "IMPROVED NANO SYNTAX HIGHLIGHTING FILES" echo "IMPROVED NANO SYNTAX HIGHLIGHTING FILES"
echo "Get nano editor better to use and see." echo "Get nano editor better to use and see."
echo echo
echo "-d Give other directory for installation."
echo " Default: ~/.nano/nanorc/"
echo "-h Show help or usage." echo "-h Show help or usage."
echo "-l Activate lite installation." echo "-l Activate lite installation."
echo " We will take account your existing .nanorc files." 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 (master)."
echo "-u Use the unstable branch."
echo "-v Show version, license and other info." echo "-v Show version, license and other info."
echo "-f FILE" echo "-w Turn the script more verbose, often to tests."
echo " The path of other file instead of the default .nanorc file." 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 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/ # Sources: https://www.cyberciti.biz/faq/download-a-file-with-curl-on-linux-unix-command-line/
f_install(){ f_install(){
temp="temp.zip" temp="temp.zip"
begin="# BEGIN"
end="# END"
theme="${G_DIR}/themes/${G_THEME}/"
cd ~ cd ~
mkdir -p $G_DIR 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." echo "Error: ${G_DIR} is not a directory or cannot be accessed or created."
usage usage
fi fi
@ -175,14 +183,42 @@ f_install(){
rm -rf "nanorc-${G_VERSION}" rm -rf "nanorc-${G_VERSION}"
fi 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 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 _update_nanorc_lite
else else
_update_nanorc _update_nanorc
fi 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 # Menu
# Getopts: https://www.shellscript.sh/tips/getopts/ # Getopts: https://www.shellscript.sh/tips/getopts/
while getopts "d:hltvf:" c while getopts "d:hlt:uvw" c
case $c in case $c in
d) f_set_variable G_DIR $OPTARG ;; d) f_set_variable G_DIR $OPTARG ;;
h) f_menu_usage ;; h) f_menu_usage ;;
l) f_set_variable G_LITE true ;; l) f_set_variable G_LITE true ;;
t) f_set_variable G_VERBOSE true ;; t) f_set_variable G_THEME $OPTARG ;;
u) f_set_variable G_UNSTABLE true u) f_set_variable G_UNSTABLE true ;;
v) f_menu_version ;; v) f_menu_version ;;
f) f_set_variable G_FILE $OPTARG ;; w) f_set_variable G_VERBOSE true ;;
*) f_menu_usage ;; *) f_menu_usage ;;
esac esac
done done
# Set defaults if there is not. # Set defaults if there is not.
[ -z "$G_FILE" ] && G_FILE="~/.nanorc"
[ -z "$G_DIR" ] && G_DIR="~/.nano/nanorc/" [ -z "$G_DIR" ] && G_DIR="~/.nano/nanorc/"
[ -z "$G_THEME" ] && G_THEME="scopatz"
# Set verbose # Set verbose
if [ "$G_VERBOSE" = true ]; then if [ "$G_VERBOSE" = true ]; then

6
themes/nano/config Normal file
View File

@ -0,0 +1,6 @@
# NANO
# =====================
# NANORC Nano
# =====================
# This configuration is empty to mantain the original configuration.

View File

View File

View File

@ -1,6 +1,11 @@
#!/usr/bin/sed -f #!/usr/bin/sed -f
# ORIGINAL
# NANO
# =====================
# NANORC Nano
# =====================
## Best approach to the original 'nanorc' files. ## Best approach to the original 'nanorc' files.
## If you want the original, uninstall these files, ## If you want the original, uninstall these files,
## but you will lose many highlight instructions... ## but you will lose many highlight instructions...

7
themes/scopatz/config Normal file
View File

@ -0,0 +1,7 @@
# SCOPATZ
# =====================
# NANORC Scopatz
# https://github.com/scopatz
# =====================
# This configuration have nothing, yet ...

View File

View File

View File

@ -1,11 +1,10 @@
#!/usr/bin/sed -f #!/usr/bin/sed -f
# PROJECT # SCOPATZ
## Our approach to nano's highlight. # =====================
# NANORC Scopatz
# GUI Colors # https://github.com/scopatz
## No GUI colors available, yet... # =====================
# Text Colors # Text Colors
## Strings and Comments: ## Strings and Comments:

107
themes/tpro/config Normal file
View File

@ -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

View File

View File

View File

@ -1,6 +1,10 @@
#!/usr/bin/sed -f #!/usr/bin/sed -f
# TPRO # TPRO
# =====================
# NANORC TiagoProgrammer
# https://github.com/TJProgrammer
# =====================
# Text Colors # Text Colors
## Strings and Comments: ## Strings and Comments:
@ -34,4 +38,4 @@ s|REMINDERS|brightwhite,yellow|
s|EMAIL|magenta| s|EMAIL|magenta|
# Macros # Macros
## No Macros in original ... ## No Macros yet ...

View File

@ -11,3 +11,4 @@
0. make the installation with more plesant wait 0. make the installation with more plesant wait
0. maybe 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 function for error output/echo
0. make a library for functions (it is necessary #! ?)