diff --git a/README.textile b/README.textile index 4325c91e..09cff213 100644 --- a/README.textile +++ b/README.textile @@ -1,110 +1,111 @@ !https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png! -oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout... +@oh-my-zsh@ is an open source, community-driven framework for managing your "Zsh":http://www.zsh.org/ configuration. + +It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make you shout… bq. "OH MY ZSHELL!" h2. Setup -@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. +@oh-my-zsh@ should work with any recent release of "Zsh":http://www.zsh.org/. The minimum recommended version is *4.3.9*. -h3. The automatic installer... (do you trust me?) +If not already installed, you can install "Zsh":http://www.zsh.org/ using the command-line. -You can install this via the command line with either `curl` or `wget`. +h3. The automatic installer… do you trust me? -h4. via `curl` +You can install this via the command-line with either @curl@ or @wget@. + +h4. via @curl@: @curl -L http://install.ohmyz.sh | sh@ -h4. via `wget` +h4. via @wget@: @wget --no-check-certificate http://install.ohmyz.sh -O - | sh@ -h4. Optional: change the install directory +h4. *Optionally*, change the install directory: -The default location is `~/.oh-my-zsh` (hidden in your home directory). +The default location is @~/.oh-my-zsh@ (hidden in your home directory). -You can change the install directory with the ZSH environment variable, either -by running `export ZSH=/your/path` before installing, or setting it before the -end of the install pipeline like this: +You can change the install directory with the @ZSH@ environment variable, either by running @export ZSH=/your/path@ before installing, or by setting it before the end of the install pipeline like this: @curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh@ - h3. The manual way -1. Clone the repository +1. Clone the repository: - @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ +@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ -2. *OPTIONAL* Backup your existing ~/.zshrc file +2. *Optionally*, backup your existing @~/.zshrc@ file: - @cp ~/.zshrc ~/.zshrc.orig@ +@cp ~/.zshrc ~/.zshrc.orig@ -3. Create a new zsh config by copying the zsh template we've provided. +3. Create a new "Zsh":http://www.zsh.org/ config file by copying the "Zsh":http://www.zsh.org/ template we've provided: - @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ +@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ -4. Set zsh as your default shell: +4. Set "Zsh":http://www.zsh.org/ as your default shell: - @chsh -s /bin/zsh@ +@chsh -s /bin/zsh@ -5. Start / restart zsh (open a new terminal is easy enough...) +5. Start or restart "Zsh":http://www.zsh.org/ by opening a new command-line window. h3. Problems? -You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_. +You _might_ need to modify your @PATH@ in @~/.zshrc@ if you're not able to find some commands after switching to @oh-my-zsh@. -If you installed manually or changed the install location, check ZSH in ~/.zshrc +If you installed manually or changed the install location, check the @ZSH@ environment variable in @~/.zshrc@. h2. Usage -* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's possible) +* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's available) ** example: @plugins=(git osx ruby)@ -* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. -** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. -* much much more... take a look at @lib/@ what _Oh My Zsh_ offers... +* theme support: change the @ZSH_THEME@ environment variable in @~/.zshrc@ +** take a look at the @themes/@ directory and the "wiki":https://wiki.github.com/robbyrussell/oh-my-zsh/themes to see what comes bundled with @oh-my-zsh@ +* & much, much more… take a look at the @lib/@ directory to see what @oh-my-zsh@ has to offer… h2. Useful -the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips. +The "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty useful for tips. h3. Customization -If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. -If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. -If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. +If you want to override any of the default behaviors, just add a new file (ending in @.zsh@) in the @custom/@ directory. + +If you have many functions that go well together, you can put them as a @*.plugin.zsh@ file in the @custom/plugins/@ directory and then enable this plugin (see '"Usage":https://github.com/robbyrussell/oh-my-zsh#usage' above). + +If you would like to override the functionality of a plugin distributed with @oh-my-zsh@, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. h3. Updates -By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc +By default you will be prompted to check for upgrades. If you would like @oh-my-zsh@ to automatically upgrade itself without prompting you, set the following in your @~/.zshrc@: @DISABLE_UPDATE_PROMPT=true@ -To disable updates entirely, put this in your ~/.zshrc +To disable upgrades entirely, set the following in your @~/.zshrc@: @DISABLE_AUTO_UPDATE=true@ -To upgrade directly from the command line, just run @upgrade_oh_my_zsh@ +To upgrade directly from the command-line, just run @upgrade_oh_my_zsh@. h3. Uninstalling -If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). +If you want to uninstall @oh-my-zsh@, just run @uninstall_oh_my_zsh@ from the command-line and it'll remove itself and revert you to @bash@ (or your previous "Zsh":http://www.zsh.org/ configuration). h2. Help out! -I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! +I'm far from being a "Zsh":http://www.zsh.org/ expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! -h3. (Don't) Send us your theme! (for now) +h3. (Don't) send us your theme (for now)! --I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.- +-I'm hoping to collect a bunch of themes – you can see existing ones in the @themes/@ directory.- -We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there. +We have enough themes for the time being. Please fork the project and add on in there – you can let people know how to grab it from there. h2. Contributors -This project wouldn't exist without all of our awesome users and contributors. - -* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors +This project wouldn't exist without all of our awesome users and contributors: "view our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors Thank you so much! diff --git a/cache/.easter-egg b/cache/.easter-egg new file mode 100644 index 00000000..4b6164ed --- /dev/null +++ b/cache/.easter-egg @@ -0,0 +1,4 @@ +This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it. + +Feel free to add love notes for people here. + diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 3044c966..aae86504 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -30,7 +30,6 @@ alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh' -alias sl=ls # often screw this up alias afind='ack-grep -il' diff --git a/lib/completion.zsh b/lib/completion.zsh index c54249c5..3a19a4eb 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +if [ "$OSTYPE[0,7]" = "solaris" ] +then + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" +fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories @@ -44,7 +49,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \ operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \ rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \ - usbmux uucp vcsa wwwrun xfs + usbmux uucp vcsa wwwrun xfs '_*' # ... unless we really want to. zstyle '*' single-ignored show diff --git a/lib/correction.zsh b/lib/correction.zsh index 47eb83b1..3e1415a0 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,13 +1,13 @@ -alias man='nocorrect man' -alias mv='nocorrect mv' -alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' -alias heroku='nocorrect heroku' -alias ebuild='nocorrect ebuild' -alias hpodder='nocorrect hpodder' -alias sudo='nocorrect sudo' - if [[ "$ENABLE_CORRECTION" == "true" ]]; then + alias ebuild='nocorrect ebuild' + alias gist='nocorrect gist' + alias heroku='nocorrect heroku' + alias hpodder='nocorrect hpodder' + alias man='nocorrect man' + alias mkdir='nocorrect mkdir' + alias mv='nocorrect mv' + alias mysql='nocorrect mysql' + alias sudo='nocorrect sudo' + setopt correct_all fi diff --git a/lib/directories.zsh b/lib/directories.zsh index 1896945f..02743e0c 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -1,5 +1,4 @@ # Changing/making/removing directory -setopt auto_name_dirs setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus diff --git a/lib/functions.zsh b/lib/functions.zsh index fda84a95..17f5f9cb 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { diff --git a/lib/git.zsh b/lib/git.zsh index 305a77af..748520a6 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,8 +1,8 @@ # get the name of the branch we are on function git_prompt_info() { - if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then + if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } @@ -10,23 +10,20 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { - local SUBMODULE_SYNTAX='' - local GIT_STATUS='' - local CLEAN_MESSAGE='nothing to commit (working directory clean)' - if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then + local STATUS='' + local FLAGS + FLAGS=('--porcelain') + if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then - SUBMODULE_SYNTAX="--ignore-submodules=dirty" + FLAGS+='--ignore-submodules=dirty' fi if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1) - else - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1) - fi - if [[ -n $GIT_STATUS ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + FLAGS+='--untracked-files=no' fi + STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) + fi + if [[ -n $STATUS ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi @@ -54,11 +51,19 @@ git_remote_status() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } +# Gets the number of commits ahead from remote +function git_commits_ahead() { + if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') + echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" + fi +} + # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" @@ -127,17 +132,19 @@ function git_compare_version() { INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); for i in {1..3}; do + if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then + echo 1 + return 0 + fi if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then echo -1 return 0 fi done - echo 1 + echo 0 } #this is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") #clean up the namespace slightly by removing the checker function unset -f git_compare_version - - diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9c0a430f..9d668160 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -34,6 +34,5 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -autoload -U add-zsh-hook -add-zsh-hook precmd omz_termsupport_precmd -add-zsh-hook preexec omz_termsupport_preexec +precmd_functions+=(omz_termsupport_precmd) +preexec_functions+=(omz_termsupport_preexec) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index a0409ad0..907e2f8d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,6 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh @@ -8,18 +8,20 @@ fi # add a function path fpath=($ZSH/functions $ZSH/completions $fpath) -# Load all of the config files in ~/oh-my-zsh that end in .zsh -# TIP: Add files you don't want in git to .gitignore -for config_file ($ZSH/lib/*.zsh); do - source $config_file -done - # Set ZSH_CUSTOM to the path where your custom config files # and plugins exists, or else we will use the default custom/ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" fi +# Load all of the config files in ~/oh-my-zsh that end in .zsh +# TIP: Add files you don't want in git to .gitignore +for config_file ($ZSH/lib/*.zsh); do + custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" + [ -f "${custom_config_file}" ] && config_file=${custom_config_file} + source $config_file +done + is_plugin() { local base_dir=$1 @@ -57,15 +59,17 @@ for plugin ($plugins); do done # Figure out the SHORT hostname -if [ -n "$commands[scutil]" ]; then - # OS X - SHORT_HOST=$(scutil --get ComputerName) +if [[ "$OSTYPE" = darwin* ]]; then + # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible. + SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} else SHORT_HOST=${HOST/.*/} fi # Save the location of the current completion dump file. -ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" +if [ -z "$ZSH_COMPDUMP" ]; then + ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" +fi # Load and run compinit autoload -U compinit diff --git a/plugins/adb/README.md b/plugins/adb/README.md new file mode 100644 index 00000000..075beec0 --- /dev/null +++ b/plugins/adb/README.md @@ -0,0 +1,8 @@ +# adb autocomplete plugin + +* Adds autocomplete options for all adb commands. + + +## Requirements + +In order to make this work, you will need to have the Android adb tools set up in your path. diff --git a/plugins/adb/_adb b/plugins/adb/_adb new file mode 100644 index 00000000..4c998172 --- /dev/null +++ b/plugins/adb/_adb @@ -0,0 +1,39 @@ +#compdef adb +#autoload + +# in order to make this work, you will need to have the android adb tools + +# adb zsh completion, based on homebrew completion + +local -a _1st_arguments +_1st_arguments=( +'bugreport:return all information from the device that should be included in a bug report.' +'connect:connect to a device via TCP/IP Port 5555 is default.' +'devices:list all connected devices' +'disconnect:disconnect from a TCP/IP device. Port 5555 is default.' +'emu:run emulator console command' +'forward:forward socket connections' +'help:show the help message' +'install:push this package file to the device and install it' +'jdwp:list PIDs of processes hosting a JDWP transport' +'logcat:View device log' +'pull:copy file/dir from device' +'push:copy file/dir to device' +'shell:run remote shell interactively' +'sync:copy host->device only if changed (-l means list but dont copy)' +'uninstall:remove this app package from the device' +'version:show version num' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "adb subcommand" _1st_arguments + return +fi + +_files diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index bffe9657..059884c2 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -21,10 +21,14 @@ if [[ -x `which yaourt` ]]; then alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") alias yaorph='yaourt -Qtd' # Remove orphans using yaourt # Additional yaourt alias examples - if [[ -x `which abs` ]]; then + if [[ -x `which abs` && -x `which aur` ]]; then + alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories + elif [[ -x `which abs` ]]; then alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + elif [[ -x `which aur` ]]; then + alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else - alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories + alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories fi alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist @@ -45,10 +49,14 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori alias pacloc='pacman -Qi' # Display information about a given package in the local database alias paclocs='pacman -Qs' # Search for package(s) in the local database # Additional pacman alias examples -if [[ -x `which abs` ]]; then - alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +if [[ -x `which abs` && -x `which aur` ]]; then + alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories +elif [[ -x `which abs` ]]; then + alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +elif [[ -x `which aur` ]]; then + alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else - alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories + alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories fi alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 0aa14959..652d2269 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,5 +1,9 @@ if [ $commands[autojump] ]; then # check if autojump is installed - if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package + if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation + . $HOME/.autojump/etc/profile.d/autojump.zsh + elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation + . $HOME/.nix-profile/etc/profile.d/autojump.zsh + elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package . /usr/share/autojump/autojump.zsh elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation . /etc/profile.d/autojump.zsh @@ -7,8 +11,6 @@ if [ $commands[autojump] ]; then # check if autojump is installed . /etc/profile.d/autojump.sh elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation . /usr/local/share/autojump/autojump.zsh - elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation - . $HOME/.autojump/etc/profile.d/autojump.zsh elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports . /opt/local/etc/profile.d/autojump.zsh elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 3f7fb199..de786725 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,17 +1,28 @@ +_homebrew-installed() { + type brew &> /dev/null +} + +_awscli-homebrew-installed() { + brew list awscli &> /dev/null +} + export AWS_HOME=~/.aws function agp { echo $AWS_DEFAULT_PROFILE - } function asp { export AWS_DEFAULT_PROFILE=$1 - export RPROMPT="" - + export RPROMPT="" } function aws_profiles { reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) } compctl -K aws_profiles asp -source `which aws_zsh_completer.sh` + +if _homebrew-installed && _awscli-homebrew-installed ; then + source $(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh +else + source `which aws_zsh_completer.sh` +fi diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 32dd4b62..014bb15d 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -8,7 +8,7 @@ # Modified to add support for Apple Mac # ########################################### -if [[ $(uname) == "Darwin" ]] ; then +if [[ "$OSTYPE" = darwin* ]] ; then function battery_pct() { local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" diff --git a/plugins/bbedit/README.md b/plugins/bbedit/README.md new file mode 100644 index 00000000..ec2b743d --- /dev/null +++ b/plugins/bbedit/README.md @@ -0,0 +1,20 @@ +## bbedit + +Plugin for BBEdit, an HTML and text editor for Mac OS X + +### Requirements + + * [BBEdit](http://www.barebones.com/products/bbedit/) + * [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html) + +### Usage + + * If the `bb` command is called without an argument, launch BBEdit + + * If `bb` is passed a directory, cd to it and open it in BBEdit + + * If `bb` is passed a file, open it in BBEdit + + * If `bbpb` create a new BBEdit document with the contents of the clipboard + + * If `bbd` alias for BBEdit diff tool diff --git a/plugins/bbedit/bbedit.plugin.zsh b/plugins/bbedit/bbedit.plugin.zsh new file mode 100644 index 00000000..fe9e72c6 --- /dev/null +++ b/plugins/bbedit/bbedit.plugin.zsh @@ -0,0 +1,21 @@ +alias bbpb='pbpaste | bbedit --clean --view-top' + +alias bbd=bbdiff + +# +# If the bb command is called without an argument, launch BBEdit +# If bb is passed a directory, cd to it and open it in BBEdit +# If bb is passed a file, open it in BBEdit +# +function bb() { + if [[ -z "$1" ]] + then + bbedit --launch + else + bbedit "$1" + if [[ -d "$1" ]] + then + cd "$1" + fi + fi +} diff --git a/plugins/bower/_bower b/plugins/bower/_bower old mode 100755 new mode 100644 diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 9eb3bb55..40442a1d 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -50,6 +50,7 @@ _1st_arguments=( 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'services:small wrapper around `launchctl` for supported formulae' 'tap:tap a new formula repository from GitHub, or list existing taps' + 'uninstall:uninstall a formula' 'unlink:unlink a formula' 'unpin:unpin specified formulae' 'untap:remove a tapped repository' diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index c2e95884..42fb80c9 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1 +1,2 @@ alias brews='brew list -1' +alias bubu="brew update && brew upgrade && brew cleanup" diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md new file mode 100644 index 00000000..56f0c717 --- /dev/null +++ b/plugins/bundler/README.md @@ -0,0 +1,49 @@ +# Bundler + +- adds completion for basic bundler commands +- adds short aliases for common bundler commands + - `be` aliased to `bundle exec` + - `bl` aliased to `bundle list` + - `bp` aliased to `bundle package` + - `bo` aliased to `bundle open` + - `bu` aliased to `bundle update` + - `bi` aliased to `bundle install --jobs=` (only for bundler `>= 1.4.0`) +- adds a wrapper for common gems: + - looks for a binstub under `./bin/` and executes it (if present) + - calls `bundle exec ` otherwise + +For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. + +## Configuration + +Please use the exact name of the executable and not the gem name. + +### Add additional gems to be wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +BUNDLED_COMMANDS=(rubocop) +plugins=(... bundler ...) +``` +This will add the wrapper for the `rubocop` gem (i.e. the executable). + + +### Exclude gems from being wrapped + +Add this before the plugin-list in your `.zshrc`: +```sh +UNBUNDLED_COMMANDS=(foreman spin) +plugins=(... bundler ...) +``` +This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. + +## Excluded gems + +These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification. + +`berks` +`foreman` +`mailcatcher` +`rails` +`ruby` +`spin` diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler index 2ec3a5f9..ba647ab8 100644 --- a/plugins/bundler/_bundler +++ b/plugins/bundler/_bundler @@ -18,11 +18,13 @@ case $state in "check[Determine whether the requirements for your application are installed]" \ "list[Show all of the gems in the current bundle]" \ "show[Show the source location of a particular gem in the bundle]" \ + "outdated[Show all of the outdated gems in the current bundle]" \ "console[Start an IRB session in the context of the current bundle]" \ "open[Open an installed gem in the editor]" \ "viz[Generate a visual representation of your dependencies]" \ "init[Generate a simple Gemfile, placed in the current directory]" \ "gem[Create a simple gem, suitable for development with bundler]" \ + "platform[Displays platform compatibility information]" \ "clean[Cleans up unused gems in your bundler directory]" \ "help[Describe available tasks or one specific task]" ret=0 @@ -39,11 +41,13 @@ case $state in 'check' \ 'list' \ 'show' \ + 'outdated' \ 'console' \ 'open' \ 'viz' \ 'init' \ 'gem' \ + 'platform' \ 'help' && ret=0 ;; install) @@ -71,6 +75,15 @@ case $state in '(--verbose)--verbose[Enable verbose output mode]' ret=0 ;; + outdated) + _arguments \ + '(--pre)--pre[Check for newer pre-release gems]' \ + '(--source)--source[Check against a specific source]' \ + '(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; (open|show) _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) if [[ $_gems != "" ]]; then diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 3338d78b..ba3d3f62 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -3,23 +3,58 @@ alias bl="bundle list" alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" +alias bi="bundle_install" -# The following is based on https://github.com/gma/bundler-exec - -bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails) +bundled_commands=( + annotate + cap + capify + cucumber + foodcritic + guard + irb + jekyll + kitchen + knife + middleman + nanoc + pry + puma + rackup + rainbows + rake + rspec + shotgun + sidekiq + spec + spork + spring + strainer + tailor + taps + thin + thor + unicorn + unicorn_rails +) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list for cmd in $UNBUNDLED_COMMANDS; do bundled_commands=(${bundled_commands#$cmd}); done +# Add $BUNDLED_COMMANDS to the bundled_commands list +for cmd in $BUNDLED_COMMANDS; do + bundled_commands+=($cmd); +done + ## Functions -bi() { +bundle_install() { if _bundler-installed && _within-bundled-project; then local bundler_version=`bundle version | cut -d' ' -f3` if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] + if [[ "$OSTYPE" = darwin* ]] then local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" else @@ -39,17 +74,25 @@ _bundler-installed() { } _within-bundled-project() { - local check_dir=$PWD - while [ $check_dir != "/" ]; do + local check_dir="$PWD" + while [ "$check_dir" != "/" ]; do [ -f "$check_dir/Gemfile" ] && return check_dir="$(dirname $check_dir)" done false } +_binstubbed() { + [ -f "./bin/${1}" ] +} + _run-with-bundler() { if _bundler-installed && _within-bundled-project; then - bundle exec $@ + if _binstubbed $1; then + ./bin/$@ + else + bundle exec $@ + fi else $@ fi @@ -62,7 +105,6 @@ for cmd in $bundled_commands; do alias $cmd=bundled_$cmd if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd + compdef _$cmd bundled_$cmd=$cmd fi done - diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh index 34d42c28..cb7cc506 100644 --- a/plugins/colemak/colemak.plugin.zsh +++ b/plugins/colemak/colemak.plugin.zsh @@ -19,4 +19,4 @@ bindkey -a 'N' vi-join bindkey -a 'j' vi-forward-word-end bindkey -a 'J' vi-forward-blank-word-end -lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less +lesskey $ZSH/plugins/colemak/colemak-less diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 56056284..5c613f49 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,3 +1,21 @@ +if [ "$OSTYPE[0,7]" = "solaris" ] +then + if [ ! -x ${HOME}/bin/nroff ] + then + mkdir -p ${HOME}/bin + cat > ${HOME}/bin/nroff < /dev/null \ && tar --xz -xvf "$1" \ @@ -47,12 +47,12 @@ function extract() { && tar --lzma -xvf "$1" \ || lzcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; - (*.gz) gunzip "$1" ;; + (*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;; (*.bz2) bunzip2 "$1" ;; (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.sublime-package) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh index b0e60a43..692ca579 100644 --- a/plugins/forklift/forklift.plugin.zsh +++ b/plugins/forklift/forklift.plugin.zsh @@ -1,4 +1,4 @@ -# Open folder in ForkLift.app of ForkLift2.app from console +# Open folder in ForkLift.app or ForkLift2.app from console # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Updated to support ForkLift2 by Johan Kaving # diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md new file mode 100644 index 00000000..32784d03 --- /dev/null +++ b/plugins/frontend-search/README.md @@ -0,0 +1,82 @@ +## Rationale ## + +The idea for this script is to help searches in important doc contents from frontend. + +## Instalation ## + +I will send a Pull Request with this plugin for .oh-my-zsh official repository. If accept them, it's only add in plugins list that exists in ```.zshrc``` file. + +For now, you can clone this repository and add in ```custom/plugins``` folder + +```bash +$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search +``` + +After this, restart your terminal and frontend-search plugin is configurated in you CLI. + +```bash +... +plugins=( ... frontend-search) +... +``` + +## Commands ## + +All command searches are accept only in format + +* `frontend ` + +The search content are + +* `jquery ` +* `mdn ` +* `compass ` +* `html5please ` +* `caniuse ` +* `aurajs ` +* `dartlang ` +* `lodash ` +* `qunit ` +* `fontello ` +* `bootsnipp ` +* `cssflow ` +* `codepen ` +* `unheap ` +* `bem &as_sitesearch=bem.info>` +* `smacss &as_sitesearch=smacss.com>` +* `angularjs &as_sitesearch=angularjs.org>` +* `reactjs &as_sitesearch=facebook.github.io/react>` +* `emberjs ` + + +## Aliases ## + +There are a few aliases presented as well: + +* `jquery` A shorthand for `frontend jquery` +* `mdn` A shorthand for `frontend mdn` +* `compass` A shorthand for `frontend compass` +* `html5please` A shorthand for `frontend html5please` +* `caniuse` A shorthand for `frontend caniuse` +* `aurajs` A shorthand for `frontend aurajs` +* `dartlang` A shorthand for `frontend dartlang` +* `lodash` A shorthand for `frontend lodash` +* `qunit` A shorthand for `frontend qunit` +* `fontello` A shorthand for `frontend fontello` +* `bootsnipp` A shorthand for `frontend bootsnipp` +* `cssflow` A shorthand for `frontend cssflow` +* `codepen` A shorthand for `frontend codepen` +* `unheap` A shorthand for `frontend unheap` +* `bem` A shorthand for `frontend bem` +* `smacss` A shorthand for `frontend smacss` +* `angularjs` A shorthand for `frontend angularjs` +* `reactjs` A shorthand for `frontend reactjs` +* `emberjs` A shorthand for `frontend emberjs` + +## Author + +**Wilson Mendes (willmendesneto)** ++ ++ + +New features comming soon. diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh new file mode 100644 index 00000000..f1d45b0d --- /dev/null +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -0,0 +1,151 @@ +# frontend from terminal + +function frontend() { + + # get the open command + local open_cmd + if [[ $(uname -s) == 'Darwin' ]]; then + open_cmd='open' + else + open_cmd='xdg-open' + fi + + # no keyword provided, simply show how call methods + if [[ $# -le 1 ]]; then + echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend \n" + return 1 + fi + + # check whether the search engine is supported + if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs)' ]]; + then + echo "Search valid search content $1 not supported." + echo "Valid contents: (formats 'frontend ' or '')" + echo "* jquery" + echo "* mdn" + echo "* compass" + echo "* html5please" + echo "* caniuse" + echo "* aurajs" + echo "* dartlang" + echo "* lodash" + echo "* qunit" + echo "* fontello" + echo "* bootsnipp" + echo "* cssflow" + echo "* codepen" + echo "* unheap" + echo "* bem" + echo "* smacss" + echo "* angularjs" + echo "* reactjs" + echo "* emberjs" + echo "" + + return 1 + fi + + local url="http://" + local query="" + + case "$1" in + "jquery") + url="${url}api.jquery.com" + url="${url}/?s=$2" ;; + "mdn") + url="${url}developer.mozilla.org" + url="${url}/search?q=$2" ;; + "compass") + url="${url}compass-style.org" + url="${url}/search?q=$2" ;; + "html5please") + url="${url}html5please.com" + url="${url}/#$2" ;; + "caniuse") + url="${url}caniuse.com" + url="${url}/#search=$2" ;; + "aurajs") + url="${url}aurajs.com" + url="${url}/api/#stq=$2" ;; + "dartlang") + url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer" + url="${url}/dart-$2" ;; + "qunit") + url="${url}api.qunitjs.com" + url="${url}/?s=$2" ;; + "fontello") + url="${url}fontello.com" + url="${url}/#search=$2" ;; + "bootsnipp") + url="${url}bootsnipp.com" + url="${url}/search?q=$2" ;; + "cssflow") + url="${url}cssflow.com" + url="${url}/search?q=$2" ;; + "codepen") + url="${url}codepen.io" + url="${url}/search?q=$2" ;; + "unheap") + url="${url}www.unheap.com" + url="${url}/?s=$2" ;; + "bem") + url="${url}google.com" + url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;; + "smacss") + url="${url}google.com" + url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;; + "angularjs") + url="${url}google.com" + url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;; + "reactjs") + url="${url}google.com" + url="${url}/search?as_q=$2&as_sitesearch=facebook.github.io/react" ;; + "emberjs") + url="${url}emberjs.com" + url="${url}/api/#stq=$2&stp=1" ;; + *) echo "INVALID PARAM!" + return ;; + esac + + echo "$url" + + $open_cmd "$url" + +} + +# javascript +alias jquery='frontend jquery' +alias mdn='frontend mdn' + +# pre processors frameworks +alias compassdoc='frontend compass' + +# important links +alias html5please='frontend html5please' +alias caniuse='frontend caniuse' + +# components and libraries +alias aurajs='frontend aurajs' +alias dartlang='frontend dartlang' +alias lodash='frontend lodash' + +#tests +alias qunit='frontend qunit' + +#fonts +alias fontello='frontend fontello' + +# snippets +alias bootsnipp='frontend bootsnipp' +alias cssflow='frontend cssflow' +alias codepen='frontend codepen' +alias unheap='frontend unheap' + +# css architecture +alias bem='frontend bem' +alias smacss='frontend smacss' + +# frameworks +alias angularjs='frontend angularjs' +alias reactjs='frontend reactjs' +alias emberjs='frontend emberjs' diff --git a/plugins/gem/_gem b/plugins/gem/_gem index 25967f1e..92feebe9 100644 --- a/plugins/gem/_gem +++ b/plugins/gem/_gem @@ -59,6 +59,8 @@ case "$words[1]" in build) _files -g "*.gemspec" ;; + install) + _files ;; list) if [[ "$state" == forms ]]; then _gem_installed diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 9f7819df..bf7cd1ac 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -7,6 +7,8 @@ alias gd='git diff' compdef _git gd=git-diff alias gdc='git diff --cached' compdef _git gdc=git-diff +alias gdt='git diff-tree --no-commit-id --name-only -r' +compdef _git gdc=git diff-tree --no-commit-id --name-only -r alias gl='git pull' compdef _git gl=git-pull alias gup='git pull --rebase' @@ -16,6 +18,7 @@ compdef _git gp=git-push alias gd='git diff' gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff +alias gdt='git difftool' alias gc='git commit -v' compdef _git gc=git-commit alias gc!='git commit -v --amend' @@ -51,6 +54,7 @@ alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' compdef _git gba=git-branch +alias gbr='git branch --remote' alias gcount='git shortlog -sn' compdef gcount=git alias gcl='git config --list' @@ -70,6 +74,7 @@ alias gss='git status -s' compdef _git gss=git-status alias ga='git add' compdef _git ga=git-add +alias gap='git add --patch' alias gm='git merge' compdef _git gm=git-merge alias grh='git reset HEAD' @@ -77,6 +82,18 @@ alias grhh='git reset HEAD --hard' alias gclean='git reset --hard && git clean -dfx' alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' +# Sign and verify commits with GPG +alias gcs='git commit -S' +compdef _git gcs=git-commit +alias gsps='git show --pretty=short --show-signature' +compdef _git gsps=git-show + +# Sign and verify tags with GPG +alias gts='git tag -s' +compdef _git gts=git-tag +alias gvt='git verify-tag' +compdef _git gvt=git verify-tag + #remove the gf alias #alias gf='git ls-files | grep' diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 25b1a1e1..bd69b1bd 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -40,7 +40,7 @@ fi # # Use this when creating a new repo from scratch. empty_gh() { # [NAME_OF_REPO] - repo = $1 + repo=$1 ghuser=$( git config github.user ) mkdir "$repo" diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh index be037d87..481d487b 100644 --- a/plugins/gitignore/gitignore.plugin.zsh +++ b/plugins/gitignore/gitignore.plugin.zsh @@ -1,12 +1,12 @@ -function gi() { curl http://www.gitignore.io/api/$@ ;} +function gi() { curl -sL https://www.gitignore.io/api/$@ ;} -_gitignireio_get_command_list() { - curl -s http://www.gitignore.io/api/list | tr "," "\n" +_gitignoreio_get_command_list() { + curl -sL https://www.gitignore.io/api/list | tr "," "\n" } -_gitignireio () { +_gitignoreio () { compset -P '*,' - compadd -S '' `_gitignireio_get_command_list` + compadd -S '' `_gitignoreio_get_command_list` } -compdef _gitignireio gi +compdef _gitignoreio gi diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 18bcaaff..f2be6ca9 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -158,3 +158,6 @@ __go_tool_complete() { } compdef __go_tool_complete go + +# aliases +alias gfa='go fmt . ./...' diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 9229512f..97bf50b4 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -60,7 +60,7 @@ function in_gradle() { ############################################################################ _gradle_does_task_list_need_generating () { [ ! -f .gradletasknamecache ] && return 0; - [ .gradletasknamecache -nt build.gradle ] && return 0; + [ build.gradle -nt .gradletasknamecache ] && return 0; return 1; } diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh old mode 100755 new mode 100644 diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 739ee714..4a36b882 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -12,7 +12,7 @@ # jira ABC-123 # Opens an existing issue open_jira_issue () { local open_cmd - if [[ $(uname -s) == 'Darwin' ]]; then + if [[ "$OSTYPE" = darwin* ]]; then open_cmd='open' else open_cmd='xdg-open' @@ -26,20 +26,65 @@ open_jira_issue () { jira_url=$JIRA_URL else echo "JIRA url is not specified anywhere." - return 0 + return 1 + fi + + if [ -f .jira-prefix ]; then + jira_prefix=$(cat .jira-prefix) + elif [ -f ~/.jira-prefix ]; then + jira_prefix=$(cat ~/.jira-prefix) + else + jira_prefix="" fi if [ -z "$1" ]; then echo "Opening new issue" - $open_cmd "$jira_url/secure/CreateIssue!default.jspa" + $open_cmd "${jira_url}/secure/CreateIssue!default.jspa" + elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then + jira_query $@ else echo "Opening issue #$1" if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then - $open_cmd "$jira_url/issues/$1" + $open_cmd "$jira_url/issues/$jira_prefix$1" else - $open_cmd "$jira_url/browse/$1" + $open_cmd "$jira_url/browse/$jira_prefix$1" fi fi } +jira_name () { + if [[ -z "$1" ]]; then + if [[ "x${JIRA_NAME}" != "x" ]]; then + jira_name=${JIRA_NAME} + else + echo "JIRA_NAME not specified" + return 1 + fi + else + jira_name=$@ + fi +} + +jira_query () { + verb="$1" + if [[ "${verb}" = "reported" ]]; then + lookup=reporter + preposition=by + elif [[ "${verb}" = "assigned" ]]; then + lookup=assignee + preposition=to + else + echo "not a valid lookup $verb" + return 1 + fi + shift 1 + jira_name $@ + if [[ $? = 1 ]]; then + return 1 + fi + echo "Browsing issues ${verb} ${preposition} ${jira_name}" + $open_cmd "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC" +} + alias jira='open_jira_issue' + diff --git a/plugins/jruby/jruby.plugin.zsh b/plugins/jruby/jruby.plugin.zsh old mode 100755 new mode 100644 diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index 5096879d..b16814fe 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -14,12 +14,12 @@ jump() { mark() { if (( $# == 0 )); then - MARK=$(basename "$(pwd)") + MARK=$(basename "$PWD") else MARK="$1" fi - if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then - mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK" + if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then + mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK" fi } @@ -39,7 +39,7 @@ marks() { _completemarks() { if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then - reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_a-zA-Z0-9\.\-]*):$/\2/g')) else if readlink -e "${MARKPATH}"/* &>/dev/null; then reply=($(ls "${MARKPATH}")) diff --git a/plugins/marked2/README.md b/plugins/marked2/README.md new file mode 100644 index 00000000..101343ab --- /dev/null +++ b/plugins/marked2/README.md @@ -0,0 +1,13 @@ +## marked2 + +Plugin for Marked 2, a previewer for Markdown files on Mac OS X + +### Requirements + + * [Marked 2](http://marked2app.com) + +### Usage + + * If `marked` is called without an argument, open Marked + + * If `marked` is passed a file, open it in Marked diff --git a/plugins/marked2/marked2.plugin.zsh b/plugins/marked2/marked2.plugin.zsh new file mode 100644 index 00000000..56863ade --- /dev/null +++ b/plugins/marked2/marked2.plugin.zsh @@ -0,0 +1,12 @@ +# +# If marked is called without an argument, open Marked +# If marked is passed a file, open it in Marked +# +function marked() { + if [ "$1" ] + then + open -a "marked 2.app" "$1" + else + open -a "marked 2.app" + fi +} diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 2e99a12f..ff95d5e4 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -16,6 +16,8 @@ alias hgs='hg status' alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' # this is the 'git commit --amend' equivalent alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' +# list unresolved files (since hg does not list unmerged files in the status command) +alias hgun='hg resolve --list' function in_hg() { if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index ed796853..0c4f7716 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -44,24 +44,27 @@ mvn-color() # aliases alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' +alias mvncist='mvn clean install -DskipTests' alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnd='mvn deploy' alias mvnp='mvn package' alias mvnc='mvn clean' alias mvncom='mvn compile' +alias mvnct='mvn clean test' alias mvnt='mvn test' alias mvnag='mvn archetype:generate' alias mvn-updates='mvn versions:display-dependency-updates' alias mvntc7='mvn tomcat7:run' alias mvntc='mvn tomcat:run' alias mvnjetty='mvn jetty:run' - +alias mvndt='mvn dependency:tree' +alias mvns='mvn site' function listMavenCompletions { reply=( # common lifecycle - clean process-resources compile process-test-resources test-compile test package verify install deploy site + clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt @@ -126,6 +129,10 @@ function listMavenCompletions { tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy # tomcat7 tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage # exec exec:exec exec:java # versions diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 2d78f2b4..39d8b10d 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -3,7 +3,7 @@ function node-docs { # get the open command local open_cmd - if [[ $(uname -s) == 'Darwin' ]]; then + if [[ "$OSTYPE" = darwin* ]]; then open_cmd='open' else open_cmd='xdg-open' diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 63760b5f..2eea0d8e 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -139,7 +139,7 @@ function man-preview() { function trash() { local trash_dir="${HOME}/.Trash" - local temp_ifs=$IFS + local temp_ifs="$IFS" IFS=$'\n' for item in "$@"; do if [[ -e "$item" ]]; then @@ -174,12 +174,16 @@ function itunes() { next|previous) opt="$opt track" ;; + vol) + opt="set sound volume to $1" #$1 Due to the shift + ;; ""|-h|--help) echo "Usage: itunes