Commit b908feeb authored by Robby Russell's avatar Robby Russell
Browse files

Merge branch 'master' of github.com:robbyrussell/oh-my-zsh

parents e609fd5a d874c73f
...@@ -184,6 +184,7 @@ function vncviewer() { ...@@ -184,6 +184,7 @@ function vncviewer() {
# iTunes control function # iTunes control function
function itunes() { function itunes() {
local opt=$1 local opt=$1
local playlist=$2
shift shift
case "$opt" in case "$opt" in
launch|play|pause|stop|rewind|resume|quit) launch|play|pause|stop|rewind|resume|quit)
...@@ -200,6 +201,19 @@ function itunes() { ...@@ -200,6 +201,19 @@ 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
;; ;;
playlist)
# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
if [[ ! -z "$playlist" ]]; then
osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
if [[ $? -eq 0 ]]; then
opt="play"
else
opt="stop"
fi
else
opt="set allPlaylists to (get name of every playlist)"
fi
;;
playing|status) playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'` local state=`osascript -e 'tell application "iTunes" to player state as string'`
if [[ "$state" = "playing" ]]; then if [[ "$state" = "playing" ]]; then
...@@ -250,6 +264,7 @@ EOF ...@@ -250,6 +264,7 @@ EOF
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 "\tplaying|status\tShow what song is currently playing in iTunes."
echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
;; ;;
...@@ -323,7 +338,7 @@ function spotify() { ...@@ -323,7 +338,7 @@ function spotify() {
if [ $# = 0 ]; then if [ $# = 0 ]; then
showHelp; showHelp;
else else
if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then if [ "$1" != "quit" ] && [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then
osascript -e 'tell application "Spotify" to activate' osascript -e 'tell application "Spotify" to activate'
sleep 2 sleep 2
fi fi
...@@ -413,9 +428,13 @@ function spotify() { ...@@ -413,9 +428,13 @@ function spotify() {
break ;; break ;;
"quit" ) "quit" )
cecho "Quitting Spotify."; if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then
osascript -e 'tell application "Spotify" to quit'; cecho "Spotify was not running."
exit 1 ;; else
cecho "Closing Spotify.";
osascript -e 'tell application "Spotify" to quit';
fi
break ;;
"next" ) "next" )
cecho "Going to next track." ; cecho "Going to next track." ;
...@@ -470,7 +489,7 @@ function spotify() { ...@@ -470,7 +489,7 @@ function spotify() {
"pos" ) "pos" )
cecho "Adjusting Spotify play position." cecho "Adjusting Spotify play position."
osascript -e "tell application \"Spotify\" to set player position to $2"; osascript -e "tell application \"Spotify\" to set player position to $2";
break;; break ;;
"status" ) "status" )
showStatus; showStatus;
......
# React Native # React Native plugin
**Maintainer:** [BilalBudhani](https://github.com/BilalBudhani) This plugin adds completion for [`react-native`](https://facebook.github.io/react-native/).
It also defines a few [aliases](#aliases) for the commands more frequently used.
### List of Aliases To enable, add `react-native` to your `plugins` array in your zshrc file:
Alias | React Native command ```zsh
------|--------------------- plugins=(... react-native)
**rnand** | *react-native run-android* ```
**rnios** | *react-native run-ios*
**rnios4s** | *react-native run-ios --simulator "iPhone 4s"*
**rnios5** | *react-native run-ios --simulator "iPhone 5"*
**rnios5s** | *react-native run-ios --simulator "iPhone 5s"*
## Aliases
| Alias | React Native command |
|:------------|:-----------------------------------------------|
| **rn** | `react-native` |
| **rns** | `react-native start` |
| **rnlink** | `react-native link` |
| _App testing_ |
| **rnand** | `react-native run-android` |
| **rnios** | `react-native run-ios` |
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
...@@ -3,12 +3,21 @@ ...@@ -3,12 +3,21 @@
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'init:<ProjectName> generates a new project and installs its dependencies'
'android:creates an empty android project'
'start:starts the webserver' 'start:starts the webserver'
'bundle:builds the javascript bundle for offline use' 'run-ios:builds your app and starts it on iOS simulator'
'new-library:generates a native library bridge'
'android:generates an Android project for your app'
'run-android:builds your app and starts it on a connected Android emulator or device' 'run-android:builds your app and starts it on a connected Android emulator or device'
'upgrade:upgrade your apps template files to the latest version; run this after updating the react-native version in your package.json and running npm install' 'new-library:generates a native library bridge'
'bundle:builds the javascript bundle for offline use'
'unbundle:builds javascript as "unbundle" for offline use'
'link:[options] <packageName> links all native dependencies'
'unlink:[options] <packageName> unlink native dependency'
'install:[options] <packageName> install and link native dependencies'
'uninstall:[options] <packageName> uninstall and unlink native dependencies'
"upgrade:upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install"
'log-android:starts adb logcat'
'log-ios:starts iOS device syslog tail'
) )
......
alias rn='react-native'
alias rns='react-native start'
alias rnlink='react-native link'
alias rnand='react-native run-android' alias rnand='react-native run-android'
alias rnios='react-native run-ios'
alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios6='react-native run-ios --simulator "iPhone 6"' alias rnios6='react-native run-ios --simulator "iPhone 6"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"' alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
alias rnios='react-native run-ios'
alias rnlink='react-native link'
...@@ -152,10 +152,10 @@ Y_opts=( ...@@ -152,10 +152,10 @@ Y_opts=(
"-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/" "-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/"
"-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]" "-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]"
"-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/" "-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/"
"-Yinfer-argument-types[Infer types for arguments of overriden methods]" "-Yinfer-argument-types[Infer types for arguments of overridden methods]"
"-Yinline[Perform inlining when possible]" "-Yinline[Perform inlining when possible]"
"-Yinline-handlers[Perform exception handler inlining when possible]" "-Yinline-handlers[Perform exception handler inlining when possible]"
"-Yinline-warnings[Emit inlining warnings (normally surpressed due to high volume)]" "-Yinline-warnings[Emit inlining warnings (normally suppressed due to high volume)]"
"-Yinvalidate+[Invalidate classpath entry before run]:classpath entry" "-Yinvalidate+[Invalidate classpath entry before run]:classpath entry"
"-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)" "-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)"
"-Ylog-classpath[Output information about what classpath is being applied]" "-Ylog-classpath[Output information about what classpath is being applied]"
......
#Alias for Zypper according to the offical Zypper's alias #Alias for Zypper according to the official Zypper's alias
#Main commands #Main commands
alias z='sudo zypper' #call zypper alias z='sudo zypper' #call zypper
...@@ -51,7 +51,7 @@ alias zrr='sudo zypper rr' #remove repositories ...@@ -51,7 +51,7 @@ alias zrr='sudo zypper rr' #remove repositories
alias zas='sudo zypper as' #adds a service specified by URI to the system alias zas='sudo zypper as' #adds a service specified by URI to the system
alias zms='sudo zypper ms' #modify properties of specified services alias zms='sudo zypper ms' #modify properties of specified services
alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task
alias zrs='sudo zypper rs' #remove specified repository index service from the sytem alias zrs='sudo zypper rs' #remove specified repository index service from the system
alias zls='sudo zypper ls' #list services defined on the system alias zls='sudo zypper ls' #list services defined on the system
#Package Locks Management commands #Package Locks Management commands
......
...@@ -98,7 +98,7 @@ __push() { ...@@ -98,7 +98,7 @@ __push() {
'-token=[(token) Atlas API token to use to authorize the upload. If blank or unspecified, the ATLAS_TOKEN environmental variable will be used.]' \ '-token=[(token) Atlas API token to use to authorize the upload. If blank or unspecified, the ATLAS_TOKEN environmental variable will be used.]' \
'-var=[("foo=bar") Set the value of a variable for the Terraform configuration.]' \ '-var=[("foo=bar") Set the value of a variable for the Terraform configuration.]' \
'-var-file=[(foo) Set the value of variables using a variable file.]' \ '-var-file=[(foo) Set the value of variables using a variable file.]' \
'-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are comitted to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]' '-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are committed to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]'
} }
__refresh() { __refresh() {
......
...@@ -10,7 +10,7 @@ By now you already can guess almost all aliases ...@@ -10,7 +10,7 @@ By now you already can guess almost all aliases
There are two exeptions since ... There are two exeptions since ...
agu = sudo Apt-Get Update - we have ... agu = sudo Apt-Get Update - we have ...
agug = sudo Apt-Get UpGrade - as the exeptional 4 letter alias for a single command. agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command.
afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command. afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command.
......
...@@ -69,7 +69,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' ...@@ -69,7 +69,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
# apt-add-repository with automatic install/upgrade of the desired package # apt-add-repository with automatic install/upgrade of the desired package
# Usage: aar ppa:xxxxxx/xxxxxx [packagename] # Usage: aar ppa:xxxxxx/xxxxxx [packagename]
# If packagename is not given as 2nd argument the function will ask for it and guess the default by taking # If packagename is not given as 2nd argument the function will ask for it and guess the default by taking
# the part after the / from the ppa name wich is sometimes the right name for the package you want to install # the part after the / from the ppa name which is sometimes the right name for the package you want to install
aar() { aar() {
if [ -n "$2" ]; then if [ -n "$2" ]; then
PACKAGE=$2 PACKAGE=$2
......
...@@ -15,6 +15,7 @@ function web_search() { ...@@ -15,6 +15,7 @@ function web_search() {
github "https://github.com/search?q=" github "https://github.com/search?q="
baidu "https://www.baidu.com/s?wd=" baidu "https://www.baidu.com/s?wd="
ecosia "https://www.ecosia.org/search?q=" ecosia "https://www.ecosia.org/search?q="
goodreads "https://www.goodreads.com/search?q="
) )
# check whether the search engine is supported # check whether the search engine is supported
...@@ -47,6 +48,7 @@ alias yandex='web_search yandex' ...@@ -47,6 +48,7 @@ alias yandex='web_search yandex'
alias github='web_search github' alias github='web_search github'
alias baidu='web_search baidu' alias baidu='web_search baidu'
alias ecosia='web_search ecosia' alias ecosia='web_search ecosia'
alias goodreads='web_search goodreads'
#add your own !bang searches here #add your own !bang searches here
alias wiki='web_search duckduckgo \!w' alias wiki='web_search duckduckgo \!w'
......
...@@ -125,7 +125,7 @@ ENVIRONMENT ...@@ -125,7 +125,7 @@ ENVIRONMENT
Directories must be full paths without trailing slashes. Directories must be full paths without trailing slashes.
The environment variable $_Z_OWNER can be set to your username, to The environment variable $_Z_OWNER can be set to your username, to
allow usage of z when your sudo enviroment keeps $HOME set. allow usage of z when your sudo environment keeps $HOME set.
FILES FILES
Data is stored in $HOME/.z. This can be overridden by setting the Data is stored in $HOME/.z. This can be overridden by setting the
......
...@@ -151,7 +151,7 @@ directory trees to exclude from tracking. \fB$HOME\fR is always excluded. ...@@ -151,7 +151,7 @@ directory trees to exclude from tracking. \fB$HOME\fR is always excluded.
Directories must be full paths without trailing slashes. Directories must be full paths without trailing slashes.
.P .P
The environment variable \fB$_Z_OWNER\fR can be set to your username, to The environment variable \fB$_Z_OWNER\fR can be set to your username, to
allow usage of \fBz\fR when your sudo enviroment keeps \fB$HOME\fR set. allow usage of \fBz\fR when your sudo environment keeps \fB$HOME\fR set.
.SH .SH
FILES FILES
Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the
......
...@@ -27,7 +27,7 @@ else ...@@ -27,7 +27,7 @@ else
fi fi
# git settings # git settings
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:" ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
...@@ -17,7 +17,7 @@ setopt prompt_subst ...@@ -17,7 +17,7 @@ setopt prompt_subst
autoload -U add-zsh-hook autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
#use extended color pallete if available #use extended color palette if available
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
turquoise="%F{81}" turquoise="%F{81}"
orange="%F{166}" orange="%F{166}"
......
...@@ -61,7 +61,7 @@ cmd_exec_time() { ...@@ -61,7 +61,7 @@ cmd_exec_time() {
[ $elapsed -gt 5 ] && echo ${elapsed}s [ $elapsed -gt 5 ] && echo ${elapsed}s
} }
# Get the intial timestamp for cmd_exec_time # Get the initial timestamp for cmd_exec_time
# #
preexec() { preexec() {
cmd_timestamp=`date +%s` cmd_timestamp=`date +%s`
......
...@@ -19,7 +19,7 @@ setopt prompt_subst ...@@ -19,7 +19,7 @@ setopt prompt_subst
autoload -U add-zsh-hook autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
#use extended color pallete if available #use extended color palette if available
if [[ $terminfo[colors] -ge 256 ]]; then if [[ $terminfo[colors] -ge 256 ]]; then
turquoise="%F{81}" turquoise="%F{81}"
orange="%F{166}" orange="%F{166}"
......
...@@ -36,7 +36,7 @@ local c12=$(printf "\e[38;5;142m\e[1m") ...@@ -36,7 +36,7 @@ local c12=$(printf "\e[38;5;142m\e[1m")
local c13=$(printf "\e[38;5;196m\e[1m") local c13=$(printf "\e[38;5;196m\e[1m")
# We dont want to use the extended colorset in the TTY / VC. # We don't want to use the extended colorset in the TTY / VC.
if [ "$TERM" = "linux" ]; then if [ "$TERM" = "linux" ]; then
c1=$( printf "\e[34;1m") c1=$( printf "\e[34;1m")
c2=$( printf "\e[35m") c2=$( printf "\e[35m")
...@@ -71,7 +71,7 @@ prompt_jnrowe_precmd () { ...@@ -71,7 +71,7 @@ prompt_jnrowe_precmd () {
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
> ' > '
# modified, to be commited # modified, to be committed
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment