Commits

Ches Martin committed db52e36

Commit long-used change from RVM to chruby heart

Plus some general clean-up of bash init

  • Participants
  • Parent commits 864991a

Comments (0)

Files changed (3)

.bash.d/completion.sh

 # Completion
 #
 
+# enable command and file completion after sudo
+complete -f -c sudo
+
 if [ -f /etc/bash_completion ]; then
     source /etc/bash_completion
 elif [ -f /usr/local/etc/bash_completion ]; then # OS X Homebrew
     source /usr/local/etc/bash_completion
 fi
 
-source ~/.bash.d/completion-django.sh
-source ~/.bash.d/completion-knife.sh
-source ~/.bash.d/completion-hg.sh
-source ~/.bash.d/completion-VBoxManage.sh
+for f in ~/.bash.d/completion-*.sh; do
+    source $f
+done
 
 if installed aws_completer; then
     complete -C aws_completer aws
  
 complete -o default -W "${SSH_CONFIG_HOSTS[*]}" ssh
 
-# enable command and file completion after sudo
-complete -f -c sudo
+# chruby allows fuzzy matching, but the listing is convenient.
+# See evolution: https://github.com/postmodern/chruby/issues/27
+__complete_chruby() {
+    local cur rubie basenames
+    typeset -a basenames
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    for ruby in ${RUBIES[@]}; do
+        basenames+=($(basename $ruby))
+    done
+    COMPREPLY=( $(compgen -W "${basenames[*]}" -- ${cur}) )
+}
+complete -F __complete_chruby chruby
+

.bash.d/prompt.sh

     fi
 }
 
-# Append history immediately so other open shells can use it
-export PROMPT_COMMAND='history -a; prompt_func'
+export PROMPT_COMMAND="$PROMPT_COMMAND; prompt_func"
 
 #
 # Bash history
 #
+bind Space:magic-space  # auto-expand history magic
+shopt -s histappend     # make sure hist is kept across sessions
 export HISTCONTROL=erasedups
 export HISTSIZE=5000
-shopt -s histappend     # make sure hist is kept across sessions
-bind Space:magic-space  # auto-expand history magic
+export PROMPT_COMMAND='history -a'  # Append immediately so new shells can use it
 
 # for the love of god don't offer to autocomplete this shit
 export FIGNORE="#:~:DS_Store:.pyc:.swp:.swo"
 export EDITOR=vim
 export VISUAL=vim
 
-#
 # PATH Settings, clearly
 # Don't need any additions at the moment
-#
-# if [ -f ~/.bash.d/paths.sh ]; then
-#     . ~/.bash.d/paths.sh
-# fi
+# [[ -r ~/.bash.d/paths.sh ]] && source ~/.bash.d/paths.sh
 
-#
 # Simple check for an interactive shell -- don't do anything else if not.
 # So, make PATH additions and stuff before this.
-#
 [ -z "$PS1" ] && return
 
-#
 # 'cd' to children of a host of directories, as if they were always in CWD
-#
-export CDPATH=:~:~/src:~/src/work/railsmachine
+export CDPATH=:~:~/src
 
-#
-# A man's prompt is his castle, or something.
-#
-if [ -f ~/.bash.d/prompt.sh ]; then
-    . ~/.bash.d/prompt.sh
-fi
-
-#
 # Directory listings in Technicolor
-#
 export CLICOLOR='true'
 export LSCOLORS="gxfxcxdxbxegedabagacad"
 
 #
 export PAGER="/usr/bin/less"
 export LESS="-Ri"
-export LESSOPEN="|lesspipe.sh %s"
-
-#
-# Functions for great justice
-#
-if [ -f ~/.bash.d/functions.sh ]; then
-	. ~/.bash.d/functions.sh
+if command -v lesspipe.sh >/dev/null; then
+    export LESSOPEN="|lesspipe.sh %s"
 fi
 
-#
+# A man's prompt is his castle, or something.
+[[ -r ~/.bash.d/prompt.sh ]] && source ~/.bash.d/prompt.sh
+
+# Functions for great justice
+[[ -r ~/.bash.d/functions.sh ]] && source ~/.bash.d/functions.sh
+
 # And aliases for all mankind
-#
-if [ -f ~/.bash.d/aliases.sh ]; then
-    . ~/.bash.d/aliases.sh
-fi
+[[ -r ~/.bash.d/aliases.sh ]] && source ~/.bash.d/aliases.sh
 
-#
 # Completion
-#
-if [ -f ~/.bash.d/completion.sh ]; then
-    . ~/.bash.d/completion.sh
-fi
+[[ -r ~/.bash.d/completion.sh ]] && source ~/.bash.d/completion.sh
 
 # ====================================================
 # =         App- and Platform-specific Bits          =
 export PIP_VIRTUALENV_BASE=$WORKON_HOME
 export PIP_RESPECT_VIRTUALENV=true
 
-# Ruby Version Manager
-[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
-[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion
-PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
-
-export JRUBY_HOME=$HOME/.rvm/rubies/jruby-1.6.7.2
+# Ruby Version Switching
+# brew install chruby ruby-install
+# Well put: http://pbrisbin.com/posts/chruby
+if [ -x /usr/local/opt/chruby ]; then
+    source /usr/local/opt/chruby/share/chruby/chruby.sh
+    source /usr/local/opt/chruby/share/chruby/auto.sh
+fi
 
 # AWS credential management and env vars that the Java API tools want
 [[ -r ~/.aws/setup.sh ]] && source ~/.aws/setup.sh
     done
 fi
 
+# Travis gem
+[[ -r ~/.travis/travis.sh ]] && source ~/.travis/travis.sh
+