|
1 |
| -# rvm-prompt supplied with rvm is very slow, here's my faster alternative: |
2 |
| -function __fast_rvm_ps1() { |
3 |
| - rubybin=$(command -v ruby) |
4 |
| - if [[ "${rubybin/rvm/}" != "$rubybin" ]] ; then |
5 |
| - withoutprefix="${rubybin/*rubies\//}" |
6 |
| - justversion="${withoutprefix/\/*}" |
7 |
| - echo "$justversion " |
8 |
| - fi |
9 |
| -} |
| 1 | +# Expand ** in filenames to recursive match |
| 2 | +shopt -s globstar |
| 3 | + |
| 4 | +export EDITOR=/usr/bin/vim |
10 | 5 |
|
11 | 6 | # export GIT_PS1_SHOWUPSTREAM=auto
|
12 | 7 | # export GIT_PS1_SHOWUPSTREAM=verbose
|
13 | 8 | # export GIT_PS1_SHOWUNTRACKEDFILES=1
|
14 | 9 | # export GIT_PS1_SHOWSTASHSTATE=1
|
15 |
| -# export GIT_PS1_SHOWDIRTYSTATE=1 |
16 |
| -. /usr/local/git/contrib/completion/git-completion.bash |
| 10 | +export GIT_PS1_SHOWDIRTYSTATE=1 |
| 11 | +if [ -f /usr/lib/git-core/git-sh-prompt ] ; then |
| 12 | + . /usr/lib/git-core/git-sh-prompt |
| 13 | +elif [ -f /usr/share/git-core/contrib/completion/git-prompt.sh ] ; then |
| 14 | + . /usr/share/git-core/contrib/completion/git-prompt.sh |
| 15 | +fi |
17 | 16 |
|
18 | 17 | # Set the prompt
|
19 | 18 | #export PS1='\[\e[0;32m\]\u@\h \[\e[1;32m\]\w\[\e[0;32m\] \$\[\e[0m\] '
|
20 |
| -export PS1='$(__fast_rvm_ps1)\u@\h \w$(__git_ps1) \$ ' |
| 19 | +if [[ "$(type -t __git_ps1)" == 'function' ]] ; then |
| 20 | +# export PS1='\u@\h \w$(__git_ps1) \$ ' |
| 21 | + PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]" " \$ "' |
| 22 | +#else |
| 23 | +# export PS1='\u@\h \w \$ ' |
| 24 | +fi |
| 25 | + |
| 26 | +if [ -f /usr/local/bin/kubectl ] ; then |
| 27 | + . <(kubectl completion bash) |
| 28 | +fi |
21 | 29 |
|
22 | 30 | # ls colors on macos
|
23 | 31 | export CLICOLOR=1
|
24 | 32 |
|
25 |
| -# turn on grep colors |
26 |
| -export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' |
27 |
| - |
28 | 33 | # turn on timestamps in bash history
|
29 | 34 | export HISTTIMEFORMAT='%F %T '
|
30 | 35 |
|
31 |
| -if [ -f /Applications/MacVim.app/Contents/MacOS/Vim ] ; then |
32 |
| - export EDITOR=/Applications/MacVim.app/Contents/MacOS/Vim |
33 |
| -fi |
| 36 | +# don't add command-line to history if it starts with 3 spaces |
| 37 | +export HISTIGNORE=" *" |
| 38 | + |
| 39 | +# Colours for less(1). This is taken from a standard /etc/profile.d/less.sh on |
| 40 | +# a modern Linux. |
| 41 | +export LESS_TERMCAP_mb=$'\E[01;31m' |
| 42 | +export LESS_TERMCAP_md=$'\E[01;38;5;208m' |
| 43 | +export LESS_TERMCAP_me=$'\E[0m' |
| 44 | +export LESS_TERMCAP_se=$'\E[0m' |
| 45 | +export LESS_TERMCAP_ue=$'\E[0m' |
| 46 | +export LESS_TERMCAP_us=$'\E[04;38;5;111m' |
| 47 | + |
| 48 | +alias ls='ls --color' |
| 49 | +alias ll='ls -la' |
| 50 | +alias grep='grep --color=auto' |
34 | 51 |
|
35 |
| -function sumcolumn () { |
36 |
| - awk -f <(echo ' |
37 |
| -# Sum up numerical values by column (white-space separated) |
38 |
| -# |
39 |
| -# Usage: $0 [file ...] |
40 |
| -# |
41 |
| -# stern, 1999-2005 |
42 |
| -# from http://stackoverflow.com/questions/295781/shortest-command-to-calculate-the-sum-of-a-column-of-output-on-unix |
43 |
| - |
44 |
| -{ |
45 |
| - for(i = 1; i <= NF; ++i) { |
46 |
| - scale = 1 |
47 |
| - if ($i ~ /[kK]$/) { scale = 1000 } |
48 |
| - if ($i ~ /[mM]$/) { scale = 1000*1000 } |
49 |
| - if ($i ~ /[gG]$/) { scale = 1000*1000*1000 } |
50 |
| - col[i] += scale * $i; |
51 |
| - } |
52 |
| - if (NF > maxnf) maxnf = NF; |
53 |
| -} |
54 |
| - |
55 |
| -END { |
56 |
| - for(i = 1; i <= maxnf; ++i) { printf " %.10g", col[i] } |
57 |
| - print ""; |
58 |
| -}') $* |
59 |
| -} |
| 52 | +. ~/dotfiles/bash/functions |
| 53 | + |
| 54 | +# Go |
| 55 | +export PATH=$PATH:/usr/local/go/bin |
| 56 | + |
| 57 | +if [ -x "${HOME}/.local/bin/wsl-ssh-agent-relay" ] ; then |
| 58 | + ${HOME}/.local/bin/wsl-ssh-agent-relay start |
| 59 | + export SSH_AUTH_SOCK=${HOME}/.ssh/wsl-ssh-agent.sock |
| 60 | +fi |
0 commit comments