summaryrefslogtreecommitdiff
path: root/.zsh/functions/prompt_necoro_setup
blob: ad83361c3767211a57889eddf29230b2f47f1bff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# gentoo prompt theme

prompt_necoro_help () {
  cat <<'EOF'
This prompt is color-scheme-able.  You can invoke it thus:

  prompt necoro [<promptcolor> [<usercolor> [<rootcolor>]]]

EOF
}

prompt_necoro_setup () {
  emulate -L zsh

  autoload -U colors
  colors

  prompt_necoro_prompt=${1:-'blue'}
  prompt_necoro_user=${2:-'green'}
  prompt_necoro_root=${3:-'red'}

  if [ "$USER" = 'root' ]
  then
    base_prompt="%B%{$fg[$prompt_necoro_root]%}%m%k "
  else
    base_prompt="%B%{$fg[$prompt_necoro_user]%}%n@%m%k "
  fi
  post_prompt="%b%{$reset_color%}%k"

  #setopt noxtrace localoptions

  path_prompt="%B%{$fg[$prompt_necoro_prompt]%}%1~"
  PS1="$base_prompt$path_prompt %# $post_prompt"
  PS2="$base_prompt$path_prompt %_> $post_prompt"
  PS3="$base_prompt$path_prompt ?# $post_prompt"
}

prompt_necoro_setup "$@"