Merge remote-tracking branch 'upstream/master'

This commit is contained in:
root 2015-09-28 01:10:02 +00:00
commit 5b56da4c44
5 changed files with 53 additions and 7 deletions

View file

@ -1,6 +1,28 @@
if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then # chucknorris: Chuck Norris fortunes
strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat
# Automatically generate or update Chuck's compiled fortune data file
# $0 must be used outside a local function. This variable name is unlikly to collide.
CHUCKNORRIS_PLUGIN_DIR=${0:h}
() {
local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes
if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
local strfile=strfile
if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then
strfile=/usr/sbin/strfile
fi
if which $strfile &> /dev/null; then
$strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null
else
echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
fi
fi fi
alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes" # Aliases
alias chuck="fortune -a $DIR"
alias chuck_cow="chuck | cowthink" alias chuck_cow="chuck | cowthink"
}
unset CHUCKNORRIS_PLUGIN_DIR

View file

@ -84,6 +84,7 @@ alias gcs='git commit -S'
alias gd='git diff' alias gd='git diff'
alias gdca='git diff --cached' alias gdca='git diff --cached'
alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdt='git diff-tree --no-commit-id --name-only -r'
gdv() { git diff -w "$@" | view - } gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff compdef _git gdv=git-diff

View file

@ -167,6 +167,17 @@ function itunes() {
vol) vol)
opt="set sound volume to $1" #$1 Due to the shift opt="set sound volume to $1" #$1 Due to the shift
;; ;;
playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'`
if [[ "$state" = "playing" ]]; then
currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
echo -E "Listening to $fg[yellow]$currenttrack$reset_color by $fg[yellow]$currentartist$reset_color";
else
echo "iTunes is" $state;
fi
return 0
;;
shuf|shuff|shuffle) shuf|shuff|shuffle)
# The shuffle property of current playlist can't be changed in iTunes 12, # The shuffle property of current playlist can't be changed in iTunes 12,
# so this workaround uses AppleScript to simulate user input instead. # so this workaround uses AppleScript to simulate user input instead.
@ -205,6 +216,7 @@ EOF
echo "\tnext|previous\tplay next or previous track" echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol\tSet the volume, takes an argument from 0 to 100" echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\tplaying|status\tShow what song is currently playing in iTunes."
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
;; ;;

View file

@ -1,5 +1,3 @@
# Sublime Text 2 Aliases
if [[ $('uname') == 'Linux' ]]; then if [[ $('uname') == 'Linux' ]]; then
local _sublime_linux_paths > /dev/null 2>&1 local _sublime_linux_paths > /dev/null 2>&1
_sublime_linux_paths=( _sublime_linux_paths=(
@ -33,7 +31,6 @@ elif [[ "$OSTYPE" = darwin* ]]; then
"$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
) )
for _sublime_path in $_sublime_darwin_paths; do for _sublime_path in $_sublime_darwin_paths; do
if [[ -a $_sublime_path ]]; then if [[ -a $_sublime_path ]]; then
subl () { "$_sublime_path" $* } subl () { "$_sublime_path" $* }
@ -43,4 +40,18 @@ elif [[ "$OSTYPE" = darwin* ]]; then
done done
fi fi
elif [[ "$OSTYPE" = 'cygwin' ]]; then
local _sublime_cygwin_paths > /dev/null 2>&1
_sublime_cygwin_paths=(
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
)
for _sublime_path in $_sublime_cygwin_paths; do
if [[ -a $_sublime_path ]]; then
subl () { "$_sublime_path" $* }
alias st=subl
break
fi
done
alias stt='st .' alias stt='st .'

View file

@ -20,7 +20,7 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
if [ -e ~/.rvm/bin/rvm-prompt ]; then if [ -e ~/.rvm/bin/rvm-prompt ]; then
RPROMPT='%{$fg_bold[red]%}$(~/.rvm/bin/rvm-prompt i v)%{$reset_color%}' RPROMPT='%{$fg_bold[red]%}$(rvm_current)%{$reset_color%}'
else else
if which rbenv &> /dev/null; then if which rbenv &> /dev/null; then
RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}' RPROMPT='%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}'