Add `codeword` theme

- Single line PS1
- Shares history in realtime among bash windows
pull/1202/head
Jonathan Barnes 2018-06-03 10:06:25 -07:00
parent e51c6ad960
commit a25ac59b84
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Single line PS1 theme w/realtime history among windows
Minimal theme overrides from bash_it base theming
## `user@host:path[virt-env][scm] $`
Breakdown of the segments:
- **user@host:path** - *convienient for LAN based `ssh` and `scp` tasks*
- [**virtualenv**] - *only appears when activated*
- [**scm**] - *only appears when activated*
- **marker** - *$ or # depending on current user*
### Examples
```bash
user@example.lan:~ $ cd /tmp/foo/bar/baz
user@example.lan:/tmp/foo/bar/baz $ cd $HOME/workspace
user@example.lan:~/workspace $ cd sampleRepo/
user@example.lan:~/workspace/sampleRepo [± |master ↑1 ↓3 {1} S:2 ?:1 ✗|] $
```

View File

@ -0,0 +1,38 @@
SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX}
SCM_THEME_PROMPT_DIRTY="${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}"
SCM_GIT_CHAR="${green}±${normal}"
scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo " [$(scm_char)$(scm_prompt_info)]"
fi
}
mark_prompt() {
echo "${green}\$${normal}"
}
user_host_path_prompt() {
ps_user="${green}\u${normal}";
ps_host="${blue}\H${normal}";
ps_path="${yellow}\w${normal}";
echo "$ps_user@$ps_host:$ps_path"
}
prompt() {
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
}
share_history() {
history -a
history -c
history -r
}
safe_append_prompt_command share_history
safe_append_prompt_command prompt