|
1 | 1 | # shellcheck shell=bash
|
2 | 2 | # shellcheck disable=SC2034 # Expected behavior for themes.
|
3 |
| -# shellcheck disable=SC2154 #TODO: fix these all. |
4 | 3 |
|
5 | 4 | SCM_THEME_PROMPT_PREFIX=""
|
6 | 5 | SCM_THEME_PROMPT_SUFFIX=""
|
7 | 6 |
|
8 |
| -SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" |
9 |
| -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" |
10 |
| -SCM_GIT_CHAR="${bold_green}±${normal}" |
11 |
| -SCM_SVN_CHAR="${bold_cyan}⑆${normal}" |
12 |
| -SCM_HG_CHAR="${bold_red}☿${normal}" |
| 7 | +SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}" |
| 8 | +SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}" |
| 9 | +SCM_GIT_CHAR="${bold_green?}±${normal?}" |
| 10 | +SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}" |
| 11 | +SCM_HG_CHAR="${bold_red?}☿${normal?}" |
13 | 12 |
|
14 |
| -is_vim_shell() { |
15 |
| - if [ -n "$VIMRUNTIME" ]; then |
16 |
| - echo "[${cyan}vim shell${normal}]" |
| 13 | +function is_vim_shell() { |
| 14 | + if [[ -n "${VIMRUNTIME:-}" ]]; then |
| 15 | + echo "[${cyan?}vim shell${normal?}]" |
17 | 16 | fi
|
18 | 17 | }
|
19 | 18 |
|
20 |
| -prompt() { |
21 |
| - SCM_PROMPT_FORMAT=' %s (%s)' |
22 |
| - PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} " |
| 19 | +function prompt() { |
| 20 | + local SCM_PROMPT_FORMAT=' %s (%s)' clock_prompt battery_charge scm_prompt is_vim_shell |
| 21 | + clock_prompt="$(clock_prompt)" |
| 22 | + battery_charge="$(battery_charge)" |
| 23 | + scm_prompt="$(scm_prompt)" |
| 24 | + is_vim_shell="$(is_vim_shell)" |
| 25 | + PS1="${white?}${background_blue?} \u${normal?}${background_blue?}@${red?}${background_blue?}\h ${clock_prompt} ${reset_color?}${normal?} ${battery_charge}\n${bold_black?}${background_white?} \w ${normal?}${scm_prompt}${is_vim_shell}\n${white?}>${normal?} " |
23 | 26 | }
|
24 | 27 |
|
25 |
| -THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue$background_white"} |
26 |
| -THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-" %H:%M:%S"} |
| 28 | +: "${THEME_CLOCK_COLOR:=${blue?}${background_white?}}" |
| 29 | +: "${THEME_CLOCK_FORMAT:=" %H:%M:%S"}" |
27 | 30 |
|
28 | 31 | safe_append_prompt_command prompt
|
0 commit comments