Move stuff from spectrum.sh into prompt.sh

This commit is contained in:
Ivan Malison 2014-04-25 13:18:15 -07:00
parent a7e245d961
commit fa2eb6663f
2 changed files with 31 additions and 32 deletions

View File

@ -1,4 +1,31 @@
##### COLOR SETUP
autoload -U colors && colors
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from
# http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
print -P -- "$code: %{$FG[$code]Test%f%}"
done
}
#####
function current_directory() {
local PWD=$(pwd)
echo "${PWD/#$HOME/~}"
@ -29,21 +56,21 @@ function sandbox_prompt() {
fi
}
function prompt_use_custom_colors() {
function prompt_custom_colors() {
export USERNAME_COLOR="$FG[040]"
export SEPARATOR_COLOR="$FG[239]"
export HOSTNAME_COLOR="$FG[033]"
export CURRENT_DIRECTORY_COLOR="$FG[226]"
}
function prompt_use_basic_colors() {
function prompt_basic_colors() {
export USERNAME_COLOR="$fg[blue]"
export SEPARATOR_COLOR="$fg[black]"
export HOSTNAME_COLOR="$fg[green]"
export CURRENT_DIRECTORY_COLOR="$fg[yellow]"
}
function prompt_grey_separator() {
function prompt_basic_colors_with_grey_separator() {
export USERNAME_COLOR="$fg[blue]"
export SEPARATOR_COLOR="$FG[239]"
export HOSTNAME_COLOR="$fg[green]"
@ -58,7 +85,7 @@ function separator() {
print_with_color "$1" "$SEPARATOR_COLOR"
}
prompt_use_custom_colors
prompt_basic_colors_with_grey_separator
PROMPT='╭─% $(print_with_color "%n" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$terminfo[bold]$CURRENT_DIRECTORY_COLOR")$(git_prompt_info)$(sandbox_prompt)
╰─± '

View File

@ -1,28 +0,0 @@
#!/bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
print -P -- "$code: %{$FG[$code]Test%f%}"
done
}