summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ag/README.md13
-rw-r--r--plugins/ag/_ag66
-rw-r--r--plugins/aliases/README.md21
-rw-r--r--plugins/aliases/aliases.plugin.zsh10
-rw-r--r--plugins/aliases/cheatsheet.py55
-rw-r--r--plugins/aliases/termcolor.py168
-rw-r--r--plugins/bedtools/README.md5
-rw-r--r--plugins/bedtools/_bedtools64
-rw-r--r--plugins/bower/bower.plugin.zsh2
-rw-r--r--plugins/debian/README.md2
-rw-r--r--plugins/debian/debian.plugin.zsh10
-rw-r--r--plugins/dotenv/dotenv.plugin.zsh72
-rw-r--r--plugins/git-flow/git-flow.plugin.zsh6
-rw-r--r--plugins/git/README.md2
-rw-r--r--plugins/git/git.plugin.zsh4
-rw-r--r--plugins/isodate/README.md22
-rw-r--r--plugins/isodate/isodate.plugin.zsh7
-rw-r--r--plugins/kubectl/README.md1
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh2
-rw-r--r--plugins/kubectx/README.md26
-rw-r--r--plugins/kubectx/kubectx.plugin.zsh14
-rw-r--r--plugins/kubectx/prod.pngbin0 -> 3834 bytes
-rw-r--r--plugins/kubectx/stage.pngbin0 -> 3829 bytes
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh33
-rw-r--r--plugins/nvm/README.md6
-rw-r--r--plugins/nvm/nvm.plugin.zsh4
-rw-r--r--plugins/pip/README.md9
-rw-r--r--plugins/pip/pip.plugin.zsh11
-rw-r--r--plugins/pm2/README.md19
-rw-r--r--plugins/pm2/_pm2168
-rw-r--r--plugins/pm2/pm2.plugin.zsh6
-rw-r--r--plugins/python/python.plugin.zsh3
-rw-r--r--plugins/rails/rails.plugin.zsh4
-rw-r--r--plugins/samtools/README.md5
-rw-r--r--plugins/samtools/_samtools40
-rw-r--r--plugins/supervisor/supervisor.plugin.zsh13
-rw-r--r--plugins/thefuck/thefuck.plugin.zsh3
-rw-r--r--plugins/ubuntu/ubuntu.plugin.zsh3
-rw-r--r--plugins/vagrant/_vagrant2
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh23
-rw-r--r--plugins/zoxide/README.md14
-rw-r--r--plugins/zoxide/zoxide.plugin.zsh5
42 files changed, 871 insertions, 72 deletions
diff --git a/plugins/ag/README.md b/plugins/ag/README.md
new file mode 100644
index 000000000..6acc54067
--- /dev/null
+++ b/plugins/ag/README.md
@@ -0,0 +1,13 @@
+# The Silver Searcher
+
+This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
+
+To use it, add ag to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... aws)
+```
+
+## INSTALLATION NOTES
+
+Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
diff --git a/plugins/ag/_ag b/plugins/ag/_ag
new file mode 100644
index 000000000..25b0c27a7
--- /dev/null
+++ b/plugins/ag/_ag
@@ -0,0 +1,66 @@
+#compdef ag
+#autoload
+
+typeset -A opt_args
+
+# Took the liberty of not listing every option… specially aliases and -D
+_ag () {
+ local -a _1st_arguments
+ _1st_arguments=(
+ '--ackmate:Print results in AckMate-parseable format'
+ {'-A','--after'}':[LINES] Print lines after match (Default: 2)'
+ {'-B','--before'}':[LINES] Print lines before match (Default: 2)'
+ '--break:Print newlines between matches in different files'
+ '--nobreak:Do not print newlines between matches in different files'
+ {'-c','--count'}':Only print the number of matches in each file'
+ '--color:Print color codes in results (Default: On)'
+ '--nocolor:Do not print color codes in results'
+ '--color-line-number:Color codes for line numbers (Default: 1;33)'
+ '--color-match:Color codes for result match numbers (Default: 30;43)'
+ '--color-path:Color codes for path names (Default: 1;32)'
+ '--column:Print column numbers in results'
+ {'-H','--heading'}':Print file names (On unless searching a single file)'
+ '--noheading:Do not print file names (On unless searching a single file)'
+ '--line-numbers:Print line numbers even for streams'
+ {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
+ '-g:[PATTERN] Print filenames matching PATTERN'
+ {'-l','--files-with-matches'}':Only print filenames that contain matches'
+ {'-L','--files-without-matches'}':Only print filenames that do not contain matches'
+ '--no-numbers:Do not print line numbers'
+ {'-o','--only-matching'}':Prints only the matching part of the lines'
+ '--print-long-lines:Print matches on very long lines (Default: 2k characters)'
+ '--passthrough:When searching a stream, print all lines even if they do not match'
+ '--silent:Suppress all log messages, including errors'
+ '--stats:Print stats (files scanned, time taken, etc.)'
+ '--vimgrep:Print results like vim :vimgrep /pattern/g would'
+ {'-0','--null'}':Separate filenames with null (for "xargs -0")'
+
+ {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
+ '--depth:[NUM] Search up to NUM directories deep (Default: 25)'
+ {'-f','--follow'}':Follow symlinks'
+ {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
+ '--hidden:Search hidden files (obeys .*ignore files)'
+ {'-i','--ignore-case'}':Match case insensitively'
+ '--ignore:[PATTERN] Ignore files/directories matching PATTERN'
+ {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
+ {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
+ {'-Q','--literal'}':Do not parse PATTERN as a regular expression'
+ {'-s','--case-sensitive'}':Match case'
+ {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
+ '--search-binary:Search binary files for matches'
+ {'-t','--all-text'}':Search all text files (Hidden files not included)'
+ {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
+ {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
+ {'-v','--invert-match'}':Invert match'
+ {'-w','--word-regexp'}':Only match whole words'
+ {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
+
+ '--list-file-types:list of supported file types'
+ )
+
+ if [[ $words[-1] =~ "^-" ]]; then
+ _describe -t commands "ag options" _1st_arguments && ret=0
+ else
+ _files && ret=0
+ fi
+}
diff --git a/plugins/aliases/README.md b/plugins/aliases/README.md
new file mode 100644
index 000000000..481c1bd4e
--- /dev/null
+++ b/plugins/aliases/README.md
@@ -0,0 +1,21 @@
+## Aliases Cheatsheet
+
+**Maintainer:** [@hqingyi](https://github.com/hqingyi)
+
+With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
+that are currently available based on the plugins you have enabled.
+
+Enable this plugin by adding it to your `plugins` definition in `~/.zshrc`.
+
+ ```
+ plugins=(aliases)
+ ```
+
+Requirements: Python needs to be installed.
+
+### Usage
+
+```
+ acs: group all alias
+ acs $keywordquickly filter alias & highlight
+```
diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh
new file mode 100644
index 000000000..28d8fba24
--- /dev/null
+++ b/plugins/aliases/aliases.plugin.zsh
@@ -0,0 +1,10 @@
+# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly.
+#
+# - acs: alias cheatsheet
+# group alias by command, pass addition argv to grep.
+ALIASES_PLUGIN_ROOT=$(cd `dirname $0` && pwd)
+function acs(){
+ which python >>/dev/null
+ [[ $? -eq 1 ]] && echo "[error]no python executable detected!" && return
+ alias | python $ALIASES_PLUGIN_ROOT/cheatsheet.py $@
+}
diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py
new file mode 100644
index 000000000..d6d507b92
--- /dev/null
+++ b/plugins/aliases/cheatsheet.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+import sys
+import itertools
+import termcolor
+
+def parse(line):
+ left = line[0:line.find('=')].strip()
+ right = line[line.find('=')+1:].strip('\'"\n ')
+ try:
+ cmd = next(part for part in right.split() if len([char for char in '=<>' if char in part])==0)
+ except StopIteration:
+ cmd = right
+ return (left, right, cmd)
+
+def cheatsheet(lines):
+ exps = [ parse(line) for line in lines ]
+ cheatsheet = {'_default': []}
+ for key, group in itertools.groupby(exps, lambda exp:exp[2]):
+ group_list = [ item for item in group ]
+ if len(group_list)==1:
+ target_aliases = cheatsheet['_default']
+ else:
+ if key not in cheatsheet:
+ cheatsheet[key] = []
+ target_aliases = cheatsheet[key]
+ target_aliases.extend(group_list)
+ return cheatsheet
+
+def pretty_print_group(key, aliases, hightlight=None):
+ if len(aliases) == 0:
+ return
+ group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)])
+ alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)])
+ group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red')
+ alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green')
+ if hightlight and len(hightlight)>0:
+ print (group_hl_formatter(key, hightlight))
+ print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases]))
+ else:
+ print (group_formatter(key))
+ print ('\n'.join([alias_formatter(alias) for alias in aliases]))
+ print ('')
+
+def pretty_print(cheatsheet, wfilter):
+ sorted_key = sorted(cheatsheet.keys())
+ for key in sorted_key:
+ aliases = cheatsheet.get(key)
+ if not wfilter:
+ pretty_print_group(key, aliases, wfilter)
+ else:
+ pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
+
+if __name__ == '__main__':
+ lines = sys.stdin.readlines()
+ pretty_print(cheatsheet(lines), sys.argv[1] if len(sys.argv)>1 else None)
diff --git a/plugins/aliases/termcolor.py b/plugins/aliases/termcolor.py
new file mode 100644
index 000000000..f11b824b2
--- /dev/null
+++ b/plugins/aliases/termcolor.py
@@ -0,0 +1,168 @@
+# coding: utf-8
+# Copyright (c) 2008-2011 Volvox Development Team
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Author: Konstantin Lepa <konstantin.lepa@gmail.com>
+
+"""ANSII Color formatting for output in terminal."""
+
+from __future__ import print_function
+import os
+
+
+__ALL__ = [ 'colored', 'cprint' ]
+
+VERSION = (1, 1, 0)
+
+ATTRIBUTES = dict(
+ list(zip([
+ 'bold',
+ 'dark',
+ '',
+ 'underline',
+ 'blink',
+ '',
+ 'reverse',
+ 'concealed'
+ ],
+ list(range(1, 9))
+ ))
+ )
+del ATTRIBUTES['']
+
+
+HIGHLIGHTS = dict(
+ list(zip([
+ 'on_grey',
+ 'on_red',
+ 'on_green',
+ 'on_yellow',
+ 'on_blue',
+ 'on_magenta',
+ 'on_cyan',
+ 'on_white'
+ ],
+ list(range(40, 48))
+ ))
+ )
+
+
+COLORS = dict(
+ list(zip([
+ 'grey',
+ 'red',
+ 'green',
+ 'yellow',
+ 'blue',
+ 'magenta',
+ 'cyan',
+ 'white',
+ ],
+ list(range(30, 38))
+ ))
+ )
+
+
+RESET = '\033[0m'
+
+
+def colored(text, color=None, on_color=None, attrs=None):
+ """Colorize text.
+
+ Available text colors:
+ red, green, yellow, blue, magenta, cyan, white.
+
+ Available text highlights:
+ on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.
+
+ Available attributes:
+ bold, dark, underline, blink, reverse, concealed.
+
+ Example:
+ colored('Hello, World!', 'red', 'on_grey', ['blue', 'blink'])
+ colored('Hello, World!', 'green')
+ """
+ if os.getenv('ANSI_COLORS_DISABLED') is None:
+ fmt_str = '\033[%dm%s'
+ if color is not None:
+ text = fmt_str % (COLORS[color], text)
+
+ if on_color is not None:
+ text = fmt_str % (HIGHLIGHTS[on_color], text)
+
+ if attrs is not None:
+ for attr in attrs:
+ text = fmt_str % (ATTRIBUTES[attr], text)
+
+ text += RESET
+ return text
+
+
+def cprint(text, color=None, on_color=None, attrs=None, **kwargs):
+ """Print colorize text.
+
+ It accepts arguments of print function.
+ """
+
+ print((colored(text, color, on_color, attrs)), **kwargs)
+
+
+if __name__ == '__main__':
+ print('Current terminal type: %s' % os.getenv('TERM'))
+ print('Test basic colors:')
+ cprint('Grey color', 'grey')
+ cprint('Red color', 'red')
+ cprint('Green color', 'green')
+ cprint('Yellow color', 'yellow')
+ cprint('Blue color', 'blue')
+ cprint('Magenta color', 'magenta')
+ cprint('Cyan color', 'cyan')
+ cprint('White color', 'white')
+ print(('-' * 78))
+
+ print('Test highlights:')
+ cprint('On grey color', on_color='on_grey')
+ cprint('On red color', on_color='on_red')
+ cprint('On green color', on_color='on_green')
+ cprint('On yellow color', on_color='on_yellow')
+ cprint('On blue color', on_color='on_blue')
+ cprint('On magenta color', on_color='on_magenta')
+ cprint('On cyan color', on_color='on_cyan')
+ cprint('On white color', color='grey', on_color='on_white')
+ print('-' * 78)
+
+ print('Test attributes:')
+ cprint('Bold grey color', 'grey', attrs=['bold'])
+ cprint('Dark red color', 'red', attrs=['dark'])
+ cprint('Underline green color', 'green', attrs=['underline'])
+ cprint('Blink yellow color', 'yellow', attrs=['blink'])
+ cprint('Reversed blue color', 'blue', attrs=['reverse'])
+ cprint('Concealed Magenta color', 'magenta', attrs=['concealed'])
+ cprint('Bold underline reverse cyan color', 'cyan',
+ attrs=['bold', 'underline', 'reverse'])
+ cprint('Dark blink concealed white color', 'white',
+ attrs=['dark', 'blink', 'concealed'])
+ print(('-' * 78))
+
+ print('Test mixing:')
+ cprint('Underline red on grey color', 'red', 'on_grey',
+ ['underline'])
+ cprint('Reversed green on red color', 'green', 'on_red', ['reverse'])
+
diff --git a/plugins/bedtools/README.md b/plugins/bedtools/README.md
new file mode 100644
index 000000000..c4de4e3a9
--- /dev/null
+++ b/plugins/bedtools/README.md
@@ -0,0 +1,5 @@
+# Bedtools plugin
+
+This plugin adds support for the [bedtools suite](http://bedtools.readthedocs.org/en/latest/):
+
+* Adds autocomplete options for all bedtools sub commands.
diff --git a/plugins/bedtools/_bedtools b/plugins/bedtools/_bedtools
new file mode 100644
index 000000000..ef6c4179a
--- /dev/null
+++ b/plugins/bedtools/_bedtools
@@ -0,0 +1,64 @@
+#compdef bedtools
+#autoload
+
+local curcontext="$curcontext" state line ret=1
+local -a _files
+
+_arguments -C \
+ '1: :->cmds' \
+ '2:: :->args' && ret=0
+
+case $state in
+ cmds)
+ _values "bedtools command" \
+ "--contact[Feature requests, bugs, mailing lists, etc.]" \
+ "--help[Print this help menu.]" \
+ "--version[What version of bedtools are you using?.]" \
+ "annotate[Annotate coverage of features from multiple files.]" \
+ "bamtobed[Convert BAM alignments to BED (& other) formats.]" \
+ "bamtofastq[Convert BAM records to FASTQ records.]" \
+ "bed12tobed6[Breaks BED12 intervals into discrete BED6 intervals.]" \
+ "bedpetobam[Convert BEDPE intervals to BAM records.]" \
+ "bedtobam[Convert intervals to BAM records.]" \
+ "closest[Find the closest, potentially non-overlapping interval.]" \
+ "cluster[Cluster (but don't merge) overlapping/nearby intervals.]" \
+ "complement[Extract intervals _not_ represented by an interval file.]" \
+ "coverage[Compute the coverage over defined intervals.]" \
+ "expand[Replicate lines based on lists of values in columns.]" \
+ "fisher[Calculate Fisher statistic b/w two feature files.]" \
+ "flank[Create new intervals from the flanks of existing intervals.]" \
+ "genomecov[Compute the coverage over an entire genome.]" \
+ "getfasta[Use intervals to extract sequences from a FASTA file.]" \
+ "groupby[Group by common cols. & summarize oth. cols. (~ SQL "groupBy")]" \
+ "igv[Create an IGV snapshot batch script.]" \
+ "intersect[Find overlapping intervals in various ways.]" \
+ "jaccard[Calculate the Jaccard statistic b/w two sets of intervals.]" \
+ "links[Create a HTML page of links to UCSC locations.]" \
+ "makewindows[Make interval "windows" across a genome.]" \
+ "map[Apply a function to a column for each overlapping interval.]" \
+ "maskfasta[Use intervals to mask sequences from a FASTA file.]" \
+ "merge[Combine overlapping/nearby intervals into a single interval.]" \
+ "multicov[Counts coverage from multiple BAMs at specific intervals.]" \
+ "multiinter[Identifies common intervals among multiple interval files.]" \
+ "nuc[Profile the nucleotide content of intervals in a FASTA file.]" \
+ "overlap[Computes the amount of overlap from two intervals.]" \
+ "pairtobed[Find pairs that overlap intervals in various ways.]" \
+ "pairtopair[Find pairs that overlap other pairs in various ways.]" \
+ "random[Generate random intervals in a genome.]" \
+ "reldist[Calculate the distribution of relative distances b/w two files.]" \
+ "sample[Sample random records from file using reservoir sampling.]" \
+ "shuffle[Randomly redistrubute intervals in a genome.]" \
+ "slop[Adjust the size of intervals.]" \
+ "sort[Order the intervals in a file.]" \
+ "subtract[Remove intervals based on overlaps b/w two files.]" \
+ "tag[Tag BAM alignments based on overlaps with interval files.]" \
+ "unionbedg[Combines coverage intervals from multiple BEDGRAPH files.]" \
+ "window[Find overlapping intervals within a window around an interval.]" \
+ ret=0
+ ;;
+ *)
+ _files
+ ;;
+esac
+
+return ret
diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
index 6019b9d37..3a40b3af0 100644
--- a/plugins/bower/bower.plugin.zsh
+++ b/plugins/bower/bower.plugin.zsh
@@ -1,4 +1,6 @@
alias bi="bower install"
+alias bisd="bower install --save-dev"
+alias bis="bower install --save"
alias bl="bower list"
alias bs="bower search"
diff --git a/plugins/debian/README.md b/plugins/debian/README.md
index da5675c66..922d68cb3 100644
--- a/plugins/debian/README.md
+++ b/plugins/debian/README.md
@@ -10,7 +10,7 @@ plugins=(... debian)
## Settings
-- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get.
+- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 108396784..bde97cd30 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -1,13 +1,13 @@
-# Use apt or aptitude if installed, fallback is apt-get
+# Use aptitude or apt if installed, fallback is apt-get
# You can just set apt_pref='apt-get' to override it.
if [[ -z $apt_pref || -z $apt_upgr ]]; then
- if [[ -e $commands[apt] ]]; then
- apt_pref='apt'
- apt_upgr='upgrade'
- elif [[ -e $commands[aptitude] ]]; then
+ if [[ -e $commands[aptitude] ]]; then
apt_pref='aptitude'
apt_upgr='safe-upgrade'
+ elif [[ -e $commands[apt] ]]; then
+ apt_pref='apt'
+ apt_upgr='upgrade'
else
apt_pref='apt-get'
apt_upgr='upgrade'
diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index 24f285df5..40ec5c46f 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -11,41 +11,51 @@
## Functions
source_env() {
- if [[ -f $ZSH_DOTENV_FILE ]]; then
- if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
- local confirmation dirpath="${PWD:A}"
-
- # make sure there is an (dis-)allowed file
- touch "$ZSH_DOTENV_ALLOWED_LIST"
- touch "$ZSH_DOTENV_DISALLOWED_LIST"
-
- # early return if disallowed
- if grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
- return;
- fi
-
- # check if current directory's .env file is allowed or ask for confirmation
- if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
- # print same-line prompt and output newline character if necessary
- echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) "
- read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
-
- # check input
- case "$confirmation" in
- [nN]) return ;;
- [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
- [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
- *) ;; # interpret anything else as a yes
- esac
- fi
+ if [[ ! -f "$ZSH_DOTENV_FILE" ]]; then
+ return
+ fi
+
+ if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
+ local confirmation dirpath="${PWD:A}"
+
+ # make sure there is an (dis-)allowed file
+ touch "$ZSH_DOTENV_ALLOWED_LIST"
+ touch "$ZSH_DOTENV_DISALLOWED_LIST"
+
+ # early return if disallowed
+ if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
+ return
fi
- # test .env syntax
- zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
+ # check if current directory's .env file is allowed or ask for confirmation
+ if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
+ # get cursor column and print new line before prompt if not at line beginning
+ local column
+ echo -ne "\e[6n" > /dev/tty
+ read -t 1 -s -d R column < /dev/tty
+ column="${column##*\[*;}"
+ [[ $column -eq 1 ]] || echo
- setopt localoptions allexport
- source $ZSH_DOTENV_FILE
+ # print same-line prompt and output newline character if necessary
+ echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) "
+ read -k 1 confirmation
+ [[ "$confirmation" = $'\n' ]] || echo
+
+ # check input
+ case "$confirmation" in
+ [nN]) return ;;
+ [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
+ [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;;
+ *) ;; # interpret anything else as a yes
+ esac
+ fi
fi
+
+ # test .env syntax
+ zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
+
+ setopt localoptions allexport
+ source $ZSH_DOTENV_FILE
}
autoload -U add-zsh-hook
diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh
index 916cd5693..8f0714b16 100644
--- a/plugins/git-flow/git-flow.plugin.zsh
+++ b/plugins/git-flow/git-flow.plugin.zsh
@@ -23,9 +23,9 @@
#Alias
alias gfl='git flow'
alias gfli='git flow init'
-alias gcd='git checkout develop'
-alias gch='git checkout hotfix'
-alias gcr='git checkout release'
+alias gcd='git checkout $(git config gitflow.branch.develop)'
+alias gch='git checkout $(git config gitflow.prefix.hotfix)'
+alias gcr='git checkout $(git config gitflow.prefix.release)'
alias gflf='git flow feature'
alias gflh='git flow hotfix'
alias gflr='git flow release'
diff --git a/plugins/git/README.md b/plugins/git/README.md
index 4f051db8d..e00f4cf92 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -53,6 +53,7 @@ plugins=(... git)
| gcd | git checkout develop |
| gcmsg | git commit -m |
| gco | git checkout |
+| gcor | git checkout --recurse-submodules |
| gcount | git shortlog -sn |
| gcp | git cherry-pick |
| gcpa | git cherry-pick --abort |
@@ -116,6 +117,7 @@ plugins=(... git)
| gpf | git push --force-with-lease |
| gpf! | git push --force |
| gpoat | git push origin --all && git push origin --tags |
+| gpr | git pull --rebase |
| gpu | git push upstream |
| gpv | git push -v |
| gr | git remote |
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 35ebfbfa3..2a7c7290d 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -91,11 +91,14 @@ alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
alias gco='git checkout'
+alias gcor='git checkout --recurse-submodules'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gcs='git commit -S'
+alias gcss='git commit -S -s'
+alias gcssm='git commit -S -s -m'
alias gd='git diff'
alias gdca='git diff --cached'
@@ -215,6 +218,7 @@ alias gpd='git push --dry-run'
alias gpf='git push --force-with-lease'
alias gpf!='git push --force'
alias gpoat='git push origin --all && git push origin --tags'
+alias gpr='git pull --rebase'
alias gpu='git push upstream'
alias gpv='git push -v'
diff --git a/plugins/isodate/README.md b/plugins/isodate/README.md
new file mode 100644
index 000000000..1ec75b2d4
--- /dev/null
+++ b/plugins/isodate/README.md
@@ -0,0 +1,22 @@
+# Isodate plugin
+
+**Maintainer:** [@Frani](https://github.com/frani)
+
+This plugin adds completion for the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601),
+as well as some aliases for common Date commands.
+
+To use it, add `isodate` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... isodate)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|---------------|--------------------------------------|----------------------------------------------------------------------------|
+| isodate | `date +%Y-%m-%dT%H:%M:%S%z` | Display the current date with UTC offset and ISO 8601-2 extended format |
+| isodate_utc | `date -u +%Y-%m-%dT%H:%M:%SZ` | Display the current date in UTC and ISO 8601-2 extended format |
+| isodate_basic | `date -u +%Y%m%dT%H%M%SZ` | Display the current date in UTC and ISO 8601 basic format |
+| unixstamp | `date +%s` | Display the current date as a Unix timestamp (seconds since the Unix epoch)|
+| date_locale | `date +"%c"` | Display the current date using the default locale's format |
diff --git a/plugins/isodate/isodate.plugin.zsh b/plugins/isodate/isodate.plugin.zsh
new file mode 100644
index 000000000..1a827e785
--- /dev/null
+++ b/plugins/isodate/isodate.plugin.zsh
@@ -0,0 +1,7 @@
+# work with date ISO 8601 easy
+
+alias isodate="date +%Y-%m-%dT%H:%M:%S%z"
+alias isodate_utc="date -u +%Y-%m-%dT%H:%M:%SZ"
+alias isodate_basic="date -u +%Y%m%dT%H%M%SZ"
+alias unixstamp="date +%s"
+alias date_locale="date +"%c""
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index 8937b2b80..f6651c8cd 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -107,7 +107,6 @@ plugins=(... kubectl)
| ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
| | | **Service Accounts management** |
-| kgsa | `kubectl get sa` | List all service accounts |
| kdsa | `kubectl describe sa` | Describe a service account in details |
| kdelsa | `kubectl delete sa` | Delete the service account |
| | | **DaemonSet management** |
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 56135274f..3630facaa 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -43,6 +43,7 @@ alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods'
alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'
+alias kgpall='kubectl get pods --all-namespaces -o wide'
# get pod by label: kgpl "app=myapp" -n myns
alias kgpl='kgp -l'
@@ -151,7 +152,6 @@ alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc'
# Service account management.
-alias kgsa="kubectl get sa"
alias kdsa="kubectl describe sa"
alias kdelsa="kubectl delete sa"
diff --git a/plugins/kubectx/README.md b/plugins/kubectx/README.md
new file mode 100644
index 000000000..9a1df2617
--- /dev/null
+++ b/plugins/kubectx/README.md
@@ -0,0 +1,26 @@
+# kubectx - show active kubectl context
+
+This plugins adds ```kubectx_prompt_info()``` function. It shows name of the
+active kubectl context (```kubectl config current-context```).
+
+You can use it to customize prompt and know if You are on prod cluster ;)
+
+_Example_. Add to **.zshrc**:
+
+```
+RPS1='$(kubectx_prompt_info)'
+```
+
+### custom ctx names
+
+One can rename default context name for better readability.
+
+_Example_. Add to **.zshrc**:
+```
+kubectx_mapping[minikube] = "mini"
+kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]"
+kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}"
+```
+
+![staging](stage.png)
+![production](prod.png)
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
new file mode 100644
index 000000000..56b7217f1
--- /dev/null
+++ b/plugins/kubectx/kubectx.plugin.zsh
@@ -0,0 +1,14 @@
+typeset -A kubectx_mapping
+
+function kubectx_prompt_info() {
+ if [ $commands[kubectl] ]; then
+ local current_ctx=`kubectl config current-context`
+
+ #if associative array declared
+ if [[ -n $kubectx_mapping ]]; then
+ echo "${kubectx_mapping[$current_ctx]}"
+ else
+ echo $current_ctx
+ fi
+ fi
+}
diff --git a/plugins/kubectx/prod.png b/plugins/kubectx/prod.png
new file mode 100644
index 000000000..0c194a66d
--- /dev/null
+++ b/plugins/kubectx/prod.png
Binary files differ
diff --git a/plugins/kubectx/stage.png b/plugins/kubectx/stage.png
new file mode 100644
index 000000000..ac15b3929
--- /dev/null
+++ b/plugins/kubectx/stage.png
Binary files differ
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index f13430476..f4efc2b4a 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -19,37 +19,38 @@ alias hglr='hg pull --rebase'
alias hgo='hg outgoing'
function in_hg() {
- if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then
+ if $(hg branch > /dev/null 2>&1); then
echo 1
fi
}
function hg_get_branch_name() {
- if [ $(in_hg) ]; then
- echo $(hg branch)
+ branch=`hg branch 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ echo $branch
fi
+ unset branch
}
function hg_prompt_info {
- if [ $(in_hg) ]; then
- _DISPLAY=$(hg_get_branch_name)
+ _DISPLAY=`hg branch 2>/dev/null`
+ if [ $? -eq 0 ]; then
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR"
- unset _DISPLAY
fi
+ unset _DISPLAY
}
function hg_dirty_choose {
- if [ $(in_hg) ]; then
- hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'
+ hg status -mar 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'
+ if [ $? -eq 0 ]; then
if [ $pipestatus[-1] -eq 0 ]; then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
- else
- # Otherwise, no lines were found, or an error occurred. Return clean.
- echo $2
+ return
fi
fi
+ echo $2
}
function hg_dirty {
@@ -57,9 +58,15 @@ function hg_dirty {
}
function hgic() {
- hg incoming "$@" | grep "changeset" | wc -l
+ hg incoming "$@" | grep "changeset" | wc -l
}
function hgoc() {
- hg outgoing "$@" | grep "changeset" | wc -l
+ hg outgoing "$@" | grep "changeset" | wc -l
+}
+
+function hg_get_bookmark_name() {
+ if [ $(in_hg) ]; then
+ echo $(hg id -B)
+ fi
}
diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md
index 700613085..0c2bbf9f0 100644
--- a/plugins/nvm/README.md
+++ b/plugins/nvm/README.md
@@ -21,7 +21,11 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
- **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session,
set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function
- for `node`, `npm` and `yarn`, so when you call either of these three, nvm will load with `nvm use default`.
+ for `node`, `npm`, `yarn`, and the command(s) specified by `NVM_LAZY_CMD`, so when you call either of them,
+ nvm will load with `nvm use default`.
+
+- **`NVM_LAZY_CMD`**: if you want additional command(s) to trigger lazy loading of nvm, set `NVM_LAZY_CMD` to
+ the command or an array of the commands.
- **`NVM_AUTOLOAD`**: if `NVM_AUTOLOAD` is set to `1`, the plugin will automatically load a node version when
if finds a [`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 1e9b26e7a..3ef8cc1d8 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -28,8 +28,8 @@ fi
# Call nvm when first using node, npm or yarn
if (( $+NVM_LAZY )); then
- function node npm yarn {
- unfunction node npm yarn
+ function node npm yarn $NVM_LAZY_CMD {
+ unfunction node npm yarn $NVM_LAZY_CMD
nvm use default
command "$0" "$@"
}
diff --git a/plugins/pip/README.md b/plugins/pip/README.md
index f07b5c058..88d88227e 100644
--- a/plugins/pip/README.md
+++ b/plugins/pip/README.md
@@ -17,3 +17,12 @@ or you can run `zsh-pip-cache-packages` directly.
To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
the next time you autocomplete `pip install`.
+
+## Aliases
+
+| Alias | Description |
+| :------- | :-------------------------------------------- |
+| pipreq | Create requirements file |
+| pipir | Install packages from `requirements.txt` file |
+| pipupall | Update all installed packages |
+| pipunall | Uninstall all installed packages |
diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh
index a46e7658c..629147bae 100644
--- a/plugins/pip/pip.plugin.zsh
+++ b/plugins/pip/pip.plugin.zsh
@@ -84,3 +84,14 @@ zsh-pip-test-clean-packages() {
alias pip="noglob pip" # allows square brackets for pip command invocation
+# Create requirements file
+alias pipreq="pip freeze > requirements.txt"
+
+# Update all installed packages
+alias pipupall="pipreq && sed -i 's/==/>=/g' requirements.txt && pip install -r requirements.txt --upgrade && rm -rf requirements.txt"
+
+# Install packages from requirements file
+alias pipir="pip install -r requirements.txt"
+
+# Uninstalled all installed packages
+alias pipunall="pipreq && pip uninstall -r requirements.txt -y && rm -rf requirements.txt"
diff --git a/plugins/pm2/README.md b/plugins/pm2/README.md
new file mode 100644
index 000000000..5dfd540b6
--- /dev/null
+++ b/plugins/pm2/README.md
@@ -0,0 +1,19 @@
+# pm2 plugin
+
+The plugin adds several aliases and completions for common [pm2](http://pm2.keymetrics.io/) commands.
+
+To use it, add `pm2` to the plugins array of your zshrc file:
+```
+plugins=(... pm2)
+```
+
+## Aliases
+
+| Alias | Command |
+|--------|----------------------|
+| p2s | `pm2 start` |
+| p2o | `pm2 stop` |
+| p2d | `pm2 delete` |
+| p2r | `pm2 restart` |
+| p2i | `pm2 list` |
+| p2l | `pm2 logs` |
diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2
new file mode 100644
index 000000000..6f1e89df5
--- /dev/null
+++ b/plugins/pm2/_pm2
@@ -0,0 +1,168 @@
+#!/bin/zsh -f
+#compdef pm2
+#autoload
+
+local -a _1st_arguments
+
+_1st_arguments=(
+ "start:start and daemonize an app"
+ "trigger:trigger process action"
+ "deploy:deploy your json"
+ "startOrRestart:start or restart JSON file"
+ "startOrReload:start or gracefully reload JSON file"
+ "pid:return pid of [app_name] or all"
+ "stop:stop a process"
+ "restart:restart a process"
+ "scale:scale up/down a process in cluster mode depending on total_number param"
+ "profile\:mem:Sample PM2 heap memory"
+ "profile\:cpu:Profile PM2 cpu"
+ "reload:reload processes (note that its for app using HTTP/HTTPS)"
+ "id:get process id by name"
+ "inspect:inspect a process"
+ "delete:stop and delete a process from pm2 process list"
+ "sendSignal:send a system signal to the target process"
+ "ping:ping pm2 daemon - if not up it will launch it"
+ "updatePM2:update in-memory PM2 with local PM2"
+ "install:install or update a module and run it forever"
+ "module\:update:update a module and run it forever"
+ "module\:generate:Generate a sample module in current folder"
+ "uninstall:stop and uninstall a module"
+ "package:Check & Package TAR type module"
+ "publish:Publish the module you are currently on"
+ "set:sets the specified config <key> <value>"
+ "multiset:multiset eg \"key1 val1 key2 val2\""
+ "get:get value for <key>"
+ "config:get / set module config values"
+ "unset:clears the specified config <key>"
+ "report:give a full pm2 report for https\://github.com/Unitech/pm2/issues"
+ "link:link with the pm2 monitoring dashboard"
+ "unlink:unlink with the pm2 monitoring dashboard"
+ "monitor:monitor target process"
+ "unmonitor:unmonitor target process"
+ "open:open the pm2 monitoring dashboard"
+ "plus:enable pm2 plus"
+ "login:Login to pm2 plus"
+ "logout:Logout from pm2 plus"
+ "web:launch a health API on 0.0.0.0\:9615"
+ "dump:dump all processes for resurrecting them later"
+ "cleardump:Create empty dump file"
+ "send:send stdin to <pm_id>"
+ "attach:attach stdin/stdout to application identified by <pm_id>"
+ "resurrect:resurrect previously dumped processes"
+ "unstartup:disable the pm2 startup hook"
+ "startup:enable the pm2 startup hook"
+ "logrotate:copy default logrotate configuration"
+ "ecosystem:generate a process conf file. (mode = null or simple)"
+ "reset:reset counters for process"
+ "describe:describe all parameters of a process id"
+ "list:list all processes"
+ "jlist:list all processes in JSON format"
+ "prettylist:print json in a prettified JSON"
+ "monit:launch termcaps monitoring"
+ "imonit:launch legacy termcaps monitoring"
+ "dashboard:launch dashboard with monitoring and logs"
+ "flush:flush logs"
+ "reloadLogs:reload all logs"
+ "logs:stream logs file. Default stream all logs"
+ "kill:kill daemon"
+ "pull:updates repository for a given app"
+ "forward:updates repository to the next commit for a given app"
+ "backward:downgrades repository to the previous commit for a given app"
+ "deepUpdate:performs a deep update of PM2"
+ "serve:serve a directory over http via port"
+ "examples:display pm2 usage examples"
+)
+
+local -a id_names
+
+_id_names() {
+ local app_list
+ app_list=`pm2 list -m`
+
+ local -a names ids
+ names=(`echo $app_list | grep '+---' | awk '{print $2}'`)
+ ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`)
+
+ if (( ${#ids} > 0 )); then
+ for i in {1..${#ids}}; do
+ id_names+=( "${ids[i]}:${names[i]}" )
+ done
+ fi
+}
+
+_arguments \
+ '(-v --version)'{-v,--version}'[output version]' \
+ '(-h --help)'{-h,--help}'[output usage information]' \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe "command" _1st_arguments
+ return
+fi
+
+local -a id_comp id_all_comp id_all_files_comp start_options logs_options
+id_comp=('1: :->id_comp')
+id_all_comp=('1: :->id_all_comp')
+id_all_files_comp=('1: :->id_all_files_comp')
+start_options=(
+ '--watch[Watch folder for changes]'
+ '--fresh[Rebuild Dockerfile]'
+ '--daemon[Run container in Daemon mode (debug purposes)]'
+ '--container[Start application in container mode]'
+ '--dist[with --container; change local Dockerfile to containerize all files in current directory]'
+ '--image-name[with --dist; set the exported image name]'
+ '--node-version[with --container, set a specific major Node.js version]'
+ '--dockerdaemon[for debugging purpose]'
+ '(-h --help)'{-h,--help}'[output usage information]'
+ $id_all_files_comp
+)
+logs_options=(
+ '--json[json log output]'
+ '--format[formated log output]'
+ '--raw[raw output]'
+ '--err[only shows error output]'
+ '--out[only shows standard output]'
+ '--lines[output the last N lines, instead of the last 15 by default]'
+ '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]'
+ '--nostream[print logs without lauching the log stream]'
+ '(-h --help)'{-h,--help}'[output usage information]'
+ $id_all_comp
+)
+
+case "$words[1]" in
+ start)
+ _arguments $start_options && return 0
+ ;;
+ logs)
+ _arguments $logs_options && return 0
+ ;;
+ stop|restart|delete|reload|reset)
+ _arguments $id_all_comp && return 0
+ ;;
+ env|inspect|monitor|unmonitor|discribe)
+ _arguments $id_comp && return 0
+ ;;
+ deploy|startOrRestart|startOrReload)
+ _files ;;
+esac
+
+case "$state" in
+ id_comp)
+ _id_names
+ _alternative \
+ 'args:app args:(($id_names))'
+ ;;
+ id_all_comp)
+ _id_names
+ id_names+=(all)
+ _alternative \
+ 'args:app args:(($id_names))'
+ ;;
+ id_all_files_comp)
+ _id_names
+ id_names+=(all)
+ _alternative \
+ 'args:app args:(($id_names))' \
+ 'files:filename:_files'
+ ;;
+esac
diff --git a/plugins/pm2/pm2.plugin.zsh b/plugins/pm2/pm2.plugin.zsh
new file mode 100644
index 000000000..f05d8db8b
--- /dev/null
+++ b/plugins/pm2/pm2.plugin.zsh
@@ -0,0 +1,6 @@
+alias p2s='pm2 start'
+alias p2o='pm2 stop'
+alias p2d='pm2 delete'
+alias p2r='pm2 restart'
+alias p2i='pm2 list'
+alias p2l='pm2 logs'
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index c3c1474c1..276eb6f91 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -1,3 +1,6 @@
+# python command
+alias py='python'
+
# Find python file
alias pyfind='find . -name "*.py"'
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index 5b0be4f85..29b413434 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -52,10 +52,14 @@ alias ru='rails runner'
alias rs='rails server'
alias rsd='rails server --debugger'
alias rsp='rails server --port'
+alias rsb='rails server --bind'
# Rake aliases
alias rdm='rake db:migrate'
+alias rdmr='rake db:migrate:redo'
+alias rdmd='rake db:migrate:down'
alias rdms='rake db:migrate:status'
+alias rdmu='rake db:migrate:up'
alias rdr='rake db:rollback'
alias rdc='rake db:create'
alias rds='rake db:seed'
diff --git a/plugins/samtools/README.md b/plugins/samtools/README.md
new file mode 100644
index 000000000..f4baf41f7
--- /dev/null
+++ b/plugins/samtools/README.md
@@ -0,0 +1,5 @@
+# Samtools plugin
+
+This plugin adds support for [samtools](http://www.htslib.org/):
+
+* Adds autocomplete options for all samtools sub commands.
diff --git a/plugins/samtools/_samtools b/plugins/samtools/_samtools
new file mode 100644
index 000000000..ddb002ae2
--- /dev/null
+++ b/plugins/samtools/_samtools
@@ -0,0 +1,40 @@
+#compdef samtools
+#autoload
+
+local curcontext="$curcontext" state line ret=1
+local -a _files
+
+_arguments -C \
+ '1: :->cmds' \
+ '2:: :->args' && ret=0
+
+case $state in
+ cmds)
+ _values "samtools command" \
+ "view[SAM<->BAM conversion]" \
+ "sort[sort alignment file]" \
+ "mpileup[multi-way pileup]" \
+ "depth[compute the depth]" \
+ "faidx[index/extract FASTA]" \
+ "tview[text alignment viewer]" \
+ "index[index alignment]" \
+ "idxstats[BAM index stats (r595 or later)]" \
+ "fixmate[fix mate information]" \
+ "flagstat[simple stats]" \
+ "calmd[recalculate MD/NM tags and '=' bases]" \
+ "merge[merge sorted alignments]" \
+ "rmdup[remove PCR duplicates]" \
+ "reheader[replace BAM header]" \
+ "cat[concatenate BAMs]" \
+ "bedcov[read depth per BED region]" \
+ "targetcut[cut fosmid regions (for fosmid pool only)]" \
+ "phase[phase heterozygotes]" \
+ "bamshuf[shuffle and group alignments by name]"
+ ret=0
+ ;;
+ *)
+ _files
+ ;;
+esac
+
+return ret
diff --git a/plugins/supervisor/supervisor.plugin.zsh b/plugins/supervisor/supervisor.plugin.zsh
index cf1997c5b..f11f0ed3f 100644
--- a/plugins/supervisor/supervisor.plugin.zsh
+++ b/plugins/supervisor/supervisor.plugin.zsh
@@ -1 +1,14 @@
# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor.
+
+alias sup='sudo supervisorctl'
+alias supad='sudo supervisorctl add'
+alias supa='sudo supervisorctl avail'
+alias suprl='sudo supervisorctl reload'
+alias suprm='sudo supervisorctl remove'
+alias suprr='sudo supervisorctl reread'
+alias suprs='sudo supervisorctl restart'
+alias sups='sudo supervisorctl status'
+alias supsr='sudo supervisorctl start'
+alias supso='sudo supervisorctl stop'
+alias supt='sudo supervisorctl tail'
+alias supu='sudo supervisorctl update'
diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh
index b8586c70d..2ab4eb6e2 100644
--- a/plugins/thefuck/thefuck.plugin.zsh
+++ b/plugins/thefuck/thefuck.plugin.zsh
@@ -5,7 +5,8 @@ if [[ -z $commands[thefuck] ]]; then
fi
# Register alias
-eval "$(thefuck --alias)"
+[[ ! -a $ZSH_CACHE_DIR/thefuck ]] && thefuck --alias > $ZSH_CACHE_DIR/thefuck
+source $ZSH_CACHE_DIR/thefuck
fuck-command-line() {
local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh
index a53752fb2..989ffd1ff 100644
--- a/plugins/ubuntu/ubuntu.plugin.zsh
+++ b/plugins/ubuntu/ubuntu.plugin.zsh
@@ -15,6 +15,9 @@ alias agli='apt list --installed'
# List available updates only
alias aglu='apt list --upgradable'
+alias acsp='apt-cache showpkg'
+compdef _acsp acsp='apt-cache showpkg'
+
# superuser operations ######################################################
alias afu='sudo apt-file update'
diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
index 3e16dbebf..e88835506 100644
--- a/plugins/vagrant/_vagrant
+++ b/plugins/vagrant/_vagrant
@@ -69,7 +69,7 @@ __box_list ()
__vm_list ()
{
- _wanted application expl 'command' compadd $(command grep "${VAGRANT_CWD:-.}/Vagrantfile" -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
+ _wanted application expl 'command' compadd $(command grep "${VAGRANT_CWD:-.}/Vagrantfile" -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9\._-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}')
_wanted application expl 'command' compadd $(command ls "${VAGRANT_CWD:-.}/.vagrant/machines/" 2>/dev/null)
}
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 88217a7f5..c30216f51 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -35,27 +35,19 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
function workon_cwd {
if [[ -z "$WORKON_CWD" ]]; then
local WORKON_CWD=1
- # Check if this is a Git repo
- local GIT_REPO_ROOT=""
- local GIT_TOPLEVEL="$(git rev-parse --show-toplevel 2> /dev/null)"
- if [[ $? == 0 ]]; then
- GIT_REPO_ROOT="$GIT_TOPLEVEL"
- fi
# Get absolute path, resolving symlinks
local PROJECT_ROOT="${PWD:A}"
while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \
- && ! -d "$PROJECT_ROOT/.git" && "$PROJECT_ROOT" != "$GIT_REPO_ROOT" ]]; do
+ && ! -d "$PROJECT_ROOT/.git" ]]; do
PROJECT_ROOT="${PROJECT_ROOT:h}"
done
- if [[ "$PROJECT_ROOT" == "/" ]]; then
- PROJECT_ROOT="."
- fi
+
# Check for virtualenv name override
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
ENV_NAME="$(cat "$PROJECT_ROOT/.venv")"
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
ENV_NAME="$PROJECT_ROOT/.venv"
- elif [[ "$PROJECT_ROOT" != "." ]]; then
+ elif [[ "$PROJECT_ROOT" != "/" ]]; then
ENV_NAME="${PROJECT_ROOT:t}"
else
ENV_NAME=""
@@ -68,14 +60,21 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
fi
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active
- if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
+ if [[ ! "$VIRTUAL_ENV" -ef "$WORKON_HOME/$ENV_NAME" ]]; then
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
+ else
+ ENV_NAME=""
fi
fi
fi
+ if [[ "$ENV_NAME" == "" && -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
+ # We've just left the repo, deactivate the environment
+ # Note: this only happens if the virtualenv was activated automatically
+ deactivate && unset CD_VIRTUAL_ENV
+ fi
fi
}
diff --git a/plugins/zoxide/README.md b/plugins/zoxide/README.md
new file mode 100644
index 000000000..f326effe6
--- /dev/null
+++ b/plugins/zoxide/README.md
@@ -0,0 +1,14 @@
+# zoxide plugin
+
+Initializes [zoxide](https://github.com/ajeetdsouza/zoxide), a smarter cd
+command for your terminal.
+
+![Tutorial](https://raw.githubusercontent.com/ajeetdsouza/zoxide/97dc08347d9dbf5b5a4516b79e0ac27366b962ce/contrib/tutorial.webp)
+
+To use it, add `zoxide` to the plugins array in your `.zshrc` file:
+
+```zsh
+plugins=(... zoxide)
+```
+
+**Note:** you have to [install zoxide](https://github.com/ajeetdsouza/zoxide#step-1-install-zoxide) first.
diff --git a/plugins/zoxide/zoxide.plugin.zsh b/plugins/zoxide/zoxide.plugin.zsh
new file mode 100644
index 000000000..e5658b8f0
--- /dev/null
+++ b/plugins/zoxide/zoxide.plugin.zsh
@@ -0,0 +1,5 @@
+if (( $+commands[zoxide] )); then
+ eval "$(zoxide init zsh)"
+else
+ echo '[oh-my-zsh] zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide'
+fi