aboutsummaryrefslogtreecommitdiffstats
path: root/bash
diff options
context:
space:
mode:
authorjason2022-07-23 15:31:12 -0600
committerjason2022-07-23 15:31:12 -0600
commitbac761ceb8c4e432b9c938ef294d2ae70157fed1 (patch)
treec66d3163a4edcb3902655c0c676b29cd9d55b9c4 /bash
parent9daa2b5aa785237d2265219c462e79d22c1c0e63 (diff)
downloaddotfiles-bac761ceb8c4e432b9c938ef294d2ae70157fed1.tar.gz
dotfiles-bac761ceb8c4e432b9c938ef294d2ae70157fed1.zip
fix docker completion & prompt
Diffstat (limited to 'bash')
-rw-r--r--bash/.bashrc68
1 files changed, 37 insertions, 31 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index 01e5e04..ffef555 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -1,7 +1,7 @@
1LC_ALL="en_US.UTF-8" 1LC_ALL="en_US.UTF-8"
2# This PS1 is completed at the end, allowing statuses to be included between the directory and closing $ 2# This PS1 is completed at the end, allowing statuses to be included between the directory and closing $
3PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]" 3PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]"
4local END_PS1="\$\[\e[m\] " 4END_PS1="\$\[\e[m\] "
5# This is the original PS1 5# This is the original PS1
6#PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]\$\[\e[m\] " 6#PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]\$\[\e[m\] "
7PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" 7PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}"
@@ -54,8 +54,13 @@ fi
54 54
55# Enable docker completions 55# Enable docker completions
56if [ -d /Applications/Docker.app/Contents/Resources/etc/ ]; then 56if [ -d /Applications/Docker.app/Contents/Resources/etc/ ]; then
57 # Docker for Mac seems to switch the filenames sometimes.
58 if [ -f /Applications/Docker.app/Contents/Resources/etc/docker ]; then
59 . /Applications/Docker.app/Contents/Resources/etc/docker
60 elif [ -f /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion ]; then
61 . /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion
62 fi
57 . /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion 63 . /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion
58 . /Applications/Docker.app/Contents/Resources/etc/docker
59fi 64fi
60 65
61# Enable nix 66# Enable nix
@@ -159,6 +164,19 @@ alias define='sdcv'
159#alias cleanstale="git clean -fd -e'!__pycache__' -e'!*.py[cod]'" 164#alias cleanstale="git clean -fd -e'!__pycache__' -e'!*.py[cod]'"
160#alias dry-cleanstale="git clean -fdn -e'!__pycache__' -e'!*.py[cod]'" 165#alias dry-cleanstale="git clean -fdn -e'!__pycache__' -e'!*.py[cod]'"
161 166
167# Enable direnv (https://github.com/direnv/direnv/)
168DIRENV=`which direnv`
169if [[ -x $DIRENV ]]; then
170 eval "$(direnv hook bash)"
171fi
172show_virtual_env() {
173 if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
174 echo "($(basename $VIRTUAL_ENV))"
175 fi
176}
177export -f show_virtual_env
178PS1='$(show_virtual_env)'$PS1
179
162# Git Related 180# Git Related
163function delete-branches() { 181function delete-branches() {
164 # Interactive branch deleter 182 # Interactive branch deleter
@@ -169,31 +187,18 @@ function delete-branches() {
169 xargs --no-run-if-empty git branch --delete --force 187 xargs --no-run-if-empty git branch --delete --force
170} 188}
171 189
172local XCODE_SELECT=`which xcode-select` 190XCODE_SELECT=`which xcode-select`
173if [[ -x $XCODE_SELECT ]]; then 191if [[ -x $XCODE_SELECT ]]; then
174 local OSX_GIT_COMPLETION=`xcode-select -p`/usr/share/git-core/git-completion.bash 192 OSX_GIT_COMPLETION=`xcode-select -p`/usr/share/git-core/git-completion.bash
175 if [[ -f $OSX_GIT_COMPLETION ]]; then 193 if [[ -f $OSX_GIT_COMPLETION ]]; then
176 source $OSX_GIT_COMPLETION 194 source $OSX_GIT_COMPLETION
177 fi 195 fi
178 local OSX_GIT_PROMPT=`xcode-select -p`/usr/share/git-core/git-prompt.sh 196 OSX_GIT_PROMPT=`xcode-select -p`/usr/share/git-core/git-prompt.sh
179 if [[ -f $OSX_GIT_PROMPT ]]; then 197 if [[ -f $OSX_GIT_PROMPT ]]; then
180 source $OSX_GIT_PROMPT 198 source $OSX_GIT_PROMPT
181 fi 199 fi
182fi 200fi
183 201
184if [[ $(type -t __git_ps1) == function ]]; then
185 GIT_PS1_SHOWDIRTYSTATE=1 # Show unstaged and staged indicators
186 GIT_PS1_SHOWUNTRACKEDFILES=1 # show % for untracked files
187 # GIT_PS1_SHOWUPSTREAM=auto # show +/- changes with upstream
188 #PS1=$PS1'$(__git_ps1 " (%s)")'
189
190 # Alternatively, for a slightly faster prompt, __git_ps1 can be
191 # used for PROMPT_COMMAND in Bash with two parameters, <pre> and
192 # <post>, which are strings you would put in $PS1 before and after
193 # the status string generated by the git-prompt machinery.
194 export PROMPT_COMMAND="__git_ps1 '${PS1}' '${END_PS1}'; ${PROMPT_COMMAND}"
195fi
196
197# The Gemini earbuds don't sync the volume. This turns up the hardware volume control 202# The Gemini earbuds don't sync the volume. This turns up the hardware volume control
198alias geminiup="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeUp" 203alias geminiup="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeUp"
199alias geminidown="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeDown" 204alias geminidown="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeDown"
@@ -205,19 +210,6 @@ export MOZ_USE_XINPUT2=1
205#export GPG_TTY=$(tty) 210#export GPG_TTY=$(tty)
206export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" 211export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
207 212
208# Enable direnv (https://github.com/direnv/direnv/)
209DIRENV=`which direnv`
210if [[ -x $DIRENV ]]; then
211 eval "$(direnv hook bash)"
212fi
213show_virtual_env() {
214 if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
215 echo "($(basename $VIRTUAL_ENV))"
216 fi
217}
218export -f show_virtual_env
219PS1='$(show_virtual_env)'$PS1
220
221# Enable warpdir (https://rc4.net/wd-rs/) 213# Enable warpdir (https://rc4.net/wd-rs/)
222WARPDIR=`which warpdir` 214WARPDIR=`which warpdir`
223if [[ -x $WARPDIR ]]; then 215if [[ -x $WARPDIR ]]; then
@@ -230,5 +222,19 @@ if [[ -x $TERRAFORM ]]; then
230 complete -C $TERRAFORM terraform 222 complete -C $TERRAFORM terraform
231fi 223fi
232 224
225# If __git_ps1 is enabled, set that up.
226if [[ $(type -t __git_ps1) == function ]]; then
227 GIT_PS1_SHOWDIRTYSTATE=1 # Show unstaged and staged indicators
228 GIT_PS1_SHOWUNTRACKEDFILES=1 # show % for untracked files
229 # GIT_PS1_SHOWUPSTREAM=auto # show +/- changes with upstream
230 PS1=$PS1'$(__git_ps1 " (%s)")'
231
232 # Alternatively, for a slightly faster prompt, __git_ps1 can be
233 # used for PROMPT_COMMAND in Bash with two parameters, <pre> and
234 # <post>, which are strings you would put in $PS1 before and after
235 # the status string generated by the git-prompt machinery.
236 # DISABLED because this doesn't work with $(show_virtualenv)
237 #export PROMPT_COMMAND="__git_ps1 '${PS1}' '${END_PS1}'; ${PROMPT_COMMAND}"
238fi
233# Close off the PS1 with the $ 239# Close off the PS1 with the $
234PS1=${PS1}${END_PS1} 240PS1=${PS1}${END_PS1}