diff options
author | Mike Crute <mike@crute.us> | 2019-09-22 13:35:47 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-09-22 13:35:47 -0700 |
commit | 65522ae3caa43d4c71af71ea30bfbb6b729a80bd (patch) | |
tree | 7b5fc3c07793ec11301c3008774cf2e6df3d5c7c /.bashrc | |
parent | daa27716321f3e4f4e307b668b0e1193f26f0d19 (diff) | |
download | dotfiles-65522ae3caa43d4c71af71ea30bfbb6b729a80bd.tar.bz2 dotfiles-65522ae3caa43d4c71af71ea30bfbb6b729a80bd.tar.xz dotfiles-65522ae3caa43d4c71af71ea30bfbb6b729a80bd.zip |
Better prompt documentation
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -111,18 +111,30 @@ if [[ "$MY_SHELL" =~ "bash" ]]; then | |||
111 | shopt -s histappend | 111 | shopt -s histappend |
112 | shopt -s cmdhist | 112 | shopt -s cmdhist |
113 | 113 | ||
114 | export PROMPT_COMMAND="history -a" | 114 | function _prompt_command |
115 | { | ||
116 | # This effectively forcibly synchronizes history lists between windows | ||
117 | # such that a command entered in a different window will be available | ||
118 | # for ^R in this window after the next prompt generation. | ||
119 | history -a # Append current window history to history file | ||
120 | history -n # Read new history entries to current window history list | ||
121 | } | ||
122 | |||
123 | export PROMPT_COMMAND=_prompt_command | ||
115 | 124 | ||
116 | # Cache user and host instead of using \h and \u to avoid the hostname and | 125 | # Cache user and host instead of using \h and \u to avoid the hostname and |
117 | # username lookup on every line. This can be really slow on a slow | 126 | # username lookup on every line. This can be really slow on a slow |
118 | # connection or on systems running SSSD. | 127 | # connection or on systems running SSSD. 2019-9-22: Removed username from |
119 | 128 | # the cache so that it switches to roo correctly on sudo. Will re-evaluate. | |
120 | # Old simple version | ||
121 | #export PS1="\t $(whoami)@$(hostname -s) \W \$ " | ||
122 | 129 | ||
123 | # Colorful version (colors are for my normal stterm scheme, not ASCII) | 130 | # Colorful version (colors are for my normal stterm scheme, not ASCII) |
124 | [[ $UID == 0 ]] && _pcolor="92" || _pcolor="36" | 131 | _clear="\[\e[39;0;49m\]" |
125 | export PS1="\t \[\e[${_pcolor};1;49m\]$(whoami)\[\e[91;1;49m\]@$(hostname -s) \[\e[36;1;49m\]\W \[\e[33;1;49m\]$ \[\e[39;0;49m\]" | 132 | _cyan="\[\e[36;1;49m\]" |
133 | _green="\[\e[91;1;49m\]" | ||
134 | _gold="\[\e[33;1;49m\]" | ||
135 | _red="\[\e[92;1;49m\]" | ||
136 | |||
137 | export PS1="\t ${_cyan}\u${_green}@$(hostname -s) ${_cyan}\W ${_gold}\\$ ${_clear}" | ||
126 | 138 | ||
127 | load_all_from "$HOME/.bash_completion.d" | 139 | load_all_from "$HOME/.bash_completion.d" |
128 | 140 | ||