diff options
-rw-r--r-- | MIT-LICENSE.txt | 2 | ||||
-rw-r--r-- | README.markdown | 175 | ||||
-rw-r--r-- | README.textile | 111 | ||||
-rw-r--r-- | lib/completion.zsh | 1 | ||||
-rw-r--r-- | plugins/cabal/cabal.plugin.zsh | 40 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/grunt/grunt.plugin.zsh | 253 | ||||
-rw-r--r-- | plugins/history-substring-search/README | 7 | ||||
-rw-r--r-- | plugins/history-substring-search/README.markdown | 7 | ||||
-rw-r--r-- | plugins/mix/_mix | 1 | ||||
-rw-r--r-- | plugins/mvn/mvn.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/npm/npm.plugin.zsh | 6 | ||||
-rw-r--r-- | plugins/osx/osx.plugin.zsh | 1 | ||||
-rw-r--r-- | plugins/perl/perl.plugin.zsh | 8 | ||||
-rw-r--r-- | plugins/ubuntu/readme.md | 21 | ||||
-rw-r--r-- | plugins/ubuntu/ubuntu.plugin.zsh | 141 | ||||
-rw-r--r-- | plugins/vagrant/_vagrant | 2 | ||||
-rw-r--r-- | plugins/vi-mode/vi-mode.plugin.zsh | 5 | ||||
-rw-r--r-- | themes/awesomepanda.zsh-theme | 8 | ||||
-rw-r--r-- | themes/rkj-repos.zsh-theme | 4 | ||||
-rw-r--r-- | themes/trapd00r.zsh-theme | 2 |
21 files changed, 658 insertions, 143 deletions
diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index 6eb8aab34..dfbd90035 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2009-2014 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) +Copyright (c) 2009-2015 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.markdown b/README.markdown new file mode 100644 index 000000000..25bcdbe6e --- /dev/null +++ b/README.markdown @@ -0,0 +1,175 @@ +![Oh My Zsh](https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png) + + +Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. + +__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interace with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. + +To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on twitter. + +## Getting Started + + +### Prerequisites + +__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ + +* Unix-based operating system (Mac OS X or Linux) +* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent) + * This is commonly pre-installed. (`zsh --version` to confirm) +* `curl` or `wget` should be installed + +### Basic Installation + +Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl` or `wget`. + +#### via curl + +`curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh` + +#### via wget + +`wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh` + +## Using Oh My Zsh + +### Plugins + +Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. + +#### Enabling Plugins + +If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization. + +For example, this line might begin to look like... + +`plugins=(git bundler osx rake ruby)` + +#### Using Plugins + +Most plugins (should! we're working on this) include a __README__, which documents how to use them. + +### Themes + +We'll admit it. Early in the Oh My Zsh world... we may have gotten a far too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! + +#### Selecting a Theme + +_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._ + +Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: + +`ZSH_THEME="robbyrussell"` + +To use a different theme, simple change the value to match the name of your desired theme. For example: + +`ZSH_THEME="agnoster"` (this is one of the fancy ones) + +Open up a new terminal window and your prompt should look something like... + +## Advanced Topics + +If you're the type that likes to get their hands dirty... these sections might resonate. + +### Advanced Installation + +For those who want to install this manually and/or set custom paths. + +#### Custom Directory + +The default location is `~/.oh-my-zsh` (hidden in your home directory) + +If you'd like to 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` + +#### Manual Installation + +##### 1. Clone the repository: + +`git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh` + +##### 2. *Optionally*, backup your existing @~/.zshrc@ file: + +`cp ~/.zshrc ~/.zshrc.orig` + +##### 3. Create a new zsh configuration file + +You can create a new zsh config file by copying the template that we included for you. + +`cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc` + +##### 4. Change your default shell + +`chsh -s /bin/zsh` + +##### 5. Initialize your new zsh configuration + +Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. + +### Installation Problems + +If you have any hiccups installing, here are a few common fixes. + +* 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 the `ZSH` environment variable in `~/.zshrc`. + +### Custom Plugins and Themes + +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 `abcyzeae.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/`. + +## Getting Updates + +By default, you will be prompted to check for upgrades every few weeks. 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 automatic upgrades, set the following in your `~/.zshrc`: + +`DISABLE_AUTO_UPDATE=true` + +### Manual Updates + +If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?)... you just need to run: + +`upgrade_oh_my_zsh` + +Magic! + +## Uninstalling Oh My Zsh + +Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. + +If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. + +## Contributing + +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! + +We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. + +### Do NOT Send Us Themes + +We have (more than) enough themes for the time being. Please fork the project and add one in there – you can let people know how to grab it from there. + +## Contributors + +Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome. + +Thank you so much! + +## Follow Us + +We have an [ohmyzsh](https://twitter.com/ohmyzsh) account. You should follow it. + +## Merchandise + +We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! + +## LICENSE + +Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). diff --git a/README.textile b/README.textile deleted file mode 100644 index d09e6b4bd..000000000 --- a/README.textile +++ /dev/null @@ -1,111 +0,0 @@ -!https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png! - -@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*. - -If not already installed, you can install "Zsh":http://www.zsh.org/ using the command-line. - -h3. The automatic installer… do you trust me? - -You can install this via the command-line with either @curl@ or @wget@. - -h4. via @curl@: - -@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh@ - -h4. via @wget@: - -@wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh@ - -h4. *Optionally*, change the install 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 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: - -@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ - -2. *Optionally*, backup your existing @~/.zshrc@ file: - -@cp ~/.zshrc ~/.zshrc.orig@ - -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@ - -4. Set "Zsh":http://www.zsh.org/ as your default shell: - -@chsh -s /bin/zsh@ - -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@. - -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 available) -** example: @plugins=(git osx ruby)@ -* 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 useful for tips. - -h3. Customization - -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 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 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@. - -h3. Uninstalling - -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":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)! - --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. - -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 - -Thank you so much! diff --git a/lib/completion.zsh b/lib/completion.zsh index ea6139fde..4b1bb0a62 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -34,7 +34,6 @@ fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories -cdpath=(.) # Use caching so that commands like apt and dpkg complete are useable zstyle ':completion::complete:*' use-cache 1 diff --git a/plugins/cabal/cabal.plugin.zsh b/plugins/cabal/cabal.plugin.zsh index 9f76add7a..cf7d2cf5e 100644 --- a/plugins/cabal/cabal.plugin.zsh +++ b/plugins/cabal/cabal.plugin.zsh @@ -45,3 +45,43 @@ function _cabal_commands() { } compdef _cabal_commands cabal + +function _cab_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "sync:Fetch the latest package index" + "install:Install packages" + "uninstall:Uninstall packages" + "installed:List installed packages" + "configure:Configure a cabal package" + "build:Build a cabal package" + "clean:Clean up a build directory" + "outdated:Display outdated packages" + "info:Display information of a package" + "sdist:Make tar.gz for source distribution" + "upload:Uploading tar.gz to HackageDB" + "get:Untar a package in the current directory" + "deps:Show dependencies of this package" + "revdeps:Show reverse dependencies of this package" + "check:Check consistency of packages" + "genpaths:Generate Paths_<pkg>.hs" + "search:Search available packages by package name" + "add:Add a source directory" + "test:Run tests" + "bench:Run benchmarks" + "doc:Generate manuals" + "ghci:Run GHCi (with a sandbox)" + "init:Initialize a sandbox" + "help:Display the help message of the command" + ) + _describe -t subcommands 'cab subcommands' subcommands && ret=0 + esac + + return ret +} + +command -v cab >/dev/null 2>&1 && { compdef _cab_commands cab } diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bf7cd1ac9..bde219dae 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -75,6 +75,7 @@ compdef _git gss=git-status alias ga='git add' compdef _git ga=git-add alias gap='git add --patch' +alias gaa='git add --all' alias gm='git merge' compdef _git gm=git-merge alias grh='git reset HEAD' @@ -174,6 +175,3 @@ alias gignore='git update-index --assume-unchanged' alias gunignore='git update-index --no-assume-unchanged' # list temporarily ignored files alias gignored='git ls-files -v | grep "^[[:lower:]]"' - - - diff --git a/plugins/grunt/grunt.plugin.zsh b/plugins/grunt/grunt.plugin.zsh new file mode 100644 index 000000000..48f6cb5a2 --- /dev/null +++ b/plugins/grunt/grunt.plugin.zsh @@ -0,0 +1,253 @@ +#compdef grunt +# ----------------------------------------------------------------------------- +# _grunt +# +# Completion script for grunt. +# - https://github.com/gruntjs/grunt +# - https://github.com/gruntjs/grunt-cli +# +# ----------------------------------------------------------------------------- +# +# Version : 0.1.0 +# Author : Yonchu <yuyuchu3333@gmail.com> +# License : MIT License +# Repository : https://github.com/yonchu/grunt-zsh-completion +# Last Change : 22 Jul 2013. +# +# Copyright (c) 2013 Yonchu. +# +# ----------------------------------------------------------------------------- +# USAGE +# ----- +# +# Enable caching: +# +# If you want to use the cache, set the followings in your .zshrc: +# +# zstyle ':completion:*' use-cache yes +# +# +# Settings: +# +# - Show grunt file path: +# zstyle ':completion::complete:grunt::options:' show_grunt_path yes +# +# - Cache expiration days (default: 7): +# zstyle ':completion::complete:grunt::options:' expire 1 +# +# - Not update options cache if target gruntfile is changed. +# zstyle ':completion::complete:grunt::options:' no_update_options yes +# +# Note that if you change the zstyle settings, +# you should delete the cache file and restart zsh. +# +# $ rm ~/.zcompcache/grunt +# $ exec zsh +# +# ----------------------------------------------------------------------------- + +function _grunt() { + local curcontext="$curcontext" update_policy state + local show_grunt_path update_msg gruntfile opts tasks + + # Setup cache-policy. + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z $update_policy ]]; then + zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy + fi + + # Check show_path option. + zstyle -b ":completion:${curcontext}:options:" show_grunt_path show_grunt_path + + # Get current gruntfile. + gruntfile=$(__grunt_get_gruntfile) + + # Initialize opts and tasks. + opts=() + tasks=() + + # Add help options. + opts+=('(- 1 *)'{-h,--help}'[Display this help text.]') + + ## Complete without gruntfile. + if [[ ! -f $gruntfile ]]; then + _arguments "${opts[@]}" + return + fi + + ## Complete with gruntfile. + # Retrieve cache. + if ! __grunt_update_cache "$gruntfile"; then + update_msg=' (cache updated)' + fi + + # Make optioins completion. + if [[ ${#__grunt_opts} -gt 0 ]]; then + opts+=("${__grunt_opts[@]}") + fi + + # Complete arguments. + _arguments \ + "${opts[@]}" \ + '*: :->tasks' \ + && return + + case $state in + tasks) + if [[ $show_grunt_path == 'yes' ]]; then + update_msg="$update_msg: ${${gruntfile/#$HOME/~}%/}" + fi + # Make tasks completion. + if [[ ${#__grunt_tasks} -gt 0 ]]; then + tasks+=("${__grunt_tasks[@]}") + _describe -t grunt-task "$verbose grunt task$update_msg" tasks || return 1 + fi + ;; + esac + + return 0 +} + +# Cache policy: +# The cache file name: grunt +# The cache variable name: __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks +function __grunt_update_cache() { + # TODO + local version='0.1.0' + local is_updating=0 + local gruntfile="$1" + local grunt_info no_update_options cache_path + + # Check no_update_options option. + zstyle -b ":completion:${curcontext}:options:" no_update_options no_update_options + + + if ! ( (( $+__grunt_gruntfile )) \ + && (( $+__grunt_opts )) \ + && (( $+__grunt_tasks )) ) \ + && ! _retrieve_cache 'grunt'; then + is_updating=1 + fi + + if [[ $gruntfile != $__grunt_gruntfile ]]; then + # Except for --help options. + __grunt_gruntfile=$gruntfile + if [[ $no_update_options == 'yes' ]]; then + if [[ $PREFIX == ${PREFIX#-} ]]; then + # Not options completions. + is_updating=1 + elif [[ ${#__grunt_opts} -lt 2 ]]; then + is_updating=1 + else + unset __grunt_gruntfile + fi + else + is_updating=1 + fi + else + if [[ $PREFIX != ${PREFIX#-} && ${#__grunt_opts} -gt 1 ]]; then + unset __grunt_gruntfile + fi + fi + + if _cache_invalid 'grunt'; then + is_updating=1 + fi + + # Check _grunt version. + if [[ $__grunt_version != $version ]]; then + is_updating=1 + fi + + if [[ $is_updating -ne 0 ]]; then + # Update caceh. + __grunt_version=$version + __grunt_gruntfile=$gruntfile + is_updating=1 + grunt_info=$(grunt --help --no-color --gruntfile "$__grunt_gruntfile" 2>/dev/null) + __grunt_opts=(${(f)"$(__grunt_get_opts "$grunt_info")"}) + __grunt_tasks=(${(f)"$(__grunt_get_tasks "$grunt_info")"}) + _store_cache 'grunt' __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks + fi + return $is_updating +} + +function __grunt_get_tasks() { + echo -E "$1" \ + | grep 'Available tasks' -A 100 \ + | grep '^ ' \ + | sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' \ + | sed -e 's/ /:/' +} + +function __grunt_get_opts() { + local opt_hunk opt_sep opt_num line opt + opt_hunk=$(echo -E "$1" \ + | grep 'Options$' -A 100 \ + | sed '1 d' \ + | sed -e 's/[[:blank:]]*$//' \ + ) + + opt_sep=() + opt_hunk=(${(f)opt_hunk}) + opt_num=0 + for line in "$opt_hunk[@]"; do + opt=$(echo -E "$line" | sed -e 's/^[[:blank:]]*//') + if [[ $line == $opt ]]; then + break + fi + if [[ $opt != ${opt#-} ]]; then + # Start with - + (( opt_num++ )) + opt=$(echo -E "$opt" | sed 's/^\(\(--[^ ]*\)\(, \(-[^ ]*\)\)*\) */\2\\t\4\\\t/') + fi + opt_sep[$opt_num]=("${opt_sep[$opt_num]}${opt}") + done + + for line in "$opt_sep[@]"; do + opt=(${(s:\t:)line}) + if [[ ${opt[1]} == '--help' ]]; then + continue + fi + if [[ ${#opt} -eq 2 ]]; then + echo -E "(${opt[1]})${opt[1]}[${opt[2]}]" + else + echo -E "(${opt[1]},${opt[2]})${opt[1]}[${opt[3]}]" + echo -E "(${opt[1]},${opt[2]})${opt[2]}[${opt[3]}]" + fi + done +} + +function __grunt_get_gruntfile() { + local gruntfile + local curpath="$PWD" + while [ "$curpath" ]; do + for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do + if [[ -e "$gruntfile" ]]; then + echo "$gruntfile" + return + fi + done + curpath=${curpath%/*} + done + return 1 +} + +function __grunt_caching_policy() { + # Returns status zero if the completions cache needs rebuilding. + + # Rebuild if .agignore more recent than cache. + if [[ -f $__grunt_gruntfile && $__grunt_gruntfile -nt $1 ]]; then + # Invalid cache because gruntfile is old. + return 0 + fi + + local -a oldp + local expire + zstyle -s ":completion:${curcontext}:options:" expire expire || expire=7 + # Rebuild if cache is more than $expire days. + oldp=( "$1"(Nm+$expire) ) + (( $#oldp )) +} + +compdef _grunt grunt diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README deleted file mode 100644 index be11adf76..000000000 --- a/plugins/history-substring-search/README +++ /dev/null @@ -1,7 +0,0 @@ -To activate this script, load it into an interactive ZSH session: - - % source history-substring-search.zsh - -See the "history-substring-search.zsh" file for more information: - - % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more diff --git a/plugins/history-substring-search/README.markdown b/plugins/history-substring-search/README.markdown new file mode 100644 index 000000000..143b813a1 --- /dev/null +++ b/plugins/history-substring-search/README.markdown @@ -0,0 +1,7 @@ +To activate this script, please include it the `plugins` variable within `~/.zshrc` + + `plugins=(git history-substring-search.zsh)` + +See the "history-substring-search.zsh" file for more information: + + `sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more` diff --git a/plugins/mix/_mix b/plugins/mix/_mix index 602f5ffa0..b7c982e0a 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -21,6 +21,7 @@ _1st_arguments=( 'local.install:Install a task or an archive locally' 'local.rebar:Install rebar locally' 'local.uninstall:Uninstall local tasks or archives' + 'local.hex:Install Hex locally' 'new:Creates a new Elixir project' 'run:Run the given file or expression' "test:Run a project's tests" diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 0c4f77162..865b15235 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -60,6 +60,8 @@ alias mvntc='mvn tomcat:run' alias mvnjetty='mvn jetty:run' alias mvndt='mvn dependency:tree' alias mvns='mvn site' +alias mvnsrc='mvn dependency:sources' +alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { reply=( diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index c3eb91d31..d19079b3f 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1 +1,7 @@ eval "$(npm completion 2>/dev/null)" + +# Install and save to dependencies +alias npms="npm i -S " + +# Install and save to dev-dependencies +alias npmd="npm i -D " diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index d366f1fc8..d0f9f009a 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -35,6 +35,7 @@ EOF set current_session to current session tell current_session write text "${command}" + keystroke return end tell end tell end tell diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index f94c4195d..1fbf7c122 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -27,7 +27,7 @@ alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/pe # Functions ################################################################# -# newpl - creates a basic Perl script file and opens it with $EDITOR +# newpl - creates a basic Perl script file and opens it with $EDITOR newpl () { # set $EDITOR to 'vim' if it is undefined [[ -z $EDITOR ]] && EDITOR=vim @@ -54,9 +54,3 @@ pgs() { # [find] [replace] [filename] prep() { # [pattern] [filename unless STDOUT] perl -nle 'print if /'"$1"'/;' $2 } - -# say - append a newline to 'print' -say() { - print "$1\n" -} - diff --git a/plugins/ubuntu/readme.md b/plugins/ubuntu/readme.md new file mode 100644 index 000000000..c9ef61f4e --- /dev/null +++ b/plugins/ubuntu/readme.md @@ -0,0 +1,21 @@ +This plugin was created because the aliases in the debian plugin are inconsistent and hard to remember. Also this apt-priority detection that switched between apt-get and aptitude was dropped to keep it simpler. This plugin uses apt-get for everything but a few things that are only possible with aptitude I guess. Ubuntu does not have aptitude installed by default. + +acs = Apt-Cache Search +acp = Apt-Cache Policy + +ag = sudo Apt-Get +agi = sudo Apt-Get Install +agd = sudo Apt-Get Dselect-upgrade +By now you already can guess almost all aliases + +There are two exeptions since ... +agu = sudo Apt-Get Update - we have ... +agug = sudo Apt-Get UpGrade - as the exeptional 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. + +Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember. +aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not? +agud = sudo Apt-Get Update && sudo apt-get Dist-upgrade + +For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command. diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh new file mode 100644 index 000000000..0211d3374 --- /dev/null +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -0,0 +1,141 @@ +# Authors: +# https://github.com/AlexBio +# https://github.com/dbb +# https://github.com/Mappleconfusers +# Nicolas Jonas nextgenthemes.com +# +# Debian, Ubuntu and friends related zsh aliases and functions for zsh + +alias acs='apt-cache search' +compdef _acs acs='apt-cache search' + +alias afs='apt-file search --regexp' +compdef _afs afs='apt-file search --regexp' + +# These are apt-get only +alias ags='apt-get source' # asrc +compdef _ags ags='apt-get source' + +alias acp='apt-cache policy' # app +compdef _acp acp='apt-cache policy' + +# superuser operations ###################################################### +alias afu='sudo apt-file update' +compdef _afu afu='sudo apt-file update' + +alias ppap='sudo ppa-purge' +compdef _ppap ppap='sudo ppa-purge' + +alias ag='sudo apt-get' # age - but without sudo +alias aga='sudo apt-get autoclean' # aac +alias agb='sudo apt-get build-dep' # abd +alias agc='sudo apt-get clean' # adc +alias agd='sudo apt-get dselect-upgrade' # ads +alias agi='sudo apt-get install' # ai +alias agp='sudo apt-get purge' # ap +alias agr='sudo apt-get remove' # ar +alias agu='sudo apt-get update' # ad +alias agud='sudo apt-get update && sudo apt-get dist-upgrade' #adu +alias agug='sudo apt-get upgrade' # ag +alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg + +compdef _ag ag='sudo apt-get' +compdef _aga aga='sudo apt-get autoclean' +compdef _agb agb='sudo apt-get build-dep' +compdef _agc agc='sudo apt-get clean' +compdef _agd agd='sudo apt-get dselect-upgrade' +compdef _agi agi='sudo apt-get install' +compdef _agp agp='sudo apt-get purge' +compdef _agr agr='sudo apt-get remove' +compdef _agu agu='sudo apt-get update' +compdef _agud agud='sudo apt-get update && sudo apt-get dist-upgrade' +compdef _agug agug='sudo apt-get upgrade' +compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' + +# Remove ALL kernel images and headers EXCEPT the one in use +alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))' + +# Misc. ##################################################################### +# print all installed packages +alias allpkgs='aptitude search -F "%p" --disable-columns ~i' + +# Create a basic .deb package +alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' + +# apt-add-repository with automatic install/upgrade of the desired package +# Usage: aar ppa:xxxxxx/xxxxxx [packagename] +# If packagename is not given as 2nd arument the function will ask for it and guess the defaupt by taking +# the part after the / from the ppa name wich is sometimes the right name for the package you want to install +aar() { + if [ -n "$2" ]; then + PACKAGE=$2 + else + read "PACKAGE?Type in the package name to install/upgrade with this ppa [${1##*/}]: " + fi + + if [ -z "$PACKAGE" ]; then + PACKAGE=${1##*/} + fi + + sudo apt-add-repository $1 && sudo apt-get update + sudo apt-get install $PACKAGE +} + +# Prints apt history +# Usage: +# apt-history install +# apt-history upgrade +# apt-history remove +# apt-history rollback +# apt-history list +# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +apt-history () { + case "$1" in + install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + list) + zcat $(ls -rt /var/log/dpkg*) + ;; + *) + echo "Parameters:" + echo " install - Lists all packages that have been installed." + echo " upgrade - Lists all packages that have been upgraded." + echo " remove - Lists all packages that have been removed." + echo " rollback - Lists rollback information." + echo " list - Lists all contains of dpkg logs." + ;; + esac +} + +# Kernel-package building shortcut +kerndeb () { + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" + appendage='-custom' # this shows up in $ (uname -r ) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + +# List packages by size +function apt-list-packages { + dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \ + grep -v deinstall | \ + sort -n | \ + awk '{print $1" "$2}' +} diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 0c82acd42..76f80b0d7 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -113,7 +113,7 @@ case $state in (box) __vagrant-box ;; - (up|provision|package|destroy|reload|ssh|halt|resume|status) + (up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status) _arguments ':feature:__vm_list' esac ;; diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 1de8bf91a..4424bb29a 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -16,10 +16,7 @@ function zle-keymap-select zle-line-init zle-line-finish { # Ensure that the prompt is redrawn when the terminal size changes. TRAPWINCH() { - if [[ -o zle ]]; then - zle reset-prompt - zle -R - fi + zle && { zle reset-prompt; zle -R } } zle -N zle-line-init diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme index 411b89837..1c5d06b2d 100644 --- a/themes/awesomepanda.zsh-theme +++ b/themes/awesomepanda.zsh-theme @@ -1,18 +1,16 @@ # the svn plugin has to be activated for this to work. - -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" +PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " - - ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" ZSH_THEME_SVN_PROMPT_SUFFIX=")" ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" -ZSH_THEME_SVN_PROMPT_CLEAN=" "
\ No newline at end of file +ZSH_THEME_SVN_PROMPT_CLEAN=" " diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 8585e66be..a3f1f3dfa 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -15,8 +15,8 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" -ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[grey]%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}✈" +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[blue]%}" ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" function mygit() { diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index cb1c43c56..ca1676fb5 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -86,7 +86,7 @@ prompt_jnrowe_precmd () { else dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} > ' fi } |