Fixed vim and zsh
This commit is contained in:
8
zsh/modules/spectrum/README.md
Normal file
8
zsh/modules/spectrum/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
Spectrum
|
||||
========
|
||||
|
||||
Provides initialization for easy 256 colours and effects.
|
||||
|
||||
See [a guide to 256 color codes](http://lucentbeing.com/writing/archives/a-guide-to-256-color-codes/), in particular, the "Spectrum, a ZSH Abstraction" section.
|
||||
|
||||
|
39
zsh/modules/spectrum/init.zsh
Normal file
39
zsh/modules/spectrum/init.zsh
Normal file
@ -0,0 +1,39 @@
|
||||
#
|
||||
# Provides for easier use of 256 colors and effects.
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
if [[ ${TERM} == 'dumb' ]]; then
|
||||
return 1
|
||||
elif
|
||||
[[ -n ${FX} ]]; then
|
||||
# FX is set or sourced by another module
|
||||
return 1
|
||||
fi
|
||||
|
||||
typeset -gA FX FG BG
|
||||
|
||||
FX=(
|
||||
reset "\e[00m"
|
||||
normal "\e[22m"
|
||||
bold "\e[01m" no-bold "\e[22m"
|
||||
italic "\e[03m" no-italic "\e[23m"
|
||||
underline "\e[04m" no-underline "\e[24m"
|
||||
blink "\e[05m" no-blink "\e[25m"
|
||||
reverse "\e[07m" no-reverse "\e[27m"
|
||||
)
|
||||
|
||||
FG[none]="${FX[none]}"
|
||||
BG[none]="${FX[none]}"
|
||||
colors=(black red green yellow blue magenta cyan white)
|
||||
for color in {0..255}; do
|
||||
if (( ${color} >= 0 )) && (( ${color} < ${#colors} )); then
|
||||
index=$(( ${color} + 1 ))
|
||||
FG[${colors[${index}]}]="\e[38;5;${color}m"
|
||||
BG[${colors[${index}]}]="\e[48;5;${color}m"
|
||||
fi
|
||||
|
||||
FG[${color}]="\e[38;5;${color}m"
|
||||
BG[${color}]="\e[48;5;${color}m"
|
||||
done
|
||||
unset color{s,} index
|
BIN
zsh/modules/spectrum/init.zsh.zwc
Normal file
BIN
zsh/modules/spectrum/init.zsh.zwc
Normal file
Binary file not shown.
Reference in New Issue
Block a user