From 885bbae59a3cc25da7515cb8c7b9024fb0442b89 Mon Sep 17 00:00:00 2001 From: acrain Date: Wed, 18 Jun 2014 15:25:22 -0400 Subject: [PATCH] new Bobby-based theme with command input colored differently from command output --- bash_it.sh | 3 +++ lib/{preexec.bash => preexec.sh} | 0 themes/ogunquit/ogunquit.theme.bash | 33 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) rename lib/{preexec.bash => preexec.sh} (100%) create mode 100644 themes/ogunquit/ogunquit.theme.bash diff --git a/bash_it.sh b/bash_it.sh index e225fd7c..cf8d0c35 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -24,6 +24,9 @@ fi # Load composure first, so we support function metadata source "${BASH_IT}/lib/composure.sh" +# Also load preexec, so themes can use it if needed +source "${BASH_IT}/lib/preexec.sh" + # support 'plumbing' metadata cite _about _param _example _group _author _version diff --git a/lib/preexec.bash b/lib/preexec.sh similarity index 100% rename from lib/preexec.bash rename to lib/preexec.sh diff --git a/themes/ogunquit/ogunquit.theme.bash b/themes/ogunquit/ogunquit.theme.bash new file mode 100644 index 00000000..5e9ab11f --- /dev/null +++ b/themes/ogunquit/ogunquit.theme.bash @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# Copies the Bobby theme and then: a) colors command input differently (blue) from command output (white), by resetting +# color immediately prior to command execution using preexec; b) replaces ruby prompt with virtualenv prompt + +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_PREFIX=" |" +SCM_THEME_PROMPT_SUFFIX="${green}|" + +GIT_THEME_PROMPT_DIRTY=" ${red}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" +GIT_THEME_PROMPT_PREFIX=" ${green}|" +GIT_THEME_PROMPT_SUFFIX="${green}|" + +RVM_THEME_PROMPT_PREFIX="|" +RVM_THEME_PROMPT_SUFFIX="|" + +VIRTUALENV_THEME_PROMPT_PREFIX='[@env: ' +VIRTUALENV_THEME_PROMPT_SUFFIX='] ' + +function prompt_command() { + PS1="\n${yellow}$(virtualenv_prompt)${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} \[$(tput setaf 4)\]" +} + +PROMPT_COMMAND=prompt_command; + +NOCOLOR="$(tput sgr0)" +function preexec () { + tput sgr0 + #echo -ne "${NOCOLOR}" +} +preexec_install