diff options
| author | jason | 2022-07-05 15:23:32 -0600 |
|---|---|---|
| committer | jason | 2022-07-05 15:23:32 -0600 |
| commit | 9daa2b5aa785237d2265219c462e79d22c1c0e63 (patch) | |
| tree | 489ce55004bada519f54d8bc33913bc6dbed04b5 /bash | |
| parent | 14a4a7de50b44920728f3746276d899a6df771c2 (diff) | |
| download | dotfiles-9daa2b5aa785237d2265219c462e79d22c1c0e63.tar.gz dotfiles-9daa2b5aa785237d2265219c462e79d22c1c0e63.zip | |
include support for git-prompt and git bash completion on os x
Diffstat (limited to 'bash')
| -rw-r--r-- | bash/.bashrc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/bash/.bashrc b/bash/.bashrc index 06a4c4a..01e5e04 100644 --- a/bash/.bashrc +++ b/bash/.bashrc | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | LC_ALL="en_US.UTF-8" | 1 | LC_ALL="en_US.UTF-8" |
| 2 | PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]\$\[\e[m\] " | 2 | # This PS1 is completed at the end, allowing statuses to be included between the directory and closing $ |
| 3 | PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]" | ||
| 4 | local END_PS1="\$\[\e[m\] " | ||
| 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\] " | ||
| 3 | PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" | 7 | PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" |
| 4 | 8 | ||
| 5 | # Disable bash deprecation warning on OS X | 9 | # Disable bash deprecation warning on OS X |
| @@ -157,6 +161,7 @@ alias define='sdcv' | |||
| 157 | 161 | ||
| 158 | # Git Related | 162 | # Git Related |
| 159 | function delete-branches() { | 163 | function delete-branches() { |
| 164 | # Interactive branch deleter | ||
| 160 | git branch | | 165 | git branch | |
| 161 | grep --invert-match '\*' | | 166 | grep --invert-match '\*' | |
| 162 | cut -c 3- | | 167 | cut -c 3- | |
| @@ -164,6 +169,31 @@ function delete-branches() { | |||
| 164 | xargs --no-run-if-empty git branch --delete --force | 169 | xargs --no-run-if-empty git branch --delete --force |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 172 | local XCODE_SELECT=`which xcode-select` | ||
| 173 | if [[ -x $XCODE_SELECT ]]; then | ||
| 174 | local OSX_GIT_COMPLETION=`xcode-select -p`/usr/share/git-core/git-completion.bash | ||
| 175 | if [[ -f $OSX_GIT_COMPLETION ]]; then | ||
| 176 | source $OSX_GIT_COMPLETION | ||
| 177 | fi | ||
| 178 | local OSX_GIT_PROMPT=`xcode-select -p`/usr/share/git-core/git-prompt.sh | ||
| 179 | if [[ -f $OSX_GIT_PROMPT ]]; then | ||
| 180 | source $OSX_GIT_PROMPT | ||
| 181 | fi | ||
| 182 | fi | ||
| 183 | |||
| 184 | if [[ $(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}" | ||
| 195 | fi | ||
| 196 | |||
| 167 | # The Gemini earbuds don't sync the volume. This turns up the hardware volume control | 197 | # The Gemini earbuds don't sync the volume. This turns up the hardware volume control |
| 168 | alias geminiup="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeUp" | 198 | alias geminiup="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeUp" |
| 169 | alias geminidown="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeDown" | 199 | alias geminidown="dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_7C_C4_EF_CC_45_43 org.bluez.MediaControl1.VolumeDown" |
| @@ -199,3 +229,6 @@ TERRAFORM=`which terraform` | |||
| 199 | if [[ -x $TERRAFORM ]]; then | 229 | if [[ -x $TERRAFORM ]]; then |
| 200 | complete -C $TERRAFORM terraform | 230 | complete -C $TERRAFORM terraform |
| 201 | fi | 231 | fi |
| 232 | |||
| 233 | # Close off the PS1 with the $ | ||
| 234 | PS1=${PS1}${END_PS1} | ||