v0.0.8
This commit is contained in:
@@ -1,119 +1,50 @@
|
||||
# eric prompt theme
|
||||
# Generic large colour fade-bar prompt theme from bashprompt
|
||||
# Created by James Manning <jmm@raleigh.ibm.com>
|
||||
# Changed by Spidey 08/06
|
||||
# Converted to zsh prompt theme by <adam@spiers.net>
|
||||
|
||||
prompt_eric_help () {
|
||||
cat <<'EOF'
|
||||
prompt_bigfade_help () {
|
||||
cat <<EOH
|
||||
This prompt is color-scheme-able. You can invoke it thus:
|
||||
|
||||
prompt eric [ 8bit ] [<color1> [<color2> [<color3>] [<color4>]]
|
||||
prompt bigfade [<fade-bar> [<userhost> [<date> [<cwd>]]]]
|
||||
|
||||
where the colors are for the hyphens, current directory, user@host,
|
||||
and user input bits respectively. The default colors are cyan, green,
|
||||
cyan, and white. This theme works best with a dark background.
|
||||
where the parameters are the colors for the fade-bar, user@host text,
|
||||
date text, and current working directory respectively. The default
|
||||
colors are blue, white, white, and yellow. This theme works best with
|
||||
a dark background.
|
||||
|
||||
If you have either UTF-8 or the `nexus' or `vga' console fonts or similar,
|
||||
you can specify the `8bit' option to use 8-bit replacements for the
|
||||
7-bit characters.
|
||||
|
||||
And you probably thought adam1 was overkill ...
|
||||
EOF
|
||||
Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
|
||||
If you don't have any of these, the 8-bit characters will probably look
|
||||
stupid.
|
||||
EOH
|
||||
}
|
||||
|
||||
prompt_eric_setup () {
|
||||
# Some can't be local
|
||||
setopt localoptions nowarncreateglobal
|
||||
local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc
|
||||
prompt_bigfade_setup () {
|
||||
local fadebar=${1:-'cyan'}
|
||||
local userhost=${2:-'white'}
|
||||
local date=${3:-'white'}
|
||||
local cwd=${4:-'cyan'}
|
||||
|
||||
if [[ $1 == '8bit' ]]; then
|
||||
shift
|
||||
if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then
|
||||
prompt_gfx_tlc=$'\xe2\x94\x8c'
|
||||
prompt_gfx_mlc=$'\xe2\x94\x9c'
|
||||
prompt_gfx_blc=$'\xe2\x94\x94'
|
||||
prompt_gfx_hyphen=$'\xe2\x94\x80'
|
||||
else
|
||||
prompt_gfx_tlc=$'\xda'
|
||||
prompt_gfx_mlc=$'\xc3'
|
||||
prompt_gfx_blc=$'\xc0'
|
||||
prompt_gfx_hyphen=$'\xc4'
|
||||
fi
|
||||
local -A schars
|
||||
autoload -Uz prompt_special_chars
|
||||
prompt_special_chars
|
||||
|
||||
PS1="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$userhost}%K{$fadebar}%n@%m%b%k%f%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%b%f%k%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$date}%b%f%k %D{%a %b %d} %D{%I:%M:%S%P} %B%F{$cwd}%d$prompt_newline> "
|
||||
PS2="%B%F{$fadebar}>%b%f%k "
|
||||
|
||||
prompt_opts=(cr subst percent)
|
||||
}
|
||||
|
||||
prompt_bigfade_preview () {
|
||||
if (( ! $#* )); then
|
||||
prompt_preview_theme bigfade
|
||||
print
|
||||
prompt_preview_theme bigfade red white grey white
|
||||
else
|
||||
prompt_gfx_tlc='.'
|
||||
prompt_gfx_mlc='|'
|
||||
prompt_gfx_blc='\`'
|
||||
prompt_gfx_hyphen='-'
|
||||
prompt_preview_theme bigfade "$@"
|
||||
fi
|
||||
|
||||
# Colour scheme
|
||||
prompt_eric_color1=${1:-'white'} # hyphens
|
||||
prompt_eric_color2=${2:-'cyan'} # current directory
|
||||
prompt_eric_color3=${3:-'cyan'} # user@host
|
||||
prompt_eric_color4=${4:-'white'} # user input
|
||||
|
||||
local prompt_gfx_bbox
|
||||
prompt_gfx_tbox="%B%F{$prompt_eric_color1}${prompt_gfx_tlc}%b%F{$prompt_eric_color1}${prompt_gfx_hyphen}"
|
||||
prompt_gfx_bbox="%B%F{$prompt_eric_color1}${prompt_gfx_blc}${prompt_gfx_hyphen}%b%F{$prompt_eric_color1}"
|
||||
|
||||
# This is a cute hack. Well I like it, anyway.
|
||||
prompt_gfx_bbox_to_mbox=$'%{\e[A\r'"%}%B%F{$prompt_eric_color1}${prompt_gfx_mlc}%b%F{$prompt_eric_color1}${prompt_gfx_hyphen}%{"$'\e[B%}'
|
||||
|
||||
prompt_l_paren="%B%F{black}("
|
||||
prompt_r_paren="%B%F{black})"
|
||||
|
||||
prompt_user_host="%b%F{$prompt_eric_color3}%n%B%F{$prompt_eric_color3}@%b%F{$prompt_eric_color3}%m %{$fg[cyan]%}[%D{%f/%m/%y} %D{%L:%M:%S}]"
|
||||
|
||||
prompt_line_1a="$prompt_gfx_tbox$prompt_l_paren%B%F{$prompt_eric_color2}%~$prompt_r_paren%b%F{$prompt_eric_color1}"
|
||||
prompt_line_1b="$prompt_l_paren$prompt_user_host$prompt_r_paren%b%F{$prompt_eric_color1}${prompt_gfx_hyphen}"
|
||||
|
||||
prompt_line_2="$prompt_gfx_bbox${prompt_gfx_hyphen}%B%F{white}"
|
||||
|
||||
prompt_char="%(!.#.>)"
|
||||
|
||||
prompt_opts=(cr subst percent)
|
||||
|
||||
add-zsh-hook precmd prompt_eric_precmd
|
||||
}
|
||||
|
||||
prompt_eric_precmd() {
|
||||
setopt localoptions extendedglob noxtrace nowarncreateglobal
|
||||
local prompt_line_1
|
||||
|
||||
prompt_eric_choose_prompt
|
||||
|
||||
PS1="$prompt_line_1$prompt_newline$prompt_line_2%B%F{white}$prompt_char %b%f%k"
|
||||
PS2="$prompt_line_2$prompt_gfx_bbox_to_mbox%B%F{white}-> %b%f%k"
|
||||
PS3="$prompt_line_2$prompt_gfx_bbox_to_mbox%B%F{white}-> %b%f%k"
|
||||
zle_highlight[(r)default:*]="default:fg=$prompt_eric_color4,bold"
|
||||
}
|
||||
|
||||
prompt_eric_choose_prompt () {
|
||||
local prompt_line_1a_width=${#${(S%%)prompt_line_1a//(\%([KF1]|)\{*\}|\%[Bbkf])}}
|
||||
local prompt_line_1b_width=${#${(S%%)prompt_line_1b//(\%([KF1]|)\{*\}|\%[Bbkf])}}
|
||||
|
||||
local prompt_padding_size=$(( COLUMNS
|
||||
- prompt_line_1a_width
|
||||
- prompt_line_1b_width ))
|
||||
|
||||
# Try to fit in long path and user@host.
|
||||
if (( prompt_padding_size > 0 )); then
|
||||
local prompt_padding
|
||||
eval "prompt_padding=\${(l:${prompt_padding_size}::${prompt_gfx_hyphen}:)_empty_zz}"
|
||||
prompt_line_1="$prompt_line_1a$prompt_padding$prompt_line_1b"
|
||||
return
|
||||
fi
|
||||
|
||||
prompt_padding_size=$(( COLUMNS - prompt_line_1a_width ))
|
||||
|
||||
# Didn't fit; try to fit in just long path.
|
||||
if (( prompt_padding_size > 0 )); then
|
||||
local prompt_padding
|
||||
eval "prompt_padding=\${(l:${prompt_padding_size}::${prompt_gfx_hyphen}:)_empty_zz}"
|
||||
prompt_line_1="$prompt_line_1a$prompt_padding"
|
||||
return
|
||||
fi
|
||||
|
||||
# Still didn't fit; truncate
|
||||
local prompt_pwd_size=$(( COLUMNS - 5 ))
|
||||
prompt_line_1="$prompt_gfx_tbox$prompt_l_paren%B%F{$prompt_eric_color2}%$prompt_pwd_size<...<%~%<<$prompt_r_paren%b%F{$prompt_eric_color1}$prompt_gfx_hyphen"
|
||||
}
|
||||
|
||||
prompt_eric_setup "$@"
|
||||
prompt_bigfade_setup "$@"
|
||||
|
||||
@@ -14,14 +14,10 @@
|
||||
|
||||
- name: Copy zsh configuration
|
||||
copy:
|
||||
src: files/zsrhc
|
||||
dest: /home/eric/.zsrhc
|
||||
src: zshrc
|
||||
dest: /home/eric/.zshrc
|
||||
|
||||
- name: Install custom zsh prompt
|
||||
copy:
|
||||
src: files/prompt_eric_setup
|
||||
src: prompt_eric_setup
|
||||
dest: /usr/share/zsh/functions/Prompts/prompt_eric_setup
|
||||
|
||||
- name: Setup mobile command
|
||||
include_tasks: mobile-command.yml
|
||||
when: ansible_host == mobil_command
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
- git
|
||||
- gimp
|
||||
- gpsd
|
||||
- mariadb-client
|
||||
- neovim
|
||||
- openscad
|
||||
- passwordsafe
|
||||
@@ -21,12 +22,12 @@
|
||||
|
||||
- name: Copy tmux configuration
|
||||
copy:
|
||||
src: files/tmux.conf
|
||||
src: tmux.conf
|
||||
dest: /home/eric/.tmux.conf
|
||||
|
||||
- name: Copy git configuration
|
||||
copy:
|
||||
src: files/gitconfig
|
||||
src: gitconfig
|
||||
dest: /home/eric/.gitconfig
|
||||
|
||||
- name: Create local configuration directory
|
||||
@@ -36,6 +37,6 @@
|
||||
|
||||
- name: Copy neovim configuration
|
||||
copy:
|
||||
src: files/init.lua
|
||||
src: init.lua
|
||||
dest: /home/eric/.config/nvim/init.lua
|
||||
|
||||
|
||||
Reference in New Issue
Block a user