From c9da08664311b6f345f31667d2087ff56a099fb2 Mon Sep 17 00:00:00 2001 From: Robert R Evans Date: Wed, 6 Oct 2010 17:27:55 -0700 Subject: [PATCH] Removed custom.bash and am now completely ignoring all files within the custom directory. Started de-macify to provide more support for linux (thanks to alsemyonov on github). --- .gitignore | 3 +-- README.md | 5 ++++- bash_it.sh | 7 +++++++ completion/brew.completion.bash | 8 +++++--- custom/custom.bash | 4 ---- functions/base.funtions.bash | 8 ++++---- functions/git.functions.bash | 4 ++++ functions/javascript.functions.bash | 4 ++++ plugins/base.plugin.bash | 9 +++++++-- plugins/git.plugin.bash | 15 ++++++++++++++- themes/bobby/bobby.theme.bash | 2 +- 11 files changed, 51 insertions(+), 18 deletions(-) delete mode 100644 custom/custom.bash diff --git a/.gitignore b/.gitignore index 54f7202..7fd0489 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .DS_Store -custom/*.bash -!custom/example.bash \ No newline at end of file +custom/*.bash \ No newline at end of file diff --git a/README.md b/README.md index d00f526..2985cbf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ From what I remember, I've incorporated things I have found from the following: * oh-my-zsh (http://github.com/robbyrussell/oh-my-zsh) * Steve Losh (http://stevelosh.com/) -Includes some autocompletion tools, theming support, aliases, custom functions, and more. +Includes some autocompletion tools, theming support, aliases, custom functions, and more. ## Install @@ -30,6 +30,9 @@ rails-help git-help +## Your Custom scripts, aliases, and functions + +If you have custom stuff that you don't want committed to bash it, put those scripts into the custom directory. It is automatically ignored by git. ## Themes diff --git a/bash_it.sh b/bash_it.sh index 7717f5c..b588059 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -51,6 +51,13 @@ done export PS1=$PROMPT + +# Adding Support for other OSes +PREVIEW="less" +[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" +[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" + + # # Custom Help diff --git a/completion/brew.completion.bash b/completion/brew.completion.bash index 89c4646..a0d9819 100644 --- a/completion/brew.completion.bash +++ b/completion/brew.completion.bash @@ -1,3 +1,5 @@ -if [ -f `brew --prefix`/Library/Contributions/brew_bash_completion.sh ]; then - . `brew --prefix`/Library/Contributions/brew_bash_completion.sh -fi +if [ `which brew` ]; then + if [ -f `brew --prefix`/Library/Contributions/brew_bash_completion.sh ]; then + . `brew --prefix`/Library/Contributions/brew_bash_completion.sh + fi +fi \ No newline at end of file diff --git a/custom/custom.bash b/custom/custom.bash deleted file mode 100644 index caae863..0000000 --- a/custom/custom.bash +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Your Custom Bash alias', functions, etc. -# \ No newline at end of file diff --git a/functions/base.funtions.bash b/functions/base.funtions.bash index 4b41cce..d1f467d 100644 --- a/functions/base.funtions.bash +++ b/functions/base.funtions.bash @@ -6,22 +6,22 @@ function ips { function myip { res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+') - echo "Your public IP is: ${bold_green} $res ${normal}" + echo "Your public IP is: ${bold_green} $res ${normal}" } # View man documentation in Preview pman () { - man -t "${1}" | open -f -a /Applications/Preview.app/ + man -t "${1}" | open -f -a $PREVIEW } pcurl() { - curl "${1}" | open -f -a /Applications/Preview.app/ + curl "${1}" | open -f -a $PREVIEW } pri() { - ri -T "${1}" | open -f -a /Applications/Preview.app/ + ri -T "${1}" | open -f -a $PREVIEW } diff --git a/functions/git.functions.bash b/functions/git.functions.bash index a2607aa..9843253 100644 --- a/functions/git.functions.bash +++ b/functions/git.functions.bash @@ -18,3 +18,7 @@ function git_remove_missing_files() { function local-ignore() { echo "$1" >> .git/info/exclude } + +function gitignore() { + echo ".DS_Store" >> .gitignore +} \ No newline at end of file diff --git a/functions/javascript.functions.bash b/functions/javascript.functions.bash index f37859d..2e0b56c 100644 --- a/functions/javascript.functions.bash +++ b/functions/javascript.functions.bash @@ -1,4 +1,8 @@ #!/bin/bash +# +# The install directory is hard-coded. TOOD: allow the directory to be specified on the command line. +# + function rails_jquery { curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index c256247..4984df8 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -3,9 +3,14 @@ # Desktop Programs alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'" alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'" -alias preview="open -a '/Applications/Preview.app'" +alias preview="open -a '$PREVIEW'" alias xcode="open -a '/Developer/Applications/Xcode.app'" alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'" alias safari="open -a safari" alias firefox="open -a firefox" -alias dashcode="open -a dashcode" \ No newline at end of file +alias dashcode="open -a dashcode" + + +if [ -s /usr/bin/firefox ] ; then + unalias firefox +fi \ No newline at end of file diff --git a/plugins/git.plugin.bash b/plugins/git.plugin.bash index 24e9e76..13ce234 100644 --- a/plugins/git.plugin.bash +++ b/plugins/git.plugin.bash @@ -7,7 +7,6 @@ alias gs='git status' alias gl='git pull' alias gup='git fetch && git rebase' alias gp='git push' -alias gd='git diff | mate' alias gdv='git diff -w "$@" | vim -R -' alias gc='git commit -v' alias gca='git commit -v -a' @@ -16,6 +15,20 @@ alias gba='git branch -a' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' +case $OSTYPE in + linux*) + alias gd='git diff | vim -R -' + ;; + darwin*) + alias gd='git diff | mate' + ;; + darwin*) + alias gd='git diff' + ;; +esac + + + function git-help() { echo "Git Custom Aliases Usage" echo diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index 8f57536..52b6800 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -1,7 +1,7 @@ #!/bin/bash # prompt themeing -PROMPT='\n${bold_blue}$(prompt_char)$(git_prompt_info) ${orange}\h ${reset_color}in ${green}\w ${reset_color}→ ' +PROMPT='${bold_blue}$(prompt_char)$(git_prompt_info) ${orange}\h ${reset_color}in ${green}\w ${reset_color}→ ' # git themeing GIT_THEME_PROMPT_DIRTY=" ${red}✗" -- 2.17.1