Added termcolors script

This commit is contained in:
2022-01-02 20:22:36 -05:00
parent 5fc94f0cb8
commit 8b6aef9aee
3 changed files with 72 additions and 4 deletions

View File

@@ -94,7 +94,7 @@ _install_nvim() {
# link if in link mode
test "$link" -eq 0 && _link_nvim && exit "$?"
# else we don't know what to do
echo "Neither link or copy options were set. Use the --help option" >&2
echo "Neither link or copy options were set. Use the --help option for usage." >&2
exit 1
}
@@ -104,14 +104,14 @@ main() {
_parse_options "$@"
# check if remove is called first
test $remove -eq 0 && _remove_nvim && exit "$?"
test "$remove" -eq 0 && _remove_nvim && exit "$?"
# then check if uninstall was called
test $uninstall -eq 0 && _uninstall_nvim && exit "$?"
test "$uninstall" -eq 0 && _uninstall_nvim && exit "$?"
# else install the configuration files
_install_nvim
echo "Nvim will need to be started for vim plugins to download."
echo "Nvim will need to be started and call :PackerSync for plugins to be downloaded." >&2
}
main "$@"

57
scripts/scripts/termcolors Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/sh
# Prints the terminal theme regular colors (and some other escapes). For
# "bright/bold" variation add 1; in front of the number. Useful for
# sampling and remembering the escapes when hardcoding them into scripts
# for portability. Keep in mind that the color names are those given for
# the original color terminal and obviously can vary widely. For color
# intensive output consider shortening the names to their first letter
# instead and don't forget to wrap them within ${}. Omits (and overrides
# any inherited) colors when not interactive/piped.
black=""
red=""
green=""
yellow=""
blue=""
magenta=""
cyan=""
white=""
blink=""
reset=""
if test -t 1; then
black="\e[30m"
red="\e[31m"
green="\e[32m"
yellow="\e[33m"
blue="\e[34m"
magenta="\e[35m"
cyan="\e[36m"
white="\e[37m"
blink="\e[5m"
reset="\e[0m"
fi
echo POSIX
printf "${black}black=\"\\\e[30m\"
${red}red=\"\\\e[31m\"
${green}green=\"\\\e[32m\"
${yellow}yellow=\"\\\e[33m\"
${blue}blue=\"\\\e[34m\"
${magenta}magenta=\"\\\e[35m\"
${cyan}cyan=\"\\\e[36m\"
${white}white=\"\\\e[37m\"
reset=\"\\\e[0m\"
"
echo
echo BASH:
printf "${black}black=$'\\\e[30m'
${red}red=$'\\\e[31m'
${green}green=$'\\\e[32m'
${yellow}yellow=$'\\\e[33m'
${blue}blue=$'\\\e[34m'
${magenta}magenta=$'\\\e[35m'
${cyan}cyan=$'\\\e[36m'
${white}white=$'\\\e[37m'
reset=$'\\\e[0m'
"

View File

@@ -44,6 +44,16 @@ zle -N down-line-or-beginning-search
# Colors
autoload -Uz colors && colors
#------------------------------ pager ------------------------------
export LESS_TERMCAP_mb="" # magenta
export LESS_TERMCAP_md="" # yellow
export LESS_TERMCAP_me=""
export LESS_TERMCAP_se=""
export LESS_TERMCAP_so="" # blue
export LESS_TERMCAP_ue=""
export LESS_TERMCAP_so="" # underline
#------------------------------ path ------------------------------
path_append() {
@@ -168,6 +178,7 @@ alias gcm='git commit -m'
alias gp='git push'
alias gs='git status'
alias vi='vim'
alias nvim='unset VIMINIT && unset MYVIMRC && nvim'
#------------------------------ local configs ------------------------------
_source_if "$ZDOTDIR/.zshrc-local"