Populate repo
This commit is contained in:
8
zsh/.oh-my-zsh/plugins/adb/README.md
Normal file
8
zsh/.oh-my-zsh/plugins/adb/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# adb autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all adb commands.
|
||||
* Add autocomplete for `adb -s`
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have the Android adb tools set up in your path.
|
67
zsh/.oh-my-zsh/plugins/adb/_adb
Normal file
67
zsh/.oh-my-zsh/plugins/adb/_adb
Normal file
@ -0,0 +1,67 @@
|
||||
#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'
|
||||
'get-devpath:print the device path'
|
||||
'get-serialno:print the serial number of the device'
|
||||
'get-state:print the current state of the device: offline | bootloader | device'
|
||||
'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'
|
||||
'keygen:generate adb public/private key'
|
||||
'kill-server:kill the server if it is running'
|
||||
'logcat:view device log'
|
||||
'pull:copy file/dir from device'
|
||||
'push:copy file/dir to device'
|
||||
'reboot:reboots the device, optionally into the bootloader or recovery program'
|
||||
'reboot-bootloader:reboots the device into the bootloader'
|
||||
'remount:remounts the partitions on the device read-write'
|
||||
'root:restarts the adbd daemon with root permissions'
|
||||
'sideload:push a ZIP to device and install it'
|
||||
'shell:run remote shell interactively'
|
||||
'sync:copy host->device only if changed (-l means list but dont copy)'
|
||||
'start-server:ensure that there is a server running'
|
||||
'tcpip:restart host adb in tcpip mode'
|
||||
'uninstall:remove this app package from the device'
|
||||
'usb:restart the adbd daemon listing on USB'
|
||||
'version:show version num'
|
||||
'wait-for-device:block until device is online'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a pkgs installed_pkgs
|
||||
|
||||
_arguments \
|
||||
'-s[devices]:specify device:->specify_device' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
case "$state" in
|
||||
specify_device)
|
||||
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
|
||||
{sub(/ +/," ",$0); \
|
||||
gsub(":","\\:",$1); \
|
||||
for(i=1;i<=NF;i++) {
|
||||
if($i ~ /model:/) { split($i,m,":") } \
|
||||
else if($i ~ /product:/) { split($i,p,":") } } \
|
||||
printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "adb subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
_files
|
13
zsh/.oh-my-zsh/plugins/ag/README.md
Normal file
13
zsh/.oh-my-zsh/plugins/ag/README.md
Normal file
@ -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=(... ag)
|
||||
```
|
||||
|
||||
## INSTALLATION NOTES
|
||||
|
||||
Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
|
66
zsh/.oh-my-zsh/plugins/ag/_ag
Normal file
66
zsh/.oh-my-zsh/plugins/ag/_ag
Normal file
@ -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
|
||||
}
|
46
zsh/.oh-my-zsh/plugins/alias-finder/README.md
Normal file
46
zsh/.oh-my-zsh/plugins/alias-finder/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# alias-finder plugin
|
||||
|
||||
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||
|
||||
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||
```
|
||||
plugins=(... alias-finder)
|
||||
```
|
||||
|
||||
## Usage
|
||||
To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
|
||||
|
||||
## Options
|
||||
|
||||
- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
|
||||
- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
|
||||
|
||||
## Examples
|
||||
```
|
||||
$ alias-finder "git pull"
|
||||
gl='git pull'
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ alias-finder "web_search google oh my zsh"
|
||||
google='web_search google'
|
||||
```
|
||||
```
|
||||
$ alias-finder "git commit -v"
|
||||
gc="git commit -v"
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ alias-finder -e "git commit -v"
|
||||
gc='git commit -v'
|
||||
```
|
||||
```
|
||||
$ alias-finder -l "git commit -v"
|
||||
gc='git commit -v'
|
||||
'gc!'='git commit -v --amend'
|
||||
gca='git commit -v -a'
|
||||
'gca!'='git commit -v -a --amend'
|
||||
'gcan!'='git commit -v -a --no-edit --amend'
|
||||
'gcans!'='git commit -v -a -s --no-edit --amend'
|
||||
'gcn!'='git commit -v --no-edit --amend'
|
||||
```
|
47
zsh/.oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
Normal file
47
zsh/.oh-my-zsh/plugins/alias-finder/alias-finder.plugin.zsh
Normal file
@ -0,0 +1,47 @@
|
||||
alias-finder() {
|
||||
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
||||
for i in $@; do
|
||||
case $i in
|
||||
-e|--exact) exact=true;;
|
||||
-l|--longer) longer=true;;
|
||||
*)
|
||||
if [[ -z $cmd ]]; then
|
||||
cmd=$i
|
||||
else
|
||||
cmd="$cmd $i"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
||||
if (( $(wc -l <<< $cmd) == 1 )); then
|
||||
while [[ $cmd != "" ]]; do
|
||||
if [[ $longer = true ]]; then
|
||||
wordStart="'{0,1}"
|
||||
else
|
||||
wordEnd="$"
|
||||
multiWordEnd="'$"
|
||||
fi
|
||||
if [[ $cmd == *" "* ]]; then
|
||||
local finder="'$cmd$multiWordEnd"
|
||||
else
|
||||
local finder=$wordStart$cmd$wordEnd
|
||||
fi
|
||||
alias | grep -E "=$finder"
|
||||
if [[ $exact = true || $longer = true ]]; then
|
||||
break
|
||||
else
|
||||
cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
preexec_alias-finder() {
|
||||
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
alias-finder $1
|
||||
fi
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook preexec preexec_alias-finder
|
21
zsh/.oh-my-zsh/plugins/aliases/README.md
Normal file
21
zsh/.oh-my-zsh/plugins/aliases/README.md
Normal file
@ -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
|
||||
```
|
10
zsh/.oh-my-zsh/plugins/aliases/aliases.plugin.zsh
Normal file
10
zsh/.oh-my-zsh/plugins/aliases/aliases.plugin.zsh
Normal file
@ -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 $@
|
||||
}
|
55
zsh/.oh-my-zsh/plugins/aliases/cheatsheet.py
Normal file
55
zsh/.oh-my-zsh/plugins/aliases/cheatsheet.py
Normal file
@ -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)
|
168
zsh/.oh-my-zsh/plugins/aliases/termcolor.py
Normal file
168
zsh/.oh-my-zsh/plugins/aliases/termcolor.py
Normal file
@ -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'])
|
||||
|
34
zsh/.oh-my-zsh/plugins/ansible/README.md
Normal file
34
zsh/.oh-my-zsh/plugins/ansible/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# ansible plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
|
||||
|
||||
To use it, add `ansible` to the plugins array of your zshrc file:
|
||||
|
||||
```
|
||||
plugins=(... ansible)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Command | Description |
|
||||
|:-------------------------------------------|:--------------------------------------------------------------------|
|
||||
| `ansible-version` / `aver` | Show the version on ansible installed in this host |
|
||||
| `ansible-role-init <role name>` / `arinit` | Creates the Ansible Role as per Ansible Galaxy standard |
|
||||
| `a` | command `ansible` |
|
||||
| `aconf` | command `ansible-config` |
|
||||
| `acon` | command `ansible-console` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `aplaybook` | command `ansible-playbook` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `adoc` | command `ansible-doc` |
|
||||
| `agal` | command `ansible-galaxy` |
|
||||
| `apull` | command `ansible-pull` |
|
||||
| `aval` | command `ansible-vault` |
|
||||
|
||||
## Maintainer
|
||||
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
|
||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
28
zsh/.oh-my-zsh/plugins/ansible/ansible.plugin.zsh
Normal file
28
zsh/.oh-my-zsh/plugins/ansible/ansible.plugin.zsh
Normal file
@ -0,0 +1,28 @@
|
||||
# Functions
|
||||
function ansible-version(){
|
||||
ansible --version
|
||||
}
|
||||
|
||||
function ansible-role-init(){
|
||||
if ! [ -z $1 ] ; then
|
||||
echo "Ansible Role : $1 Creating...."
|
||||
ansible-galaxy init $1
|
||||
tree $1
|
||||
else
|
||||
echo "Usage : ansible-role-init <role name>"
|
||||
echo "Example : ansible-role-init role1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Alias
|
||||
alias a='ansible '
|
||||
alias aconf='ansible-config '
|
||||
alias acon='ansible-console '
|
||||
alias aver='ansible-version'
|
||||
alias arinit='ansible-role-init'
|
||||
alias aplaybook='ansible-playbook '
|
||||
alias ainv='ansible-inventory '
|
||||
alias adoc='ansible-doc '
|
||||
alias agal='ansible-galaxy '
|
||||
alias apull='ansible-pull '
|
||||
alias aval='ansible-vault'
|
12
zsh/.oh-my-zsh/plugins/ant/README.md
Normal file
12
zsh/.oh-my-zsh/plugins/ant/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Ant
|
||||
|
||||
This plugin provides completion for [Ant](https://ant.apache.org/).
|
||||
|
||||
To use it add ant to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... ant)
|
||||
```
|
||||
|
||||
It caches ant targets in a file named `.ant_targets`, you might want to add that to
|
||||
your `.gitignore` file.
|
16
zsh/.oh-my-zsh/plugins/ant/ant.plugin.zsh
Normal file
16
zsh/.oh-my-zsh/plugins/ant/ant.plugin.zsh
Normal file
@ -0,0 +1,16 @@
|
||||
_ant_does_target_list_need_generating () {
|
||||
[ ! -f .ant_targets ] && return 0;
|
||||
[ build.xml -nt .ant_targets ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_ant () {
|
||||
if [ -f build.xml ]; then
|
||||
if _ant_does_target_list_need_generating; then
|
||||
ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
|
||||
fi
|
||||
compadd -- `cat .ant_targets`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _ant ant
|
21
zsh/.oh-my-zsh/plugins/apache2-macports/README.md
Normal file
21
zsh/.oh-my-zsh/plugins/apache2-macports/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# apache2-macports plugin
|
||||
|
||||
Enables aliases to control a local Apache2 installed via [MacPorts](https://www.macports.org/).
|
||||
|
||||
To use it, add `apache2-macports` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... apache2-macports)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Function | Description |
|
||||
|----------------|-----------------------------------------|-----------------------|
|
||||
| apache2restart | `sudo /path/to/apache2.wrapper restart` | Restart apache daemon |
|
||||
| apache2start | `sudo /path/to/apache2.wrapper start` | Start apache daemon |
|
||||
| apache2stop | `sudo /path/to/apache2.wrapper stop` | Stop apache daemon |
|
||||
|
||||
## Contributors
|
||||
|
||||
- Alexander Rinass (alex@rinass.net)
|
@ -0,0 +1,6 @@
|
||||
# commands to control local apache2 server installation
|
||||
# paths are for osx installation via macports
|
||||
|
||||
alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
|
||||
alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
|
||||
alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'
|
41
zsh/.oh-my-zsh/plugins/arcanist/README.md
Normal file
41
zsh/.oh-my-zsh/plugins/arcanist/README.md
Normal file
@ -0,0 +1,41 @@
|
||||
## arcanist
|
||||
|
||||
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
|
||||
|
||||
To use it, add `arcanist` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... arcanist)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| ------- | ---------------------------------- |
|
||||
| ara | `arc amend` |
|
||||
| arb | `arc branch` |
|
||||
| arco | `arc cover` |
|
||||
| arci | `arc commit` |
|
||||
| ard | `arc diff` |
|
||||
| ardc | `arc diff --create` |
|
||||
| ardp | `arc diff --preview` |
|
||||
| ardnu | `arc diff --nounit` |
|
||||
| ardnupc | `arc diff --nounit --plan-changes` |
|
||||
| ardpc | `arc diff --plan-changes` |
|
||||
| are | `arc export` |
|
||||
| arh | `arc help` |
|
||||
| arl | `arc land` |
|
||||
| arli | `arc lint` |
|
||||
| arls | `arc list` |
|
||||
| arpa | `arc patch` |
|
||||
|
||||
## Functions
|
||||
|
||||
The following functions make copy pasting revision ids from the URL bar of your browser
|
||||
easier, as they allow for copy pasting the whole URL. For example: `ardu` accepts
|
||||
both `https://arcanist-url.com/<REVISION>` as well as `<REVISION>`.
|
||||
|
||||
| Function | Command |
|
||||
| ------------------------- | --------------------------------- |
|
||||
| ardu [URL or revision_id] | `arc diff --update` [revision_id] |
|
||||
| arpa [URL or revision_id] | `arc patch` [revision_id] |
|
37
zsh/.oh-my-zsh/plugins/arcanist/arcanist.plugin.zsh
Normal file
37
zsh/.oh-my-zsh/plugins/arcanist/arcanist.plugin.zsh
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
alias ara='arc amend'
|
||||
alias arb='arc branch'
|
||||
alias arco='arc cover'
|
||||
alias arci='arc commit'
|
||||
|
||||
alias ard='arc diff'
|
||||
alias ardc='arc diff --create'
|
||||
alias ardnu='arc diff --nounit'
|
||||
alias ardnupc='arc diff --nounit --plan-changes'
|
||||
alias ardpc='arc diff --plan-changes'
|
||||
alias ardp='arc diff --preview' # creates a new diff in the phab interface
|
||||
|
||||
alias are='arc export'
|
||||
alias arh='arc help'
|
||||
alias arl='arc land'
|
||||
alias arli='arc lint'
|
||||
alias arls='arc list'
|
||||
|
||||
#
|
||||
# Functions
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
ardu() {
|
||||
# Both `ardu https://arcanist-url.com/<REVISION>`, and `ardu <REVISION>` work.
|
||||
arc diff --update "${1:t}"
|
||||
}
|
||||
|
||||
arpa() {
|
||||
# Both `arpa https://arcanist-url.com/<REVISION>`, and `arpa <REVISION>` work.
|
||||
arc patch "${1:t}"
|
||||
}
|
172
zsh/.oh-my-zsh/plugins/archlinux/README.md
Normal file
172
zsh/.oh-my-zsh/plugins/archlinux/README.md
Normal file
@ -0,0 +1,172 @@
|
||||
# Arch Linux plugin
|
||||
|
||||
This plugin adds some aliases and functions to work with Arch Linux.
|
||||
|
||||
To use it, add `archlinux` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... archlinux)
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Pacman
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------------|----------------------------------------|------------------------------------------------------------------|
|
||||
| pacin | `sudo pacman -S` | Install packages from the repositories |
|
||||
| pacins | `sudo pacman -U` | Install a package from a local file |
|
||||
| pacinsd | `sudo pacman -S --asdeps` | Install packages as dependencies of another package |
|
||||
| pacloc | `pacman -Qi` | Display information about a package in the local database |
|
||||
| paclocs | `pacman -Qs` | Search for packages in the local database |
|
||||
| paclsorphans | `sudo pacman -Qdt` | List all orphaned packages |
|
||||
| pacmir | `sudo pacman -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| pacre | `sudo pacman -R` | Remove packages, keeping its settings and dependencies |
|
||||
| pacrem | `sudo pacman -Rns` | Remove packages, including its settings and dependencies |
|
||||
| pacrep | `pacman -Si` | Display information about a package in the repositories |
|
||||
| pacreps | `pacman -Ss` | Search for packages in the repositories |
|
||||
| pacrmorphans | `sudo pacman -Rs $(pacman -Qtdq)` | Delete all orphaned packages |
|
||||
| pacupd | `sudo pacman -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| pacupg | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
|
||||
| pacfileupg | `sudo pacman -Fy` | Download fresh package databases from the server |
|
||||
| pacfiles | `pacman -F` | Search package file names for matching strings |
|
||||
| pacls | `pacman -Ql` | List files in a package |
|
||||
| pacown | `pacman -Qo` | Show which package owns a file |
|
||||
| upgrade[¹](#f1) | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|-----------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all explicitly installed packages with a description |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | Locally trust all keys passed as parameters |
|
||||
| pacweb | Open the website of an ArchLinux package |
|
||||
|
||||
Note: paclist used to print packages with a description which are (1) explicitly installed
|
||||
and (2) available for upgrade. Due to flawed scripting, it also printed all packages if no
|
||||
upgrades were available. Use `pacman -Que` instead.
|
||||
|
||||
### AUR helpers
|
||||
|
||||
#### Aura
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-------------------------------------------------|-------------------------------------------------------------------------|
|
||||
| auin | `sudo aura -S` | Install packages from the repositories |
|
||||
| aurin | `sudo aura -A` | Install packages from the repositories |
|
||||
| auins | `sudo aura -U` | Install a package from a local file |
|
||||
| auinsd | `sudo aura -S --asdeps` | Install packages as dependencies of another package (repositories only) |
|
||||
| aurinsd | `sudo aura -A --asdeps` | Install packages as dependencies of another package (AUR only) |
|
||||
| auloc | `aura -Qi` | Display information about a package in the local database |
|
||||
| aulocs | `aura -Qs` | Search for packages in the local database |
|
||||
| auls | `aura -Qql` | List all files owned by a given package |
|
||||
| aulst | `aura -Qe` | List installed packages including from AUR (tagged as "local") |
|
||||
| aumir | `sudo aura -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| aurph | `sudo aura -Oj` | Remove orphans using aura |
|
||||
| auown | `aura -Qqo` | Search for packages that own the specified file(s) |
|
||||
| aure | `sudo aura -R` | Remove packages, keeping its settings and dependencies |
|
||||
| aurem | `sudo aura -Rns` | Remove packages, including its settings and unneeded dependencies |
|
||||
| aurep | `aura -Si` | Display information about a package in the repositories |
|
||||
| aurrep | `aura -Ai` | Display information about a package from AUR |
|
||||
| aureps | `aura -As --both` | Search for packages in the repositories and AUR |
|
||||
| auras | `aura -As --both` | Same as above |
|
||||
| auupd | `sudo aura -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| auupg | `sudo sh -c "aura -Syu && aura -Au"` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| ausu | `sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"` | Same as `auupg`, but without confirmation |
|
||||
| upgrade[¹](#f1) | `sudo aura -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|-----------------|---------------------------------------------------------------------|
|
||||
| auownloc _file_ | Display information about a package that owns the specified file(s) |
|
||||
| auownls _file_ | List all files owned by a package that owns the specified file(s) |
|
||||
|
||||
#### Pacaur
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-----------------------------------|---------------------------------------------------------------------|
|
||||
| pain | `pacaur -S` | Install packages from the repositories |
|
||||
| pains | `pacaur -U` | Install a package from a local file |
|
||||
| painsd | `pacaur -S --asdeps` | Install packages as dependencies of another package |
|
||||
| paloc | `pacaur -Qi` | Display information about a package in the local database |
|
||||
| palocs | `pacaur -Qs` | Search for packages in the local database |
|
||||
| palst | `pacaur -Qe` | List installed packages including from AUR (tagged as "local") |
|
||||
| pamir | `pacaur -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| paorph | `pacaur -Qtd` | Remove orphans using pacaur |
|
||||
| pare | `pacaur -R` | Remove packages, keeping its settings and dependencies |
|
||||
| parem | `pacaur -Rns` | Remove packages, including its settings and unneeded dependencies |
|
||||
| parep | `pacaur -Si` | Display information about a package in the repositories |
|
||||
| pareps | `pacaur -Ss` | Search for packages in the repositories |
|
||||
| paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation |
|
||||
| upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
#### Trizen
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-----------------------------------|---------------------------------------------------------------------|
|
||||
| trconf | `trizen -C` | Fix all configuration files with vimdiff |
|
||||
| trin | `trizen -S` | Install packages from the repositories |
|
||||
| trins | `trizen -U` | Install a package from a local file |
|
||||
| trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package |
|
||||
| trloc | `trizen -Qi` | Display information about a package in the local database |
|
||||
| trlocs | `trizen -Qs` | Search for packages in the local database |
|
||||
| trlst | `trizen -Qe` | List installed packages including from AUR (tagged as "local") |
|
||||
| trmir | `trizen -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| trorph | `trizen -Qtd` | Remove orphans using yaourt |
|
||||
| trre | `trizen -R` | Remove packages, keeping its settings and dependencies |
|
||||
| trrem | `trizen -Rns` | Remove packages, including its settings and unneeded dependencies |
|
||||
| trrep | `trizen -Si` | Display information about a package in the repositories |
|
||||
| trreps | `trizen -Ss` | Search for packages in the repositories |
|
||||
| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation |
|
||||
| upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
#### Yay
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|--------------------------------|-------------------------------------------------------------------|
|
||||
| yaconf | `yay -Pg` | Print current configuration |
|
||||
| yain | `yay -S` | Install packages from the repositories |
|
||||
| yains | `yay -U` | Install a package from a local file |
|
||||
| yainsd | `yay -S --asdeps` | Install packages as dependencies of another package |
|
||||
| yaloc | `yay -Qi` | Display information about a package in the local database |
|
||||
| yalocs | `yay -Qs` | Search for packages in the local database |
|
||||
| yalst | `yay -Qe` | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | `yay -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | `yay -Qtd` | Remove orphans using yay |
|
||||
| yare | `yay -R` | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | `yay -Rns` | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | `yay -Si` | Display information about a package in the repositories |
|
||||
| yareps | `yay -Ss` | Search for packages in the repositories |
|
||||
| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupg | `yay -Syu` | Sync with repositories before upgrading packages |
|
||||
| yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation |
|
||||
| upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
---
|
||||
|
||||
<span id="f1">¹</span>
|
||||
The `upgrade` alias is set for all package managers. Its value will depend on
|
||||
whether the package manager is installed, checked in the following order:
|
||||
|
||||
1. `yay`
|
||||
2. `trizen`
|
||||
3. `pacaur`
|
||||
4. `aura`
|
||||
5. `pacman`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- ratijas (ivan tkachenko) - me@ratijas.tk
|
||||
- Juraj Fiala - doctorjellyface@riseup.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Majora320 (Moses Miller) - Majora320@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
|
||||
- Jeff M. Hubbard - jeffmhubbard@gmail.com
|
174
zsh/.oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
Normal file
174
zsh/.oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
Normal file
@ -0,0 +1,174 @@
|
||||
#######################################
|
||||
# Pacman #
|
||||
#######################################
|
||||
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu'
|
||||
alias pacin='sudo pacman -S'
|
||||
alias pacins='sudo pacman -U'
|
||||
alias pacre='sudo pacman -R'
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
alias pacrep='pacman -Si'
|
||||
alias pacreps='pacman -Ss'
|
||||
alias pacloc='pacman -Qi'
|
||||
alias paclocs='pacman -Qs'
|
||||
alias pacinsd='sudo pacman -S --asdeps'
|
||||
alias pacmir='sudo pacman -Syy'
|
||||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
alias pacfileupg='sudo pacman -Fy'
|
||||
alias pacfiles='pacman -F'
|
||||
alias pacls='pacman -Ql'
|
||||
alias pacown='pacman -Qo'
|
||||
alias pacupd="sudo pacman -Sy"
|
||||
alias upgrade='sudo pacman -Syu'
|
||||
|
||||
function paclist() {
|
||||
# Based on https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
pacman -Qqe | \
|
||||
xargs -I '{}' \
|
||||
expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
|
||||
}
|
||||
|
||||
function pacdisowned() {
|
||||
local tmp db fs
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
|
||||
mkdir "$tmp"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
||||
|
||||
function pacmansignkeys() {
|
||||
local key
|
||||
for key in $@; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
|
||||
--no-permission-warning --command-fd 0 --edit-key $key
|
||||
done
|
||||
}
|
||||
|
||||
if (( $+commands[xdg-open] )); then
|
||||
function pacweb() {
|
||||
if [[ $# = 0 || "$1" =~ '--help|-h' ]]; then
|
||||
local underline_color="\e[${color[underline]}m"
|
||||
echo "$0 - open the website of an ArchLinux package"
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo " $bold_color$0$reset_color ${underline_color}target${reset_color}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local pkg="$1"
|
||||
local infos="$(LANG=C pacman -Si "$pkg")"
|
||||
if [[ -z "$infos" ]]; then
|
||||
return
|
||||
fi
|
||||
local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
|
||||
}
|
||||
fi
|
||||
|
||||
#######################################
|
||||
# AUR helpers #
|
||||
#######################################
|
||||
|
||||
if (( $+commands[aura] )); then
|
||||
alias auin='sudo aura -S'
|
||||
alias aurin='sudo aura -A'
|
||||
alias auins='sudo aura -U'
|
||||
alias auinsd='sudo aura -S --asdeps'
|
||||
alias aurinsd='sudo aura -A --asdeps'
|
||||
alias auloc='aura -Qi'
|
||||
alias aulocs='aura -Qs'
|
||||
alias aulst='aura -Qe'
|
||||
alias aumir='sudo aura -Syy'
|
||||
alias aurph='sudo aura -Oj'
|
||||
alias aure='sudo aura -R'
|
||||
alias aurem='sudo aura -Rns'
|
||||
alias aurep='aura -Si'
|
||||
alias aurrep='aura -Ai'
|
||||
alias aureps='aura -As --both'
|
||||
alias auras='aura -As --both'
|
||||
alias auupd="sudo aura -Sy"
|
||||
alias auupg='sudo sh -c "aura -Syu && aura -Au"'
|
||||
alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
|
||||
alias upgrade='sudo aura -Syu'
|
||||
|
||||
# extra bonus specially for aura
|
||||
alias auown="aura -Qqo"
|
||||
alias auls="aura -Qql"
|
||||
function auownloc() { aura -Qi $(aura -Qqo $@); }
|
||||
function auownls () { aura -Qql $(aura -Qqo $@); }
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
alias paupg='pacaur -Syu'
|
||||
alias pasu='pacaur -Syu --noconfirm'
|
||||
alias pain='pacaur -S'
|
||||
alias pains='pacaur -U'
|
||||
alias pare='pacaur -R'
|
||||
alias parem='pacaur -Rns'
|
||||
alias parep='pacaur -Si'
|
||||
alias pareps='pacaur -Ss'
|
||||
alias paloc='pacaur -Qi'
|
||||
alias palocs='pacaur -Qs'
|
||||
alias palst='pacaur -Qe'
|
||||
alias paorph='pacaur -Qtd'
|
||||
alias painsd='pacaur -S --asdeps'
|
||||
alias pamir='pacaur -Syy'
|
||||
alias paupd="pacaur -Sy"
|
||||
alias upgrade='pacaur -Syu'
|
||||
fi
|
||||
|
||||
if (( $+commands[trizen] )); then
|
||||
alias trconf='trizen -C'
|
||||
alias trupg='trizen -Syua'
|
||||
alias trsu='trizen -Syua --noconfirm'
|
||||
alias trin='trizen -S'
|
||||
alias trins='trizen -U'
|
||||
alias trre='trizen -R'
|
||||
alias trrem='trizen -Rns'
|
||||
alias trrep='trizen -Si'
|
||||
alias trreps='trizen -Ss'
|
||||
alias trloc='trizen -Qi'
|
||||
alias trlocs='trizen -Qs'
|
||||
alias trlst='trizen -Qe'
|
||||
alias trorph='trizen -Qtd'
|
||||
alias trinsd='trizen -S --asdeps'
|
||||
alias trmir='trizen -Syy'
|
||||
alias trupd="trizen -Sy"
|
||||
alias upgrade='trizen -Syu'
|
||||
fi
|
||||
|
||||
if (( $+commands[yay] )); then
|
||||
alias yaconf='yay -Pg'
|
||||
alias yaupg='yay -Syu'
|
||||
alias yasu='yay -Syu --noconfirm'
|
||||
alias yain='yay -S'
|
||||
alias yains='yay -U'
|
||||
alias yare='yay -R'
|
||||
alias yarem='yay -Rns'
|
||||
alias yarep='yay -Si'
|
||||
alias yareps='yay -Ss'
|
||||
alias yaloc='yay -Qi'
|
||||
alias yalocs='yay -Qs'
|
||||
alias yalst='yay -Qe'
|
||||
alias yaorph='yay -Qtd'
|
||||
alias yainsd='yay -S --asdeps'
|
||||
alias yamir='yay -Syy'
|
||||
alias yaupd="yay -Sy"
|
||||
alias upgrade='yay -Syu'
|
||||
fi
|
27
zsh/.oh-my-zsh/plugins/asdf/README.md
Normal file
27
zsh/.oh-my-zsh/plugins/asdf/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
## asdf
|
||||
|
||||
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
|
||||
1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
|
||||
```
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:
|
||||
|
||||
```
|
||||
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git
|
||||
asdf install nodejs 5.9.1
|
||||
```
|
19
zsh/.oh-my-zsh/plugins/asdf/asdf.plugin.zsh
Normal file
19
zsh/.oh-my-zsh/plugins/asdf/asdf.plugin.zsh
Normal file
@ -0,0 +1,19 @@
|
||||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
||||
ASDF_DIR="$(brew --prefix asdf)"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
|
||||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
fi
|
||||
fi
|
20
zsh/.oh-my-zsh/plugins/autoenv/README.md
Normal file
20
zsh/.oh-my-zsh/plugins/autoenv/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Autoenv plugin
|
||||
|
||||
This plugin loads the [Autoenv](https://github.com/inishchith/autoenv).
|
||||
|
||||
To use it, add `autoenv` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... autoenv)
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
* `use_env()`: creates and/or activates a virtualenv. For use in `.env` files.
|
||||
See the source code for details.
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have the autoenv installed.
|
||||
|
||||
More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv).
|
71
zsh/.oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh
Normal file
71
zsh/.oh-my-zsh/plugins/autoenv/autoenv.plugin.zsh
Normal file
@ -0,0 +1,71 @@
|
||||
# Initialization: activate autoenv or report its absence
|
||||
() {
|
||||
local d autoenv_dir install_locations
|
||||
if ! type autoenv_init >/dev/null; then
|
||||
# Check if activate.sh is in $PATH
|
||||
if (( $+commands[activate.sh] )); then
|
||||
autoenv_dir="${commands[activate.sh]:h}"
|
||||
fi
|
||||
|
||||
# Locate autoenv installation
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
install_locations=(
|
||||
~/.autoenv
|
||||
~/.local/bin
|
||||
/usr/local/opt/autoenv
|
||||
/usr/local/bin
|
||||
/usr/share/autoenv-git
|
||||
~/Library/Python/bin
|
||||
)
|
||||
for d ( $install_locations ); do
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Look for Homebrew path as a last resort
|
||||
if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
|
||||
d=$(brew --prefix)/opt/autoenv
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
fi
|
||||
fi
|
||||
|
||||
# Complain if autoenv is not installed
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
cat <<END >&2
|
||||
-------- AUTOENV ---------
|
||||
Could not locate autoenv installation.
|
||||
Please check if autoenv is correctly installed.
|
||||
In the meantime the autoenv plugin is DISABLED.
|
||||
--------------------------
|
||||
END
|
||||
return 1
|
||||
fi
|
||||
# Load autoenv
|
||||
source $autoenv_dir/activate.sh
|
||||
fi
|
||||
}
|
||||
[[ $? != 0 ]] && return $?
|
||||
|
||||
# The use_env call below is a reusable command to activate/create a new Python
|
||||
# virtualenv, requiring only a single declarative line of code in your .env files.
|
||||
# It only performs an action if the requested virtualenv is not the current one.
|
||||
|
||||
use_env() {
|
||||
local venv
|
||||
venv="$1"
|
||||
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
|
||||
if workon | grep -q "$venv"; then
|
||||
workon "$venv"
|
||||
else
|
||||
echo -n "Create virtualenv $venv now? (Yn) "
|
||||
read answer
|
||||
if [[ "$answer" == "Y" ]]; then
|
||||
mkvirtualenv "$venv"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
11
zsh/.oh-my-zsh/plugins/autojump/README.md
Normal file
11
zsh/.oh-my-zsh/plugins/autojump/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Autojump plugin
|
||||
|
||||
This plugin loads the [autojump navigation tool](https://github.com/wting/autojump).
|
||||
|
||||
To use it, add `autojump` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... autojump)
|
||||
```
|
||||
|
||||
**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first.
|
35
zsh/.oh-my-zsh/plugins/autojump/autojump.plugin.zsh
Normal file
35
zsh/.oh-my-zsh/plugins/autojump/autojump.plugin.zsh
Normal file
@ -0,0 +1,35 @@
|
||||
declare -a autojump_paths
|
||||
autojump_paths=(
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||
)
|
||||
|
||||
for file in $autojump_paths; do
|
||||
if [[ -f "$file" ]]; then
|
||||
source "$file"
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# if no path found, try Homebrew
|
||||
if (( ! found && $+commands[brew] )); then
|
||||
file=$(brew --prefix)/etc/profile.d/autojump.sh
|
||||
if [[ -f "$file" ]]; then
|
||||
source "$file"
|
||||
found=1
|
||||
fi
|
||||
fi
|
||||
|
||||
(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
|
||||
|
||||
unset autojump_paths file found
|
8
zsh/.oh-my-zsh/plugins/autopep8/README.md
Normal file
8
zsh/.oh-my-zsh/plugins/autopep8/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# autopep8 plugin
|
||||
|
||||
This plugin adds completion for [autopep8](https://pypi.org/project/autopep8/), a tool that automatically formats Python code to conform to the [PEP 8](http://www.python.org/dev/peps/pep-0008/) style guide.
|
||||
|
||||
To use it, add autopep8 to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... autopep8)
|
||||
```
|
32
zsh/.oh-my-zsh/plugins/autopep8/_autopep8
Normal file
32
zsh/.oh-my-zsh/plugins/autopep8/_autopep8
Normal file
@ -0,0 +1,32 @@
|
||||
#compdef autopep8
|
||||
#
|
||||
# this is zsh completion function file.
|
||||
# generated by genzshcomp(ver: 0.5.1)
|
||||
#
|
||||
|
||||
typeset -A opt_args
|
||||
local context state line
|
||||
|
||||
_arguments -s -S \
|
||||
"--help[show this help message and exit]:" \
|
||||
"-h[show this help message and exit]:" \
|
||||
"--version[show program's version number and exit]:" \
|
||||
"--verbose[print verbose messages; multiple -v result in more verbose messages]" \
|
||||
"-v[print verbose messages; multiple -v result in more verbose messages]" \
|
||||
"--diff[print the diff for the fixed source]" \
|
||||
"-d[print the diff for the fixed source]" \
|
||||
"--in-place[make changes to files in place]" \
|
||||
"-i[make changes to files in place]" \
|
||||
"--recursive[run recursively; must be used with --in-place or --diff]" \
|
||||
"-r[run recursively; must be used with --in-place or --diff]" \
|
||||
"--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
|
||||
"-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
|
||||
"--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \
|
||||
"-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \
|
||||
"-a[-a result in more aggressive changes]::result:_files" \
|
||||
"--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \
|
||||
"--list-fixes[list codes for fixes; used by --ignore and --select]" \
|
||||
"--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \
|
||||
"--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \
|
||||
"--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \
|
||||
"*::args:_files"
|
75
zsh/.oh-my-zsh/plugins/aws/README.md
Normal file
75
zsh/.oh-my-zsh/plugins/aws/README.md
Normal file
@ -0,0 +1,75 @@
|
||||
# aws
|
||||
|
||||
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
|
||||
and a few utilities to manage AWS profiles and display them in the prompt.
|
||||
|
||||
To use it, add `aws` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... aws)
|
||||
```
|
||||
|
||||
## Plugin commands
|
||||
|
||||
* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
|
||||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
|
||||
Run `asp` without arguments to clear the profile.
|
||||
|
||||
* `acp [<profile>]`: in addition to `asp` functionality, it actually changes the profile by
|
||||
assuming the role specified in the `<profile>` configuration. It supports MFA and sets
|
||||
`$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if obtained. It
|
||||
requires the roles to be configured as per the
|
||||
[official guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html).
|
||||
Run `acp` without arguments to clear the profile.
|
||||
|
||||
* `agp`: gets the current value of `$AWS_PROFILE`.
|
||||
|
||||
* `aws_change_access_key`: changes the AWS access key of a profile.
|
||||
|
||||
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
|
||||
Used to provide completion for the `asp` function.
|
||||
|
||||
## Plugin options
|
||||
|
||||
* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
|
||||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||
see the AWS profile prompt.
|
||||
|
||||
## Theme
|
||||
|
||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||
the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
|
||||
|
||||
* ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
|
||||
|
||||
* ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
|
||||
|
||||
## Configuration
|
||||
|
||||
[Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
|
||||
|
||||
### Scenario: IAM roles with a source profile and MFA authentication
|
||||
|
||||
Source profile credentials in `~/.aws/credentials`:
|
||||
|
||||
```
|
||||
[source-profile-name]
|
||||
aws_access_key_id = ...
|
||||
aws_secret_access_key = ...
|
||||
```
|
||||
|
||||
Role configuration in `~/.aws/config`:
|
||||
|
||||
```
|
||||
[profile source-profile-name]
|
||||
mfa_serial = arn:aws:iam::111111111111:mfa/myuser
|
||||
region = us-east-1
|
||||
output = json
|
||||
|
||||
[profile profile-with-role]
|
||||
role_arn = arn:aws:iam::9999999999999:role/myrole
|
||||
mfa_serial = arn:aws:iam::111111111111:mfa/myuser
|
||||
source_profile = source-profile-name
|
||||
region = us-east-1
|
||||
output = json
|
||||
```
|
206
zsh/.oh-my-zsh/plugins/aws/aws.plugin.zsh
Normal file
206
zsh/.oh-my-zsh/plugins/aws/aws.plugin.zsh
Normal file
@ -0,0 +1,206 @@
|
||||
function agp() {
|
||||
echo $AWS_PROFILE
|
||||
}
|
||||
|
||||
# AWS profile selection
|
||||
function asp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
||||
local -a available_profiles
|
||||
available_profiles=($(aws_profiles))
|
||||
if [[ -z "${available_profiles[(r)$1]}" ]]; then
|
||||
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
|
||||
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
export AWS_EB_PROFILE=$1
|
||||
}
|
||||
|
||||
# AWS profile switch
|
||||
function acp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
|
||||
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
||||
local -a available_profiles
|
||||
available_profiles=($(aws_profiles))
|
||||
if [[ -z "${available_profiles[(r)$1]}" ]]; then
|
||||
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
|
||||
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local profile="$1"
|
||||
|
||||
# Get fallback credentials for if the aws command fails or no command is run
|
||||
local aws_access_key_id="$(aws configure get aws_access_key_id --profile $profile)"
|
||||
local aws_secret_access_key="$(aws configure get aws_secret_access_key --profile $profile)"
|
||||
local aws_session_token="$(aws configure get aws_session_token --profile $profile)"
|
||||
|
||||
|
||||
# First, if the profile has MFA configured, lets get the token and session duration
|
||||
local mfa_serial="$(aws configure get mfa_serial --profile $profile)"
|
||||
local sess_duration="$(aws configure get duration_seconds --profile $profile)"
|
||||
|
||||
if [[ -n "$mfa_serial" ]]; then
|
||||
local -a mfa_opt
|
||||
local mfa_token
|
||||
echo -n "Please enter your MFA token for $mfa_serial: "
|
||||
read -r mfa_token
|
||||
if [[ -z "$sess_duration" ]]; then
|
||||
echo -n "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role): "
|
||||
read -r sess_duration
|
||||
fi
|
||||
mfa_opt=(--serial-number "$mfa_serial" --token-code "$mfa_token" --duration-seconds "${sess_duration:-3600}")
|
||||
fi
|
||||
|
||||
# Now see whether we need to just MFA for the current role, or assume a different one
|
||||
local role_arn="$(aws configure get role_arn --profile $profile)"
|
||||
local sess_name="$(aws configure get role_session_name --profile $profile)"
|
||||
|
||||
if [[ -n "$role_arn" ]]; then
|
||||
# Means we need to assume a specified role
|
||||
aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}")
|
||||
|
||||
# Check whether external_id is configured to use while assuming the role
|
||||
local external_id="$(aws configure get external_id --profile $profile)"
|
||||
if [[ -n "$external_id" ]]; then
|
||||
aws_command+=(--external-id "$external_id")
|
||||
fi
|
||||
|
||||
# Get source profile to use to assume role
|
||||
local source_profile="$(aws configure get source_profile --profile $profile)"
|
||||
if [[ -z "$sess_name" ]]; then
|
||||
sess_name="${source_profile:-profile}"
|
||||
fi
|
||||
aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}")
|
||||
|
||||
echo "Assuming role $role_arn using profile ${source_profile:-profile}"
|
||||
else
|
||||
# Means we only need to do MFA
|
||||
aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}")
|
||||
echo "Obtaining session token for profile $profile"
|
||||
fi
|
||||
|
||||
# Format output of aws command for easier processing
|
||||
aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text)
|
||||
|
||||
# Run the aws command to obtain credentials
|
||||
local -a credentials
|
||||
credentials=(${(ps:\t:)"$(${aws_command[@]})"})
|
||||
|
||||
if [[ -n "$credentials" ]]; then
|
||||
aws_access_key_id="${credentials[1]}"
|
||||
aws_secret_access_key="${credentials[2]}"
|
||||
aws_session_token="${credentials[3]}"
|
||||
fi
|
||||
|
||||
# Switch to AWS profile
|
||||
if [[ -n "${aws_access_key_id}" && -n "$aws_secret_access_key" ]]; then
|
||||
export AWS_DEFAULT_PROFILE="$profile"
|
||||
export AWS_PROFILE="$profile"
|
||||
export AWS_EB_PROFILE="$profile"
|
||||
export AWS_ACCESS_KEY_ID="$aws_access_key_id"
|
||||
export AWS_SECRET_ACCESS_KEY="$aws_secret_access_key"
|
||||
|
||||
if [[ -n "$aws_session_token" ]]; then
|
||||
export AWS_SESSION_TOKEN="$aws_session_token"
|
||||
else
|
||||
unset AWS_SESSION_TOKEN
|
||||
fi
|
||||
|
||||
echo "Switched to AWS Profile: $profile"
|
||||
fi
|
||||
}
|
||||
|
||||
function aws_change_access_key() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "usage: $0 <profile>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Insert the credentials when asked."
|
||||
asp "$1" || return 1
|
||||
AWS_PAGER="" aws iam create-access-key
|
||||
AWS_PAGER="" aws configure --profile "$1"
|
||||
|
||||
echo "You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`"
|
||||
echo "Your current keys are:"
|
||||
AWS_PAGER="" aws iam list-access-keys
|
||||
}
|
||||
|
||||
function aws_profiles() {
|
||||
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
|
||||
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([-_[:alnum:]\.@]+)\][[:space:]]*$/\2/g'
|
||||
}
|
||||
|
||||
function _aws_profiles() {
|
||||
reply=($(aws_profiles))
|
||||
}
|
||||
compctl -K _aws_profiles asp acp aws_change_access_key
|
||||
|
||||
# AWS prompt
|
||||
function aws_prompt_info() {
|
||||
[[ -z $AWS_PROFILE ]] && return
|
||||
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
|
||||
}
|
||||
|
||||
if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then
|
||||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
|
||||
# Load awscli completions
|
||||
|
||||
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
||||
if command -v aws_completer &> /dev/null; then
|
||||
autoload -Uz bashcompinit && bashcompinit
|
||||
complete -C aws_completer aws
|
||||
else
|
||||
function _awscli-homebrew-installed() {
|
||||
# check if Homebrew is installed
|
||||
(( $+commands[brew] )) || return 1
|
||||
|
||||
# speculatively check default brew prefix
|
||||
if [ -h /usr/local/opt/awscli ]; then
|
||||
_brew_prefix=/usr/local/opt/awscli
|
||||
else
|
||||
# ok, it is not in the default prefix
|
||||
# this call to brew is expensive (about 400 ms), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix awscli)
|
||||
fi
|
||||
}
|
||||
|
||||
# get aws_zsh_completer.sh location from $PATH
|
||||
_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
|
||||
|
||||
# otherwise check common locations
|
||||
if [[ -z $_aws_zsh_completer_path ]]; then
|
||||
# Homebrew
|
||||
if _awscli-homebrew-installed; then
|
||||
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
|
||||
# Ubuntu
|
||||
elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
|
||||
_aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
|
||||
# NixOS
|
||||
elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then
|
||||
_aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh"
|
||||
# RPM
|
||||
else
|
||||
_aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
|
||||
unset _aws_zsh_completer_path _brew_prefix
|
||||
fi
|
29
zsh/.oh-my-zsh/plugins/battery/README.md
Normal file
29
zsh/.oh-my-zsh/plugins/battery/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Battery Plugin
|
||||
|
||||
This plugin adds some functions you can use to display battery information in your custom theme.
|
||||
|
||||
To use, add `battery` to the list of plugins in your `.zshrc` file:
|
||||
|
||||
`plugins=(... battery)`
|
||||
|
||||
Then, add the `battery_pct_prompt` function to your custom theme. For example:
|
||||
|
||||
```zsh
|
||||
RPROMPT='$(battery_pct_prompt) ...'
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.
|
||||
On Debian/Ubuntu, you can do that with `sudo apt install acpi` or `sudo apt install acpitool`.
|
||||
|
||||
- On Android (via [Termux](https://play.google.com/store/apps/details?id=com.termux)), you must have:
|
||||
|
||||
1. The `Termux:API` addon app installed:
|
||||
[Google Play](https://play.google.com/store/apps/details?id=com.termux.api) | [F-Droid](https://f-droid.org/packages/com.termux.api/)
|
||||
|
||||
2. The `termux-api` package installed within termux:
|
||||
|
||||
```sh
|
||||
pkg install termux-api
|
||||
```
|
262
zsh/.oh-my-zsh/plugins/battery/battery.plugin.zsh
Normal file
262
zsh/.oh-my-zsh/plugins/battery/battery.plugin.zsh
Normal file
@ -0,0 +1,262 @@
|
||||
###########################################
|
||||
# Battery plugin for oh-my-zsh #
|
||||
# Original Author: Peter hoeg (peterhoeg) #
|
||||
# Email: peter@speartail.com #
|
||||
###########################################
|
||||
# Author: Sean Jones (neuralsandwich) #
|
||||
# Email: neuralsandwich@gmail.com #
|
||||
# Modified to add support for Apple Mac #
|
||||
###########################################
|
||||
# Author: J (927589452) #
|
||||
# Modified to add support for FreeBSD #
|
||||
###########################################
|
||||
# Author: Avneet Singh (kalsi-avneet) #
|
||||
# Modified to add support for Android #
|
||||
###########################################
|
||||
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
function battery_is_charging() {
|
||||
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
|
||||
}
|
||||
function battery_pct() {
|
||||
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if battery_is_charging; then
|
||||
echo "External Power"
|
||||
else
|
||||
battery_pct
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
|
||||
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
if [ $timeremaining -gt 720 ]; then
|
||||
echo "::"
|
||||
else
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
fi
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt () {
|
||||
local battery_pct color
|
||||
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
function battery_is_charging() {
|
||||
[[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
|
||||
}
|
||||
function battery_pct() {
|
||||
if (( $+commands[sysctl] )); then
|
||||
sysctl -n hw.acpi.battery.life
|
||||
fi
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
local remaining_time
|
||||
remaining_time=$(sysctl -n hw.acpi.battery.time)
|
||||
if [[ $remaining_time -ge 0 ]]; then
|
||||
((hour = $remaining_time / 60 ))
|
||||
((minute = $remaining_time % 60 ))
|
||||
printf %02d:%02d $hour $minute
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )); then
|
||||
function battery_is_charging() {
|
||||
termux-battery-status 2>/dev/null | command awk '/status/ { exit ($0 ~ /DISCHARGING/) }'
|
||||
}
|
||||
function battery_pct() {
|
||||
# Sample output:
|
||||
# {
|
||||
# "health": "GOOD",
|
||||
# "percentage": 93,
|
||||
# "plugged": "UNPLUGGED",
|
||||
# "status": "DISCHARGING",
|
||||
# "temperature": 29.0,
|
||||
# "current": 361816
|
||||
# }
|
||||
termux-battery-status 2>/dev/null | command awk '/percentage/ { gsub(/[,]/,""); print $2}'
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() { } # Not available on android
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
elif [[ "$OSTYPE" = linux* ]]; then
|
||||
function battery_is_charging() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
! acpitool 2>/dev/null | command grep -qE '^\s+Battery.*Discharging'
|
||||
elif (( $+commands[acpi] )); then
|
||||
! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging'
|
||||
fi
|
||||
}
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
# Sample output:
|
||||
# Battery #1 : Unknown, 99.55%
|
||||
# Battery #2 : Discharging, 49.58%, 01:12:05
|
||||
# All batteries : 62.60%, 02:03:03
|
||||
local -i pct=$(acpitool 2>/dev/null | command awk -F, '
|
||||
/^\s+All batteries/ {
|
||||
gsub(/[^0-9.]/, "", $1)
|
||||
pct=$1
|
||||
exit
|
||||
}
|
||||
!pct && /^\s+Battery/ {
|
||||
gsub(/[^0-9.]/, "", $2)
|
||||
pct=$2
|
||||
}
|
||||
END { print pct }
|
||||
')
|
||||
echo $pct
|
||||
elif (( $+commands[acpi] )); then
|
||||
# Sample output:
|
||||
# Battery 0: Discharging, 0%, rate information unavailable
|
||||
# Battery 1: Full, 100%
|
||||
acpi 2>/dev/null | command awk -F, '
|
||||
/rate information unavailable/ { next }
|
||||
/^Battery.*: /{ gsub(/[^0-9]/, "", $2); print $2; exit }
|
||||
'
|
||||
fi
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ','
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
else
|
||||
# Empty functions so we don't cause errors in prompts
|
||||
function battery_is_charging { false }
|
||||
function battery_pct \
|
||||
battery_pct_remaining \
|
||||
battery_time_remaining \
|
||||
battery_pct_prompt { }
|
||||
fi
|
||||
|
||||
function battery_level_gauge() {
|
||||
local gauge_slots=${BATTERY_GAUGE_SLOTS:-10}
|
||||
local green_threshold=${BATTERY_GREEN_THRESHOLD:-$(( gauge_slots * 0.6 ))}
|
||||
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-$(( gauge_slots * 0.4 ))}
|
||||
local color_green=${BATTERY_COLOR_GREEN:-%F{green}}
|
||||
local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}}
|
||||
local color_red=${BATTERY_COLOR_RED:-%F{red}}
|
||||
local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}}
|
||||
local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['}
|
||||
local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'}
|
||||
local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'}
|
||||
local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'}
|
||||
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}
|
||||
local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'}
|
||||
|
||||
local -i battery_remaining_percentage=$(battery_pct)
|
||||
local filled empty gauge_color
|
||||
|
||||
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||
filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 ))
|
||||
empty=$(( $gauge_slots - $filled ))
|
||||
|
||||
if [[ $filled -gt $green_threshold ]]; then
|
||||
gauge_color=$color_green
|
||||
elif [[ $filled -gt $yellow_threshold ]]; then
|
||||
gauge_color=$color_yellow
|
||||
else
|
||||
gauge_color=$color_red
|
||||
fi
|
||||
else
|
||||
filled=$gauge_slots
|
||||
empty=0
|
||||
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}
|
||||
fi
|
||||
|
||||
local charging=' '
|
||||
battery_is_charging && charging=$charging_symbol
|
||||
|
||||
# Charging status and prefix
|
||||
print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color}
|
||||
# Filled slots
|
||||
[[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
|
||||
# Empty slots
|
||||
[[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
|
||||
# Suffix
|
||||
print -n ${color_reset}${battery_suffix}${color_reset}
|
||||
}
|
5
zsh/.oh-my-zsh/plugins/bazel/README.md
Normal file
5
zsh/.oh-my-zsh/plugins/bazel/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
## Bazel autocomplete plugin
|
||||
|
||||
A copy of the completion script from the
|
||||
[bazelbuild/bazel](https://github.com/bazelbuild/bazel/master/scripts/zsh_completion/_bazel)
|
||||
git repo.
|
341
zsh/.oh-my-zsh/plugins/bazel/_bazel
Normal file
341
zsh/.oh-my-zsh/plugins/bazel/_bazel
Normal file
@ -0,0 +1,341 @@
|
||||
#compdef bazel
|
||||
|
||||
# Copyright 2015 The Bazel Authors. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Installation
|
||||
# ------------
|
||||
#
|
||||
# 1. Add this script to a directory on your $fpath:
|
||||
# fpath[1,0]=~/.zsh/completion/
|
||||
# mkdir -p ~/.zsh/completion/
|
||||
# cp scripts/zsh_completion/_bazel ~/.zsh/completion
|
||||
#
|
||||
# 2. Optionally, add the following to your .zshrc.
|
||||
# zstyle ':completion:*' use-cache on
|
||||
# zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||
#
|
||||
# This way, the completion script does not have to parse Bazel's options
|
||||
# repeatedly. The directory in cache-path must be created manually.
|
||||
#
|
||||
# 3. Restart the shell
|
||||
#
|
||||
# Options
|
||||
# -------
|
||||
# completion:init:bazel:* cache-lifetime
|
||||
# Lifetime for the completion cache (if turned on, default: 1 week)
|
||||
|
||||
local curcontext="$curcontext" state line
|
||||
|
||||
: ${BAZEL_COMPLETION_PACKAGE_PATH:=%workspace%}
|
||||
: ${BAZEL:=bazel}
|
||||
_bazel_b() { ${BAZEL} --noblock_for_lock "$@" 2>/dev/null; }
|
||||
|
||||
# Default cache lifetime is 1 week
|
||||
zstyle -s ":completion:${curcontext}:" cache-lifetime lifetime
|
||||
if [[ -z "${lifetime}" ]]; then
|
||||
lifetime=$((60*60*24*7))
|
||||
fi
|
||||
|
||||
_bazel_cache_policy() {
|
||||
local -a oldp
|
||||
oldp=( "$1"(Nms+${lifetime}) )
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
_set_cache_policy() {
|
||||
zstyle -s ":completion:*:$curcontext*" cache-policy update_policy
|
||||
|
||||
if [[ -z "$update_policy" ]]; then
|
||||
zstyle ":completion:$curcontext*" cache-policy _bazel_cache_policy
|
||||
fi
|
||||
}
|
||||
|
||||
# Skips over all global arguments. After invocation, OFFSET contains the
|
||||
# position of the bazel command in $words.
|
||||
_adapt_subcommand_offset() {
|
||||
OFFSET=2
|
||||
for w in ${words[2,-1]}; do
|
||||
if [[ $w == (#b)-* ]]; then
|
||||
(( OFFSET++ ))
|
||||
else
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Retrieve the cache but also check that the value is not empty.
|
||||
_bazel_safe_retrieve_cache() {
|
||||
_retrieve_cache $1 && [[ ${(P)#2} -gt 0 ]]
|
||||
}
|
||||
|
||||
# Puts the name of the variable that contains the options for the bazel
|
||||
# subcommand handed in as the first argument into the global variable
|
||||
# _bazel_cmd_options.
|
||||
_bazel_get_options() {
|
||||
local lcmd=$1
|
||||
_bazel_cmd_options=_bazel_${lcmd}_options
|
||||
_bazel_cmd_args=_bazel_${lcmd}_args
|
||||
if [[ ${(P)#_bazel_cmd_options} != 0 ]]; then
|
||||
return
|
||||
fi
|
||||
if _cache_invalid BAZEL_${lcmd}_options || _cache_invalid BAZEL_${lcmd}_args \
|
||||
|| ! _bazel_safe_retrieve_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} \
|
||||
|| ! _retrieve_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}; then
|
||||
if ! eval "$(_bazel_b help completion)"; then
|
||||
return
|
||||
fi
|
||||
local opts_var
|
||||
if [[ $lcmd == "startup_options" ]]; then
|
||||
opts_var="BAZEL_STARTUP_OPTIONS"
|
||||
else
|
||||
opts_var="BAZEL_COMMAND_${lcmd:u}_FLAGS"
|
||||
fi
|
||||
local -a raw_options
|
||||
if ! eval "raw_options=(\${(@f)$opts_var})"; then
|
||||
return
|
||||
fi
|
||||
|
||||
local -a option_list
|
||||
for opt in $raw_options; do
|
||||
case $opt in
|
||||
--*"={"*)
|
||||
local lst="${${opt##*"={"}%"}"}"
|
||||
local opt="${opt%%=*}="
|
||||
option_list+=("${opt}:string:_values '' ${lst//,/ }") ;;
|
||||
--*=path)
|
||||
option_list+=("${opt%path}:path:_files") ;;
|
||||
--*=label)
|
||||
option_list+=("${opt%label}:target:_bazel_complete_target") ;;
|
||||
--*=*)
|
||||
option_list+=("${opt}:string:") ;;
|
||||
*)
|
||||
option_list+=("$opt") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
local -a cmd_args
|
||||
local cmd_type
|
||||
if eval "cmd_type=\${BAZEL_COMMAND_${lcmd:u}_ARGUMENT}" && [[ -n $cmd_type ]]; then
|
||||
case $cmd_type in
|
||||
label|label-*)
|
||||
cmd_args+=("*::${cmd_type}:_bazel_complete_target_${cmd_type//-/_}") ;;
|
||||
info-key)
|
||||
cmd_args+=('1::key:_bazel_info_key') ;;
|
||||
path)
|
||||
cmd_args+=('1::profile:_path_files') ;;
|
||||
"command|{"*"}")
|
||||
local lst=${${cmd_type#"command|{"}%"}"}
|
||||
cmd_args+=("1::topic:_bazel_help_topic -- ${lst//,/ }") ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
typeset -g "${_bazel_cmd_options}"="${(pj:|:)option_list[*]}"
|
||||
_store_cache BAZEL_${lcmd}_options ${_bazel_cmd_options}
|
||||
typeset -g "${_bazel_cmd_args}"="${(pj:|:)cmd_args[*]}"
|
||||
_store_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}
|
||||
fi
|
||||
}
|
||||
|
||||
_get_build_targets() {
|
||||
local pkg=$1
|
||||
local rule_re
|
||||
typeset -a completions
|
||||
case $target_type in
|
||||
test)
|
||||
rule_re=".*_test"
|
||||
;;
|
||||
build)
|
||||
rule_re=".*"
|
||||
;;
|
||||
bin)
|
||||
rule_re=".*_test|.*_binary"
|
||||
;;
|
||||
esac
|
||||
completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:})
|
||||
if ( (( ${#completions} > 0 )) && [[ $target_type != run ]] ); then
|
||||
completions+=(all)
|
||||
fi
|
||||
echo ${completions[*]}
|
||||
}
|
||||
|
||||
# Returns all packages that match $PREFIX. PREFIX may start with //, in which
|
||||
# case the workspace roots are searched. Otherwise, they are completed based on
|
||||
# PWD.
|
||||
_get_build_packages() {
|
||||
local workspace pfx
|
||||
typeset -a package_roots paths final_paths
|
||||
workspace=$PWD
|
||||
package_roots=(${(ps.:.)BAZEL_COMPLETION_PACKAGE_PATH})
|
||||
package_roots=(${^package_roots//\%workspace\%/$workspace})
|
||||
if [[ "${(e)PREFIX}" == //* ]]; then
|
||||
pfx=${(e)PREFIX[2,-1]}
|
||||
else
|
||||
pfx=${(e)PREFIX}
|
||||
fi
|
||||
paths=(${^package_roots}/${pfx}*(/))
|
||||
for p in ${paths[*]}; do
|
||||
if [[ -f ${p}/BUILD || -f ${p}/BUILD.bazel ]]; then
|
||||
final_paths+=(${p##*/}:)
|
||||
fi
|
||||
final_paths+=(${p##*/}/)
|
||||
done
|
||||
echo ${final_paths[*]}
|
||||
}
|
||||
|
||||
_package_remove_slash() {
|
||||
if [[ $KEYS == ':' && $LBUFFER == */ ]]; then
|
||||
LBUFFER=${LBUFFER[1,-2]}
|
||||
fi
|
||||
}
|
||||
|
||||
# Completion function for BUILD targets, called by the completion system.
|
||||
_bazel_complete_target() {
|
||||
local expl
|
||||
typeset -a packages targets
|
||||
if [[ "${(e)PREFIX}" != *:* ]]; then
|
||||
# There is no : in the prefix, completion can be either
|
||||
# a package or a target, if the cwd is a package itself.
|
||||
if [[ -f $PWD/BUILD || -f $PWD/BUILD.bazel ]]; then
|
||||
targets=($(_get_build_targets ""))
|
||||
_description build_target expl "BUILD target"
|
||||
compadd "${expl[@]}" -a targets
|
||||
fi
|
||||
packages=($(_get_build_packages))
|
||||
_description build_package expl "BUILD package"
|
||||
# Chop of the leading path segments from the prefix for display.
|
||||
compset -P '*/'
|
||||
compadd -R _package_remove_slash -S '' "${expl[@]}" -a packages
|
||||
else
|
||||
targets=($(_get_build_targets "${${(e)PREFIX}%:*}"))
|
||||
_description build_target expl "BUILD target"
|
||||
# Ignore the current prefix for the upcoming completion, since we only list
|
||||
# the names of the targets, not the full path.
|
||||
compset -P '*:'
|
||||
compadd "${expl[@]}" -a targets
|
||||
fi
|
||||
}
|
||||
|
||||
_bazel_complete_target_label() {
|
||||
typeset -g target_type=build
|
||||
_bazel_complete_target
|
||||
}
|
||||
|
||||
_bazel_complete_target_label_test() {
|
||||
typeset -g target_type=test
|
||||
_bazel_complete_target
|
||||
}
|
||||
|
||||
_bazel_complete_target_label_bin() {
|
||||
typeset -g target_type=bin
|
||||
_bazel_complete_target
|
||||
}
|
||||
|
||||
### Actual completion commands
|
||||
|
||||
_bazel() {
|
||||
_adapt_subcommand_offset
|
||||
if (( CURRENT - OFFSET > 0 )); then
|
||||
# Remember the subcommand name, stored globally so we can access it
|
||||
# from any subsequent function
|
||||
cmd=${words[OFFSET]//-/_}
|
||||
|
||||
# Set the context for the subcommand.
|
||||
curcontext="${curcontext%:*:*}:bazel-$cmd:"
|
||||
_set_cache_policy
|
||||
|
||||
# Narrow the range of words we are looking at to exclude cmd
|
||||
# name and any leading options
|
||||
(( CURRENT = CURRENT - OFFSET + 1 ))
|
||||
shift $((OFFSET - 1)) words
|
||||
# Run the completion for the subcommand
|
||||
_bazel_get_options $cmd
|
||||
_arguments : \
|
||||
${(Pps:|:)_bazel_cmd_options} \
|
||||
${(Pps:|:)_bazel_cmd_args}
|
||||
else
|
||||
_set_cache_policy
|
||||
# Start special handling for global options,
|
||||
# which can be retrieved by calling
|
||||
# $ bazel help startup_options
|
||||
_bazel_get_options startup_options
|
||||
_arguments : \
|
||||
${(Pps:|:)_bazel_cmd_options} \
|
||||
"*:commands:_bazel_commands"
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
_get_commands() {
|
||||
# bazel_cmd_list is a global (g) array (a)
|
||||
typeset -ga _bazel_cmd_list
|
||||
# Use `bazel help` instead of `bazel help completion` to get command
|
||||
# descriptions.
|
||||
if _bazel_cmd_list=("${(@f)$(_bazel_b help | awk '
|
||||
/Available commands/ { command=1; }
|
||||
/ [-a-z]+[ \t]+.+/ { if (command) { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" } }
|
||||
/^$/ { command=0; }')}"); then
|
||||
_store_cache BAZEL_commands _bazel_cmd_list
|
||||
fi
|
||||
}
|
||||
|
||||
# Completion function for bazel subcommands, called by the completion system.
|
||||
_bazel_commands() {
|
||||
if [[ ${#_bazel_cmd_list} == 0 ]]; then
|
||||
if _cache_invalid BAZEL_commands \
|
||||
|| ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then
|
||||
_get_commands
|
||||
fi
|
||||
fi
|
||||
|
||||
_describe -t bazel-commands 'Bazel command' _bazel_cmd_list
|
||||
}
|
||||
|
||||
# Completion function for bazel help options, called by the completion system.
|
||||
_bazel_help_topic() {
|
||||
if [[ ${#_bazel_cmd_list} == 0 ]]; then
|
||||
if _cache_invalid BAZEL_commands \
|
||||
|| ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then
|
||||
_get_commands
|
||||
fi
|
||||
fi
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == -- ]]; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
shift
|
||||
done
|
||||
_bazel_help_list=($@)
|
||||
_bazel_help_list+=($_bazel_cmd_list)
|
||||
_describe -t bazel-help 'Help topic' _bazel_help_list
|
||||
}
|
||||
|
||||
# Completion function for bazel info keys, called by the completion system.
|
||||
_bazel_info_key() {
|
||||
if [[ ${#_bazel_info_keys_list} == 0 ]]; then
|
||||
if _cache_invalid BAZEL_info_keys \
|
||||
|| ! _bazel_safe_retrieve_cache BAZEL_info_keys _bazel_info_keys_list; then
|
||||
typeset -ga _bazel_info_keys_list
|
||||
# Use `bazel help` instead of `bazel help completion` to get info-key
|
||||
# descriptions.
|
||||
if _bazel_info_keys_list=("${(@f)$(_bazel_b help info-keys | awk '
|
||||
{ printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" }')}"); then
|
||||
_store_cache BAZEL_info_keys _bazel_info_keys_list
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
_describe -t bazel-info 'Key' _bazel_info_keys_list
|
||||
}
|
20
zsh/.oh-my-zsh/plugins/bbedit/README.md
Normal file
20
zsh/.oh-my-zsh/plugins/bbedit/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
## bbedit
|
||||
|
||||
Plugin for BBEdit, an HTML and text editor for Mac OS X
|
||||
|
||||
### Requirements
|
||||
|
||||
* [BBEdit](https://www.barebones.com/products/bbedit/)
|
||||
* [BBEdit Command-Line Tools](https://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
|
21
zsh/.oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh
Normal file
21
zsh/.oh-my-zsh/plugins/bbedit/bbedit.plugin.zsh
Normal file
@ -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
|
||||
}
|
5
zsh/.oh-my-zsh/plugins/bedtools/README.md
Normal file
5
zsh/.oh-my-zsh/plugins/bedtools/README.md
Normal file
@ -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.
|
64
zsh/.oh-my-zsh/plugins/bedtools/_bedtools
Normal file
64
zsh/.oh-my-zsh/plugins/bedtools/_bedtools
Normal file
@ -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
|
54
zsh/.oh-my-zsh/plugins/bgnotify/README.md
Normal file
54
zsh/.oh-my-zsh/plugins/bgnotify/README.md
Normal file
@ -0,0 +1,54 @@
|
||||
# bgnotify zsh plugin
|
||||
|
||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
|
||||
|
||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
||||
|
||||
----------------------------------
|
||||
|
||||
## How to use!
|
||||
|
||||
Just add bgnotify to your plugins list in your `.zshrc`
|
||||
|
||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||
- On ubuntu you're already all set!
|
||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
**Linux**
|
||||
|
||||

|
||||
|
||||
**OS X**
|
||||
|
||||

|
||||
|
||||
**Windows**
|
||||
|
||||

|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
One can configure a few things:
|
||||
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||
- `function bgnotify_formatted` lets you change the notification
|
||||
|
||||
Use these by adding a function definition before the your call to source. Example:
|
||||
|
||||
~~~ sh
|
||||
bgnotify_threshold=4 ## set your own notification threshold
|
||||
|
||||
function bgnotify_formatted {
|
||||
## $1=exit_status, $2=command, $3=elapsed_time
|
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
|
||||
bgnotify "$title -- after $3 s" "$2";
|
||||
}
|
||||
|
||||
plugins=(git bgnotify) ## add to plugins list
|
||||
source $ZSH/oh-my-zsh.sh ## existing source call
|
||||
~~~
|
77
zsh/.oh-my-zsh/plugins/bgnotify/bgnotify.plugin.zsh
Normal file
77
zsh/.oh-my-zsh/plugins/bgnotify/bgnotify.plugin.zsh
Normal file
@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
## setup ##
|
||||
|
||||
[[ -o interactive ]] || return #interactive only!
|
||||
zmodload zsh/datetime || { print "can't load zsh/datetime"; return } # faster than date()
|
||||
autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return }
|
||||
|
||||
(( ${+bgnotify_threshold} )) || bgnotify_threshold=5 #default 10 seconds
|
||||
|
||||
|
||||
## definitions ##
|
||||
|
||||
if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override
|
||||
function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds)
|
||||
elapsed="$(( $3 % 60 ))s"
|
||||
(( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
[ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2"
|
||||
}
|
||||
fi
|
||||
|
||||
currentWindowId () {
|
||||
if hash osascript 2>/dev/null; then #osx
|
||||
osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0"
|
||||
elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu!
|
||||
xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0"
|
||||
else
|
||||
echo $EPOCHSECONDS #fallback for windows
|
||||
fi
|
||||
}
|
||||
|
||||
bgnotify () { ## args: (title, subtitle)
|
||||
if hash terminal-notifier 2>/dev/null; then #osx
|
||||
[[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
|
||||
[[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal';
|
||||
## now call terminal-notifier, (hopefully with $term_id!)
|
||||
[ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null ||
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
|
||||
elif hash growlnotify 2>/dev/null; then #osx growl
|
||||
growlnotify -m "$1" "$2"
|
||||
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
||||
notify-send "$1" "$2"
|
||||
elif hash kdialog 2>/dev/null; then #ubuntu kde!
|
||||
kdialog --title "$1" --passivepopup "$2" 5
|
||||
elif hash notifu 2>/dev/null; then #cygwyn support!
|
||||
notifu /m "$2" /p "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
## Zsh hooks ##
|
||||
|
||||
bgnotify_begin() {
|
||||
bgnotify_timestamp=$EPOCHSECONDS
|
||||
bgnotify_lastcmd="${1:-$2}"
|
||||
bgnotify_windowid=$(currentWindowId)
|
||||
}
|
||||
|
||||
bgnotify_end() {
|
||||
didexit=$?
|
||||
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||
past_threshold=$(( elapsed >= bgnotify_threshold ))
|
||||
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then
|
||||
if [ $(currentWindowId) != "$bgnotify_windowid" ]; then
|
||||
print -n "\a"
|
||||
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed"
|
||||
fi
|
||||
fi
|
||||
bgnotify_timestamp=0 #reset it to 0!
|
||||
}
|
||||
|
||||
## only enable if a local (non-ssh) connection
|
||||
if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
|
||||
add-zsh-hook preexec bgnotify_begin
|
||||
add-zsh-hook precmd bgnotify_end
|
||||
fi
|
6
zsh/.oh-my-zsh/plugins/boot2docker/README.md
Normal file
6
zsh/.oh-my-zsh/plugins/boot2docker/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
## Boot2docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all boot2docker commands.
|
||||
|
||||
|
||||
Maintainer : Manfred Touron ([@moul](https://github.com/moul))
|
73
zsh/.oh-my-zsh/plugins/boot2docker/_boot2docker
Normal file
73
zsh/.oh-my-zsh/plugins/boot2docker/_boot2docker
Normal file
@ -0,0 +1,73 @@
|
||||
#compdef boot2docker
|
||||
|
||||
# Boot2docker autocompletion for oh-my-zsh
|
||||
# Requires: Boot2docker installed
|
||||
# Author: Manfred Touron (@moul)
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
"init":"Create a new Boot2Docker VM."
|
||||
"up":"Start VM from any states."
|
||||
"start":"Start VM from any states."
|
||||
"boot":"Start VM from any states."
|
||||
"ssh":"[ssh-command] Login to VM via SSH."
|
||||
"save":"Suspend VM and save state to disk."
|
||||
"suspend":"Suspend VM and save state to disk."
|
||||
"down":"Gracefully shutdown the VM."
|
||||
"stop":"Gracefully shutdown the VM."
|
||||
"halt":"Gracefully shutdown the VM."
|
||||
"restart":"Gracefully reboot the VM."
|
||||
"poweroff":"Forcefully power off the VM (may corrupt disk image)."
|
||||
"reset":"Forcefully power cycle the VM (may corrupt disk image)."
|
||||
"delete":"Delete Boot2Docker VM and its disk image."
|
||||
"destroy":"Delete Boot2Docker VM and its disk image."
|
||||
"config":"Show selected profile file settings."
|
||||
"cfg":"Show selected profile file settings."
|
||||
"info":"Display detailed information of VM."
|
||||
"ip":"Display the IP address of the VM's Host-only network."
|
||||
"socket":"Display the DOCKER_HOST socket to connect to."
|
||||
"shellinit":"Display the shell command to set up the Docker client."
|
||||
"status":"Display current state of VM."
|
||||
"download":"Download Boot2Docker ISO image."
|
||||
"upgrade":"Upgrade the Boot2Docker ISO image (restart if running)."
|
||||
"version":"Display version information."
|
||||
)
|
||||
|
||||
_arguments \
|
||||
'(--basevmdk)--basevmdk[Path to VMDK to use as base for persistent partition]' \
|
||||
'(--cpus)'{-c,--cpus}'[number of CPUs for boot2docker.]' \
|
||||
'(--clobber)--clobber[overwrite Docker client binary on boot2docker upgrade]' \
|
||||
'(--dhcp)--dhcp[enable VirtualBox host-only network DHCP.]' \
|
||||
'(--dhcpip)--dhcpip[VirtualBox host-only network DHCP server address.]' \
|
||||
'(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB).]' \
|
||||
'(--dockerport)--dockerport[host Docker port (forward to port 2376 in VM). (deprecated - use with care)]' \
|
||||
'(--driver)--driver[hypervisor driver.]' \
|
||||
'(--force-upgrade-download)--force-upgrade-download[always download on boot2docker upgrade, never skip.]' \
|
||||
'(--hostip)--hostip[VirtualBox host-only network IP address.]' \
|
||||
'(--iso)--iso[path to boot2docker ISO image.]' \
|
||||
'(--iso-url)--iso-url[/api.github.com/repos/boot2docker/boot2docker/releases": source URL to provision the boot2docker ISO image.]' \
|
||||
'(--lowerip)--lowerip[VirtualBox host-only network DHCP lower bound.]' \
|
||||
'(--memory)'{-m,--memory}'[virtual machine memory size (in MB).]' \
|
||||
'(--netmask)--netmask[VirtualBox host-only network mask.]' \
|
||||
'(--no-dummy)--no-dummy[Example parameter for the dummy driver.]' \
|
||||
'(--retries)--retries[number of port knocking retries during 'start']' \
|
||||
'(--serial)--serial[try serial console to get IP address (experimental)]' \
|
||||
'(--serialfile)--serialfile[path to the serial socket/pipe.]' \
|
||||
'(--ssh)--ssh[path to SSH client utility.]' \
|
||||
'(--ssh-keygen)--ssh-keygen[path to ssh-keygen utility.]' \
|
||||
'(--sshkey)--sshkey[path to SSH key to use.]' \
|
||||
'(--sshport)--sshport[host SSH port (forward to port 22 in VM).]' \
|
||||
'(--upperip)--upperip[VirtualBox host-only network DHCP upper bound.]' \
|
||||
'(--vbm)--vbm[path to VirtualBox management utility.]' \
|
||||
'(--vbox-share)--vbox-share[(defaults to "/Users=Users" if no shares are specified; use "disable" to explicitly prevent any shares from being created) List of directories to share during "up|start|boot" via VirtualBox Guest Additions, with optional labels]' \
|
||||
'(--verbose)'{-v,--verbose}'[display verbose command invocations.]' \
|
||||
'(--vm)--vm[virtual machine name.]' \
|
||||
'(--waittime)--waittime[Time in milliseconds to wait between port knocking retries during 'start']' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
#_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "boot2docker command" _1st_arguments
|
||||
return
|
||||
fi
|
17
zsh/.oh-my-zsh/plugins/bower/README.md
Normal file
17
zsh/.oh-my-zsh/plugins/bower/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Bower plugin
|
||||
|
||||
This plugin adds completion for [Bower](https://bower.io/) and a few useful aliases for common Bower commands.
|
||||
|
||||
To use it, add `bower` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... bower)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------|--------------------------------------------------------|
|
||||
| bi | `bower install` | Installs the project dependencies listed in bower.json |
|
||||
| bl | `bower list` | List local packages and possible updates |
|
||||
| bs | `bower search` | Finds all packages or a specific package. |
|
58
zsh/.oh-my-zsh/plugins/bower/_bower
Normal file
58
zsh/.oh-my-zsh/plugins/bower/_bower
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
# Credits to npm's awesome completion utility.
|
||||
#
|
||||
# Bower completion script, based on npm completion script.
|
||||
|
||||
###-begin-bower-completion-###
|
||||
#
|
||||
# Installation: bower completion >> ~/.bashrc (or ~/.zshrc)
|
||||
# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower
|
||||
#
|
||||
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
|
||||
export COMP_WORDBREAKS
|
||||
|
||||
if type complete &>/dev/null; then
|
||||
_bower_completion () {
|
||||
local si="$IFS"
|
||||
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
|
||||
COMP_LINE="$COMP_LINE" \
|
||||
COMP_POINT="$COMP_POINT" \
|
||||
bower completion -- "${COMP_WORDS[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
complete -F _bower_completion bower
|
||||
elif type compdef &>/dev/null; then
|
||||
_bower_completion() {
|
||||
si=$IFS
|
||||
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
|
||||
COMP_LINE=$BUFFER \
|
||||
COMP_POINT=0 \
|
||||
bower completion -- "${words[@]}" \
|
||||
2>/dev/null)
|
||||
IFS=$si
|
||||
}
|
||||
compdef _bower_completion bower
|
||||
elif type compctl &>/dev/null; then
|
||||
_bower_completion () {
|
||||
local cword line point words si
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
let cword-=1
|
||||
read -l line
|
||||
read -ln point
|
||||
si="$IFS"
|
||||
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
|
||||
COMP_LINE="$line" \
|
||||
COMP_POINT="$point" \
|
||||
bower completion -- "${words[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
compctl -K _bower_completion bower
|
||||
fi
|
||||
###-end-bower-completion-###
|
||||
|
84
zsh/.oh-my-zsh/plugins/bower/bower.plugin.zsh
Normal file
84
zsh/.oh-my-zsh/plugins/bower/bower.plugin.zsh
Normal file
@ -0,0 +1,84 @@
|
||||
alias bi="bower install"
|
||||
alias bisd="bower install --save-dev"
|
||||
alias bis="bower install --save"
|
||||
alias bl="bower list"
|
||||
alias bs="bower search"
|
||||
|
||||
_bower_installed_packages () {
|
||||
bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//')
|
||||
}
|
||||
_bower ()
|
||||
{
|
||||
local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
|
||||
local expl
|
||||
typeset -A opt_args
|
||||
|
||||
_no_color=('--no-color[Do not print colors (available in all commands)]')
|
||||
|
||||
_dopts=(
|
||||
'(--save)--save[Save installed packages into the project"s bower.json dependencies]'
|
||||
'(--force)--force[Force fetching remote resources even if a local copy exists on disk]'
|
||||
)
|
||||
|
||||
_save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
|
||||
|
||||
_force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
|
||||
|
||||
_production=('(--production)--production[Do not install project devDependencies]')
|
||||
|
||||
_1st_arguments=(
|
||||
'cache-clean:Clean the Bower cache, or the specified package caches' \
|
||||
'help:Display help information about Bower' \
|
||||
'info:Version info and description of a particular package' \
|
||||
'init:Interactively create a bower.json file' \
|
||||
'install:Install a package locally' \
|
||||
'link:Symlink a package folder' \
|
||||
'lookup:Look up a package URL by name' \
|
||||
'register:Register a package' \
|
||||
'search:Search for a package by name' \
|
||||
'uninstall:Remove a package' \
|
||||
'update:Update a package' \
|
||||
{ls,list}:'[List all installed packages]'
|
||||
)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "bower subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install)
|
||||
_arguments \
|
||||
$_dopts \
|
||||
$_save_dev \
|
||||
$_force_lastest \
|
||||
$_no_color \
|
||||
$_production
|
||||
;;
|
||||
update)
|
||||
_arguments \
|
||||
$_dopts \
|
||||
$_no_color \
|
||||
$_force_lastest
|
||||
_bower_installed_packages
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
uninstall)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
$_dopts
|
||||
_bower_installed_packages
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
*)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
compdef _bower bower
|
33
zsh/.oh-my-zsh/plugins/branch/README.md
Normal file
33
zsh/.oh-my-zsh/plugins/branch/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Branch
|
||||
|
||||
Displays the current Git or Mercurial branch fast.
|
||||
|
||||
## Speed test
|
||||
|
||||
### Mercurial
|
||||
|
||||
```shell
|
||||
$ time hg branch
|
||||
0.11s user 0.14s system 70% cpu 0.355 total
|
||||
```
|
||||
|
||||
### Branch plugin
|
||||
|
||||
```shell
|
||||
$ time zsh /tmp/branch_prompt_info_test.zsh
|
||||
0.00s user 0.01s system 78% cpu 0.014 total
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`)
|
||||
adding `$(branch_prompt_info)` in your prompt like this:
|
||||
|
||||
```diff
|
||||
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Victor Torres (<vpaivatorres@gmail.com>)
|
31
zsh/.oh-my-zsh/plugins/branch/branch.plugin.zsh
Normal file
31
zsh/.oh-my-zsh/plugins/branch/branch.plugin.zsh
Normal file
@ -0,0 +1,31 @@
|
||||
# Branch: displays the current Git or Mercurial branch fast.
|
||||
# Victor Torres <vpaivatorres@gmail.com>
|
||||
# Oct 2, 2015
|
||||
|
||||
function branch_prompt_info() {
|
||||
# Defines path as current directory
|
||||
local current_dir=$PWD
|
||||
# While current path is not root path
|
||||
while [[ $current_dir != '/' ]]
|
||||
do
|
||||
# Git repository
|
||||
if [[ -d "${current_dir}/.git" ]]
|
||||
then
|
||||
echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/}
|
||||
return;
|
||||
fi
|
||||
# Mercurial repository
|
||||
if [[ -d "${current_dir}/.hg" ]]
|
||||
then
|
||||
if [[ -f "$current_dir/.hg/branch" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
else
|
||||
echo '☿ default'
|
||||
fi
|
||||
return;
|
||||
fi
|
||||
# Defines path as parent directory and keeps looking for :)
|
||||
current_dir="${current_dir:h}"
|
||||
done
|
||||
}
|
30
zsh/.oh-my-zsh/plugins/brew/README.md
Normal file
30
zsh/.oh-my-zsh/plugins/brew/README.md
Normal file
@ -0,0 +1,30 @@
|
||||
# brew plugin
|
||||
|
||||
The plugin adds several aliases for common [brew](https://brew.sh) commands.
|
||||
|
||||
To use it, add `brew` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... brew)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------|---------------------------------------|---------------------------------------------------------------------|
|
||||
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
|
||||
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
|
||||
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
|
||||
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
|
||||
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
|
||||
| `bubu` | `bubo && bubc` | Do the last two operations above. |
|
||||
| `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
|
||||
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
|
||||
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
|
||||
|
||||
## Completion
|
||||
|
||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
|
||||
brew installation, so we no longer ship it with the brew plugin; now it only has brew
|
||||
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
|
||||
installation fully up to date.
|
9
zsh/.oh-my-zsh/plugins/brew/brew.plugin.zsh
Normal file
9
zsh/.oh-my-zsh/plugins/brew/brew.plugin.zsh
Normal file
@ -0,0 +1,9 @@
|
||||
alias brewp='brew pin'
|
||||
alias brews='brew list -1'
|
||||
alias brewsp='brew list --pinned'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bubu='bubo && bubc'
|
||||
alias buf='brew upgrade --formula'
|
||||
alias bcubo='brew update && brew outdated --cask'
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
74
zsh/.oh-my-zsh/plugins/bundler/README.md
Normal file
74
zsh/.oh-my-zsh/plugins/bundler/README.md
Normal file
@ -0,0 +1,74 @@
|
||||
# Bundler
|
||||
|
||||
This plugin adds completion for basic bundler commands, as well as aliases and helper functions for
|
||||
an easier experience with bundler.
|
||||
|
||||
To use it, add `bundler` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... bundler)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------|--------------------------------------|------------------------------------------------------------------------------------------|
|
||||
| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install |
|
||||
| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems |
|
||||
| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory |
|
||||
| `be` | `bundle exec` | Execute a command in the context of the bundle |
|
||||
| `bi` | `bundle install --jobs=<core_count>` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) |
|
||||
| `bl` | `bundle list` | List all the gems in the bundle |
|
||||
| `bo` | `bundle open` | Opens the source directory for a gem in your bundle |
|
||||
| `bout` | `bundle outdated` | List installed gems with newer versions available |
|
||||
| `bp` | `bundle package` | Package your needed .gem files into your application |
|
||||
| `bu` | `bundle update` | Update your gems to the latest available versions |
|
||||
|
||||
## Gem wrapper
|
||||
|
||||
The plugin adds a wrapper for common gems, which:
|
||||
|
||||
- Looks for a binstub under `./bin/` and executes it if present.
|
||||
- Calls `bundle exec <gem>` otherwise.
|
||||
|
||||
Common gems wrapped by default (by name of the executable):
|
||||
|
||||
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
|
||||
|
||||
### Settings
|
||||
|
||||
You can add or remove gems from the list of wrapped commands.
|
||||
Please **use the exact name of the executable** and not the gem name.
|
||||
|
||||
#### Include gems to be wrapped (`BUNDLED_COMMANDS`)
|
||||
|
||||
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 (`UNBUNDLED_COMMANDS`)
|
||||
|
||||
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 [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification:
|
||||
|
||||
- `berks`
|
||||
- `foreman`
|
||||
- `mailcatcher`
|
||||
- `rails`
|
||||
- `ruby`
|
||||
- `spin`
|
104
zsh/.oh-my-zsh/plugins/bundler/_bundler
Normal file
104
zsh/.oh-my-zsh/plugins/bundler/_bundler
Normal file
@ -0,0 +1,104 @@
|
||||
#compdef bundle
|
||||
|
||||
local curcontext="$curcontext" state line _gems _opts ret=1
|
||||
|
||||
_arguments -C -A "-v" -A "--version" \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'1: :->cmds' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_values "bundle command" \
|
||||
"install[Install the gems specified by the Gemfile or Gemfile.lock]" \
|
||||
"update[Update dependencies to their latest versions]" \
|
||||
"package[Package the .gem files required by your application]" \
|
||||
"exec[Execute a script in the context of the current bundle]" \
|
||||
"config[Specify and read configuration options for bundler]" \
|
||||
"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
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
help)
|
||||
_values 'commands' \
|
||||
'install' \
|
||||
'update' \
|
||||
'package' \
|
||||
'exec' \
|
||||
'config' \
|
||||
'check' \
|
||||
'list' \
|
||||
'show' \
|
||||
'outdated' \
|
||||
'console' \
|
||||
'open' \
|
||||
'viz' \
|
||||
'init' \
|
||||
'gem' \
|
||||
'platform' \
|
||||
'help' && ret=0
|
||||
;;
|
||||
install)
|
||||
_arguments \
|
||||
'(--no-color)--no-color[disable colorization in output]' \
|
||||
'(--local)--local[do not attempt to connect to rubygems.org]' \
|
||||
'(--quiet)--quiet[only output warnings and errors]' \
|
||||
'(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
|
||||
'(--system)--system[install to the system location]' \
|
||||
'(--deployment)--deployment[install using defaults tuned for deployment environments]' \
|
||||
'(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
|
||||
'(--path)--path=-[specify a different path than the system default]:path:_files' \
|
||||
'(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
|
||||
'(--without)--without=-[exclude gems that are part of the specified named group]:groups'
|
||||
ret=0
|
||||
;;
|
||||
exec)
|
||||
_normal && ret=0
|
||||
;;
|
||||
clean)
|
||||
_arguments \
|
||||
'(--force)--force[forces clean even if --path is not set]' \
|
||||
'(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \
|
||||
'(--no-color)--no-color[Disable colorization in output]' \
|
||||
'(--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
|
||||
_values 'gems' $_gems && ret=0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
|
||||
_opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
|
||||
if [[ $_opts != "" ]]; then
|
||||
_values 'options' $_opts && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
130
zsh/.oh-my-zsh/plugins/bundler/bundler.plugin.zsh
Normal file
130
zsh/.oh-my-zsh/plugins/bundler/bundler.plugin.zsh
Normal file
@ -0,0 +1,130 @@
|
||||
## Aliases
|
||||
|
||||
alias ba="bundle add"
|
||||
alias bck="bundle check"
|
||||
alias bcn="bundle clean"
|
||||
alias be="bundle exec"
|
||||
alias bi="bundle_install"
|
||||
alias bl="bundle list"
|
||||
alias bo="bundle open"
|
||||
alias bout="bundle outdated"
|
||||
alias bp="bundle package"
|
||||
alias bu="bundle update"
|
||||
|
||||
## Functions
|
||||
|
||||
bundle_install() {
|
||||
# Bail out if bundler is not installed
|
||||
if (( ! $+commands[bundle] )); then
|
||||
echo "Bundler is not installed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Bail out if not in a bundled project
|
||||
if ! _within-bundled-project; then
|
||||
echo "Can't 'bundle install' outside a bundled project"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check the bundler version is at least 1.4.0
|
||||
autoload -Uz is-at-least
|
||||
local bundler_version=$(bundle version | cut -d' ' -f3)
|
||||
if ! is-at-least 1.4.0 "$bundler_version"; then
|
||||
bundle install "$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
# If bundler is at least 1.4.0, use all the CPU cores to bundle install
|
||||
if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then
|
||||
local cores_num="$(sysctl -n hw.ncpu)"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
bundle install --jobs="$cores_num" "$@"
|
||||
}
|
||||
|
||||
## Gem wrapper
|
||||
|
||||
bundled_commands=(
|
||||
annotate
|
||||
cap
|
||||
capify
|
||||
cucumber
|
||||
foodcritic
|
||||
guard
|
||||
hanami
|
||||
irb
|
||||
jekyll
|
||||
kitchen
|
||||
knife
|
||||
middleman
|
||||
nanoc
|
||||
pry
|
||||
puma
|
||||
rackup
|
||||
rainbows
|
||||
rake
|
||||
rspec
|
||||
rubocop
|
||||
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
|
||||
|
||||
# Check if in the root or a subdirectory of a bundled project
|
||||
_within-bundled-project() {
|
||||
local check_dir="$PWD"
|
||||
while [[ "$check_dir" != "/" ]]; do
|
||||
if [[ -f "$check_dir/Gemfile" || -f "$check_dir/gems.rb" ]]; then
|
||||
return 0
|
||||
fi
|
||||
check_dir="${check_dir:h}"
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
_run-with-bundler() {
|
||||
if (( ! $+commands[bundle] )) || ! _within-bundled-project; then
|
||||
"$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [[ -f "./bin/${1}" ]]; then
|
||||
./bin/${^^@}
|
||||
else
|
||||
bundle exec "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
for cmd in $bundled_commands; do
|
||||
# Create wrappers for bundled and unbundled execution
|
||||
eval "function unbundled_$cmd () { \"$cmd\" \"\$@\"; }"
|
||||
eval "function bundled_$cmd () { _run-with-bundler \"$cmd\" \"\$@\"; }"
|
||||
alias "$cmd"="bundled_$cmd"
|
||||
|
||||
# Bind completion function to wrapped gem if available
|
||||
if (( $+functions[_$cmd] )); then
|
||||
compdef "_$cmd" "bundled_$cmd"="$cmd"
|
||||
fi
|
||||
done
|
||||
|
||||
unset cmd bundled_commands
|
9
zsh/.oh-my-zsh/plugins/cabal/README.md
Normal file
9
zsh/.oh-my-zsh/plugins/cabal/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Cabal
|
||||
|
||||
This plugin provides completion for [Cabal](https://www.haskell.org/cabal/), a build tool for Haskell. It
|
||||
also provides a function `cabal_sandbox_info` that prints whether the current working directory is in a sandbox.
|
||||
|
||||
To use it, add cabal to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... cabal)
|
||||
```
|
93
zsh/.oh-my-zsh/plugins/cabal/cabal.plugin.zsh
Normal file
93
zsh/.oh-my-zsh/plugins/cabal/cabal.plugin.zsh
Normal file
@ -0,0 +1,93 @@
|
||||
function cabal_sandbox_info() {
|
||||
cabal_files=(*.cabal(N))
|
||||
if [ $#cabal_files -gt 0 ]; then
|
||||
if [ -f cabal.sandbox.config ]; then
|
||||
echo "%{$fg[green]%}sandboxed%{$reset_color%}"
|
||||
else
|
||||
echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _cabal_commands() {
|
||||
local ret=1 state
|
||||
_arguments ':subcommand:->subcommand' && ret=0
|
||||
|
||||
case $state in
|
||||
subcommand)
|
||||
subcommands=(
|
||||
"bench:Run the benchmark, if any (configure with UserHooks)"
|
||||
"build:Compile all targets or specific target."
|
||||
"check:Check the package for common mistakes"
|
||||
"clean:Clean up after a build"
|
||||
"copy:Copy the files into the install locations"
|
||||
"configure:Prepare to build the package"
|
||||
"exec:Run a command with the cabal environment"
|
||||
"fetch:Downloads packages for later installation"
|
||||
"freeze:Freeze dependencies."
|
||||
"get:Gets a package's source code"
|
||||
"haddock:Generate Haddock HTML documentation"
|
||||
"help:Help about commands"
|
||||
"hscolour:Generate HsColour colourised code, in HTML format"
|
||||
"info:Display detailed information about a particular package"
|
||||
"init:Interactively create a .cabal file"
|
||||
"install:Installs a list of packages"
|
||||
"list:List packages matching a search string"
|
||||
"register:Register this package with the compiler"
|
||||
"repl:Open an interpreter session for the given target"
|
||||
"report:Upload build reports to a remote server"
|
||||
"run:Runs the compiled executable"
|
||||
"sandbox:Create/modify/delete a sandbox"
|
||||
"sdist:Generate a source distribution file (.tar.gz)"
|
||||
"test:Run the test suite, if any (configure with UserHooks)"
|
||||
"unpack:Unpacks packages for user inspection"
|
||||
"update:Updates list of known packages"
|
||||
"upload:Uploads source packages to Hackage"
|
||||
)
|
||||
_describe -t subcommands 'cabal subcommands' subcommands && ret=0
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
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 }
|
15
zsh/.oh-my-zsh/plugins/cake/README.md
Normal file
15
zsh/.oh-my-zsh/plugins/cake/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Cake
|
||||
|
||||
This plugin provides completion for [CakePHP](https://cakephp.org/).
|
||||
|
||||
To use it add cake to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... cake)
|
||||
```
|
||||
|
||||
## Note
|
||||
|
||||
This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
|
||||
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
|
||||
`.gitignore` files.
|
33
zsh/.oh-my-zsh/plugins/cake/cake.plugin.zsh
Normal file
33
zsh/.oh-my-zsh/plugins/cake/cake.plugin.zsh
Normal file
@ -0,0 +1,33 @@
|
||||
# Set this to 1 if you want to cache the tasks
|
||||
_cake_cache_task_list=1
|
||||
|
||||
# Cache filename
|
||||
_cake_task_cache_file='.cake_task_cache'
|
||||
|
||||
_cake_get_target_list () {
|
||||
cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'
|
||||
}
|
||||
|
||||
_cake_does_target_list_need_generating () {
|
||||
|
||||
if [ ${_cake_cache_task_list} -eq 0 ]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
[ ! -f ${_cake_task_cache_file} ] && return 0;
|
||||
[ Cakefile -nt ${_cake_task_cache_file} ] && return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_cake () {
|
||||
if [ -f Cakefile ]; then
|
||||
if _cake_does_target_list_need_generating; then
|
||||
_cake_get_target_list > ${_cake_task_cache_file}
|
||||
compadd `cat ${_cake_task_cache_file}`
|
||||
else
|
||||
compadd `_cake_get_target_list`
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cake cake
|
16
zsh/.oh-my-zsh/plugins/cakephp3/README.md
Normal file
16
zsh/.oh-my-zsh/plugins/cakephp3/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# cakephp3 plugin
|
||||
|
||||
The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html).
|
||||
|
||||
To use it, add `cakephp3` to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... cakephp3)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
|-----------|-------------------------------|
|
||||
| c3 | `bin/cake` |
|
||||
| c3cache | `bin/cake orm_cache clear` |
|
||||
| c3migrate | `bin/cake migrations migrate` |
|
38
zsh/.oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh
Normal file
38
zsh/.oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh
Normal file
@ -0,0 +1,38 @@
|
||||
# CakePHP 3 basic command completion
|
||||
_cakephp3_get_command_list () {
|
||||
bin/cake Completion commands
|
||||
}
|
||||
|
||||
_cakephp3_get_sub_command_list () {
|
||||
bin/cake Completion subcommands ${words[2]}
|
||||
}
|
||||
|
||||
_cakephp3_get_3rd_argument () {
|
||||
bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
|
||||
}
|
||||
|
||||
_cakephp3 () {
|
||||
local -a has3rdargument
|
||||
has3rdargument=("all" "controller" "fixture" "model" "template")
|
||||
if [ -f bin/cake ]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
compadd $(_cakephp3_get_command_list)
|
||||
fi
|
||||
if (( CURRENT == 3 )); then
|
||||
compadd $(_cakephp3_get_sub_command_list)
|
||||
fi
|
||||
if (( CURRENT == 4 )); then
|
||||
if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
|
||||
compadd $(_cakephp3_get_3rd_argument)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cakephp3 bin/cake
|
||||
compdef _cakephp3 cake
|
||||
|
||||
#Alias
|
||||
alias c3='bin/cake'
|
||||
alias c3cache='bin/cake orm_cache clear'
|
||||
alias c3migrate='bin/cake migrations migrate'
|
14
zsh/.oh-my-zsh/plugins/capistrano/README.md
Normal file
14
zsh/.oh-my-zsh/plugins/capistrano/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Capistrano
|
||||
|
||||
This plugin provides completion for [Capistrano](https://capistranorb.com/).
|
||||
|
||||
To use it add capistrano to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... capistrano)
|
||||
```
|
||||
|
||||
For a working completion use the `capit` command instead of `cap`, because cap is a
|
||||
[reserved word in zsh](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module).
|
||||
|
||||
`capit` automatically runs cap with bundler if a Gemfile is found.
|
49
zsh/.oh-my-zsh/plugins/capistrano/_capistrano
Normal file
49
zsh/.oh-my-zsh/plugins/capistrano/_capistrano
Normal file
@ -0,0 +1,49 @@
|
||||
#compdef capit
|
||||
#autoload
|
||||
|
||||
# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local -a _configs
|
||||
|
||||
_arguments -C \
|
||||
'1: :->cmds' \
|
||||
'2:: :->args' && ret=0
|
||||
|
||||
_cap_tasks() {
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then
|
||||
if [[ ! -f .cap_tasks~ ]]; then
|
||||
capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
|
||||
fi
|
||||
|
||||
OLD_IFS=$IFS
|
||||
IFS=$'\n'
|
||||
_values 'cap commands' $(< .cap_tasks~)
|
||||
IFS=$OLD_IFS
|
||||
# zmodload zsh/mapfile
|
||||
# _values ${(f)mapfile[.cap_tasks~]}
|
||||
fi
|
||||
}
|
||||
|
||||
_cap_stages() {
|
||||
compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g)
|
||||
}
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
# check if it uses multistage
|
||||
if [[ -d config/deploy ]]; then
|
||||
_cap_stages
|
||||
else
|
||||
_cap_tasks
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
args)
|
||||
_cap_tasks
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
11
zsh/.oh-my-zsh/plugins/capistrano/capistrano.plugin.zsh
Normal file
11
zsh/.oh-my-zsh/plugins/capistrano/capistrano.plugin.zsh
Normal file
@ -0,0 +1,11 @@
|
||||
# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
|
||||
|
||||
function capit() {
|
||||
if [ -f Gemfile ]
|
||||
then
|
||||
bundle exec cap $*
|
||||
else
|
||||
cap $*
|
||||
fi
|
||||
}
|
11
zsh/.oh-my-zsh/plugins/cargo/README.md
Normal file
11
zsh/.oh-my-zsh/plugins/cargo/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# cargo
|
||||
|
||||
This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo).
|
||||
|
||||
To use it, add `cargo` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... cargo)
|
||||
```
|
||||
|
||||
Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0).
|
23
zsh/.oh-my-zsh/plugins/cargo/cargo.plugin.zsh
Normal file
23
zsh/.oh-my-zsh/plugins/cargo/cargo.plugin.zsh
Normal file
@ -0,0 +1,23 @@
|
||||
if (( $+commands[rustup] && $+commands[cargo] )); then
|
||||
# remove old generated completion file
|
||||
command rm -f "${0:A:h}/_cargo"
|
||||
|
||||
# generate new completion file
|
||||
ver="$(cargo --version)"
|
||||
ver_file="$ZSH_CACHE_DIR/cargo_version"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_cargo"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
rustup completions zsh cargo >| "$comp_file"
|
||||
echo "$ver" >| "$ver_file"
|
||||
fi
|
||||
|
||||
declare -A _comps
|
||||
autoload -Uz _cargo
|
||||
_comps[cargo]=_cargo
|
||||
|
||||
unset ver ver_file comp_file
|
||||
fi
|
15
zsh/.oh-my-zsh/plugins/cask/README.md
Normal file
15
zsh/.oh-my-zsh/plugins/cask/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Cask plugin
|
||||
|
||||
[Cask](https://github.com/cask/cask) is a project management tool for Emacs that helps
|
||||
automate the package development cycle; development, dependencies, testing, building,
|
||||
packaging and more.
|
||||
|
||||
This plugin loads `cask` completion from non-standard locations, such as if installed
|
||||
via Homebrew or others. To enable it, add `cask` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... cask)
|
||||
```
|
||||
|
||||
Make sure you have the `cask` directory in your `$PATH` before loading Oh My Zsh,
|
||||
otherwise you'll get a "command not found" error.
|
26
zsh/.oh-my-zsh/plugins/cask/cask.plugin.zsh
Normal file
26
zsh/.oh-my-zsh/plugins/cask/cask.plugin.zsh
Normal file
@ -0,0 +1,26 @@
|
||||
() {
|
||||
emulate -L zsh
|
||||
|
||||
if ! (( $+commands[cask] )); then
|
||||
print "zsh cask plugin: cask command not found" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
cask_base=${commands[cask]:h:h}
|
||||
|
||||
# Plain cask installation location (for Cask 0.7.2 and earlier)
|
||||
comp_files=($cask_base/etc/cask_completion.zsh)
|
||||
|
||||
# Mac Homebrew installs the completion in a different location
|
||||
if (( $+commands[brew] )); then
|
||||
comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
|
||||
fi
|
||||
|
||||
# Load first found file
|
||||
for f in $comp_files; do
|
||||
if [[ -f "$f" ]]; then
|
||||
source "$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
23
zsh/.oh-my-zsh/plugins/catimg/README.md
Normal file
23
zsh/.oh-my-zsh/plugins/catimg/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# catimg
|
||||
|
||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
|
||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... catimg)
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- `convert` (ImageMagick)
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------- | ---------------------------------------- |
|
||||
| `catimg` | Displays the given image on the terminal |
|
||||
|
||||
## Usage examples
|
||||
|
||||
[](https://asciinema.org/a/204702)
|
17
zsh/.oh-my-zsh/plugins/catimg/catimg.plugin.zsh
Normal file
17
zsh/.oh-my-zsh/plugins/catimg/catimg.plugin.zsh
Normal file
@ -0,0 +1,17 @@
|
||||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# https://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
|
||||
function catimg() {
|
||||
if [[ -x `which convert` ]]; then
|
||||
zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
else
|
||||
echo "catimg need convert (ImageMagick) to work)"
|
||||
fi
|
||||
}
|
88
zsh/.oh-my-zsh/plugins/catimg/catimg.sh
Normal file
88
zsh/.oh-my-zsh/plugins/catimg/catimg.sh
Normal file
@ -0,0 +1,88 @@
|
||||
################################################################################
|
||||
# catimg script by Eduardo San Martin Morote aka Posva #
|
||||
# https://posva.net #
|
||||
# #
|
||||
# Ouput the content of an image to the stdout using the 256 colors of the #
|
||||
# terminal. #
|
||||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
function help() {
|
||||
echo "Usage catimg [-h] [-w width] [-c char] img"
|
||||
echo "By default char is \" \" and w is the terminal width"
|
||||
}
|
||||
|
||||
# VARIABLES
|
||||
COLOR_FILE=$(dirname $0)/colors.png
|
||||
CHAR=" "
|
||||
|
||||
WIDTH=""
|
||||
IMG=""
|
||||
|
||||
while getopts qw:c:h opt; do
|
||||
case "$opt" in
|
||||
w) WIDTH="$OPTARG" ;;
|
||||
c) CHAR="$OPTARG" ;;
|
||||
h) help; exit ;;
|
||||
*) help ; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
while [ "$1" ]; do
|
||||
IMG="$1"
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$IMG" = "" -o ! -f "$IMG" ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$WIDTH" ]; then
|
||||
COLS=$(expr $(tput cols) "/" $(echo -n "$CHAR" | wc -c))
|
||||
else
|
||||
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
|
||||
fi
|
||||
WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
|
||||
if [ "$WIDTH" -gt "$COLS" ]; then
|
||||
WIDTH=$COLS
|
||||
fi
|
||||
|
||||
REMAP=""
|
||||
if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
REMAP="-remap $COLOR_FILE"
|
||||
else
|
||||
echo "The version of convert is too old, don't expect good results :(" >&2
|
||||
#convert "$IMG" -colors 256 PNG8:tmp.png
|
||||
#IMG="tmp.png"
|
||||
fi
|
||||
|
||||
# Display the image
|
||||
I=0
|
||||
convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
|
||||
while read R G B f; do
|
||||
if [ ! "$R" = "NO" ]; then
|
||||
if [ "$R" -eq "$G" -a "$G" -eq "$B" ]; then
|
||||
((
|
||||
I++,
|
||||
IDX = 232 + R * 23 / 255
|
||||
))
|
||||
else
|
||||
((
|
||||
I++,
|
||||
IDX = 16
|
||||
+ R * 5 / 255 * 36
|
||||
+ G * 5 / 255 * 6
|
||||
+ B * 5 / 255
|
||||
))
|
||||
fi
|
||||
#echo "$R,$G,$B: $IDX"
|
||||
echo -ne "\e[48;5;${IDX}m${CHAR}"
|
||||
else
|
||||
(( I++ ))
|
||||
echo -ne "\e[0m${CHAR}"
|
||||
fi
|
||||
# New lines
|
||||
(( $I % $WIDTH )) || echo -e "\e[0m"
|
||||
done
|
BIN
zsh/.oh-my-zsh/plugins/catimg/colors.png
Normal file
BIN
zsh/.oh-my-zsh/plugins/catimg/colors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 353 B |
9
zsh/.oh-my-zsh/plugins/celery/README.md
Normal file
9
zsh/.oh-my-zsh/plugins/celery/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Celery
|
||||
|
||||
This plugin provides completion for [Celery](http://www.celeryproject.org/).
|
||||
|
||||
To use it add celery to the plugins array in your zshrc file.
|
||||
|
||||
```bash
|
||||
plugins=(... celery)
|
||||
```
|
129
zsh/.oh-my-zsh/plugins/celery/_celery
Normal file
129
zsh/.oh-my-zsh/plugins/celery/_celery
Normal file
@ -0,0 +1,129 @@
|
||||
#compdef celery
|
||||
#autoload
|
||||
|
||||
#celery zsh completion
|
||||
|
||||
_celery () {
|
||||
local -a _1st_arguments ifargs dopts controlargs
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \
|
||||
'control' 'purge' 'list' 'migrate' 'call' 'result' 'report')
|
||||
ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version')
|
||||
dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=')
|
||||
controlargs=('--timeout' '--destination')
|
||||
_arguments \
|
||||
'(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \
|
||||
'(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \
|
||||
'(--loader)--loader[name of custom loader class to use.:LOADER]' \
|
||||
'(--config)--config[Name of the configuration module:CONFIG]' \
|
||||
'(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \
|
||||
'(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \
|
||||
'(--version)--version[show program"s version number and exit]' \
|
||||
'(- : *)'{-h,--help}'[show this help message and exit]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "celery subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
worker)
|
||||
_arguments \
|
||||
'(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \
|
||||
'(--pool)--pool=:::(processes eventlet gevent threads solo)' \
|
||||
'(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \
|
||||
'(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \
|
||||
'(--loglevel=)--loglevel=:::(critical error warning info debug)' \
|
||||
'(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \
|
||||
'(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \
|
||||
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \
|
||||
'(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \
|
||||
'(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \
|
||||
'(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \
|
||||
'(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \
|
||||
'(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \
|
||||
'(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \
|
||||
'(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \
|
||||
'(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \
|
||||
'(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \
|
||||
'(--autoreload)--autoreload[Enable autoreloading.]' \
|
||||
'(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
inspect)
|
||||
_values -s \
|
||||
'active[dump active tasks (being processed)]' \
|
||||
'active_queues[dump queues being consumed from]' \
|
||||
'ping[ping worker(s)]' \
|
||||
'registered[dump of registered tasks]' \
|
||||
'report[get bugreport info]' \
|
||||
'reserved[dump reserved tasks (waiting to be processed)]' \
|
||||
'revoked[dump of revoked task ids]' \
|
||||
'scheduled[dump scheduled tasks (eta/countdown/retry)]' \
|
||||
'stats[dump worker statistics]'
|
||||
compadd -a controlargs ifargs
|
||||
;;
|
||||
control)
|
||||
_values -s \
|
||||
'add_consumer[tell worker(s) to start consuming a queue]' \
|
||||
'autoscale[change autoscale settings]' \
|
||||
'cancel_consumer[tell worker(s) to stop consuming a queue]' \
|
||||
'disable_events[tell worker(s) to disable events]' \
|
||||
'enable_events[tell worker(s) to enable events]' \
|
||||
'pool_grow[start more pool processes]' \
|
||||
'pool_shrink[use less pool processes]' \
|
||||
'rate_limit[tell worker(s) to modify the rate limit for a task type]' \
|
||||
'time_limit[tell worker(s) to modify the time limit for a task type.]'
|
||||
compadd -a controlargs ifargs
|
||||
;;
|
||||
multi)
|
||||
_values -s \
|
||||
'--nosplash[Don"t display program info.]' \
|
||||
'--verbose[Show more output.]' \
|
||||
'--no-color[Don"t display colors.]' \
|
||||
'--quiet[Don"t show as much output.]' \
|
||||
'start' 'restart' 'stopwait' 'stop' 'show' \
|
||||
'names' 'expand' 'get' 'kill'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
amqp)
|
||||
_values -s \
|
||||
'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \
|
||||
'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get'
|
||||
;;
|
||||
list)
|
||||
_values -s, 'bindings'
|
||||
;;
|
||||
shell)
|
||||
_values -s \
|
||||
'--ipython[force iPython.]' \
|
||||
'--bpython[force bpython.]' \
|
||||
'--python[force default Python shell.]' \
|
||||
'--without-tasks[don"t add tasks to locals.]' \
|
||||
'--eventlet[use eventlet.]' \
|
||||
'--gevent[use gevent.]'
|
||||
compadd -a ifargs
|
||||
;;
|
||||
beat)
|
||||
_arguments \
|
||||
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \
|
||||
'(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \
|
||||
'(--max-interval)--max-interval[]'
|
||||
compadd -a dopts fargs
|
||||
;;
|
||||
events)
|
||||
_arguments \
|
||||
'(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \
|
||||
'(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \
|
||||
'(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \
|
||||
'(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]'
|
||||
compadd -a dopts fargs
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
20
zsh/.oh-my-zsh/plugins/chruby/README.md
Normal file
20
zsh/.oh-my-zsh/plugins/chruby/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# chruby plugin
|
||||
|
||||
This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the
|
||||
current Ruby version, and completion and a prompt function to display the Ruby version.
|
||||
Supports brew and manual installation of chruby.
|
||||
|
||||
To use it, add `chruby` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... chruby)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
If you'd prefer to specify an explicit path to load chruby from
|
||||
you can set variables like so:
|
||||
|
||||
```
|
||||
zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
|
||||
zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
|
||||
```
|
121
zsh/.oh-my-zsh/plugins/chruby/chruby.plugin.zsh
Normal file
121
zsh/.oh-my-zsh/plugins/chruby/chruby.plugin.zsh
Normal file
@ -0,0 +1,121 @@
|
||||
#
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# With either a manual or brew installed chruby things should just work.
|
||||
#
|
||||
# If you'd prefer to specify an explicit path to load chruby from
|
||||
# you can set variables like so:
|
||||
#
|
||||
# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
|
||||
# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
|
||||
#
|
||||
# TODO
|
||||
# - autodetermine correct source path on non OS X systems
|
||||
# - completion if ruby-install exists
|
||||
|
||||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
_xit=$?
|
||||
if [ $_xit -eq 0 ];then
|
||||
# ok , we have brew installed
|
||||
# speculatively we check default brew prefix
|
||||
if [ -h /usr/local/opt/chruby ];then
|
||||
_brew_prefix="/usr/local/opt/chruby"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix chruby)
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
return $_xit
|
||||
fi
|
||||
}
|
||||
|
||||
_chruby-from-homebrew-installed() {
|
||||
[ -r $_brew_prefix ] &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-build_installed() {
|
||||
whence ruby-build &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-install-installed() {
|
||||
whence ruby-install &> /dev/null
|
||||
}
|
||||
|
||||
# Simple definition completer for ruby-build
|
||||
if _ruby-build_installed; then
|
||||
_ruby-build() { compadd $(ruby-build --definitions) }
|
||||
compdef _ruby-build ruby-build
|
||||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
if [[ -r ${_chruby_path} ]]; then
|
||||
source ${_chruby_path}
|
||||
fi
|
||||
|
||||
if [[ -r ${_chruby_auto} ]]; then
|
||||
source ${_chruby_auto}
|
||||
fi
|
||||
}
|
||||
|
||||
_chruby_dirs() {
|
||||
chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies)
|
||||
for dir in chrubydirs; do
|
||||
if [[ -d $dir ]]; then
|
||||
RUBIES+=$dir
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if _homebrew-installed && _chruby-from-homebrew-installed ; then
|
||||
source $_brew_prefix/share/chruby/chruby.sh
|
||||
source $_brew_prefix/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
|
||||
source /usr/local/share/chruby/chruby.sh
|
||||
source /usr/local/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
else
|
||||
_source_from_omz_settings
|
||||
_chruby_dirs
|
||||
fi
|
||||
|
||||
function ensure_chruby() {
|
||||
$(whence chruby)
|
||||
}
|
||||
|
||||
function current_ruby() {
|
||||
local _ruby
|
||||
_ruby="$(chruby |grep \* |tr -d '* ')"
|
||||
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
|
||||
echo ${_ruby}
|
||||
else
|
||||
echo "system"
|
||||
fi
|
||||
}
|
||||
|
||||
function chruby_prompt_info() {
|
||||
echo "$(current_ruby)"
|
||||
}
|
||||
|
||||
# complete on installed rubies
|
||||
_chruby() {
|
||||
compadd $(chruby | tr -d '* ')
|
||||
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
|
||||
if PATH=${default_path} type ruby &> /dev/null; then
|
||||
compadd system
|
||||
fi
|
||||
}
|
||||
compdef _chruby chruby
|
1
zsh/.oh-my-zsh/plugins/chucknorris/.gitignore
vendored
Normal file
1
zsh/.oh-my-zsh/plugins/chucknorris/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
fortunes/chucknorris.dat
|
38
zsh/.oh-my-zsh/plugins/chucknorris/README.md
Normal file
38
zsh/.oh-my-zsh/plugins/chucknorris/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
# chucknorris
|
||||
|
||||
Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD.
|
||||
|
||||
To use it add `chucknorris` to the plugins array in you zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... chucknorris)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
| Command | Description |
|
||||
| ----------- | ------------------------------- |
|
||||
| `chuck` | Print random Chuck Norris quote |
|
||||
| `chuck_cow` | Print quote in cowthink |
|
||||
|
||||
Example: output of `chuck_cow`:
|
||||
|
||||
```
|
||||
Last login: Fri Jan 30 23:12:26 on ttys001
|
||||
______________________________________
|
||||
( When Chuck Norris plays Monopoly, it )
|
||||
( affects the actual world economy. )
|
||||
--------------------------------------
|
||||
o ^__^
|
||||
o (oo)\_______
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- `fortune`
|
||||
- `cowsay` if using `chuck_cow`
|
||||
|
||||
Available via homebrew, apt, ...
|
24
zsh/.oh-my-zsh/plugins/chucknorris/chucknorris.plugin.zsh
Normal file
24
zsh/.oh-my-zsh/plugins/chucknorris/chucknorris.plugin.zsh
Normal file
@ -0,0 +1,24 @@
|
||||
() {
|
||||
# %x: name of file containing code being executed
|
||||
local fortunes_dir="${${(%):-%x}:h}/fortunes"
|
||||
|
||||
# Aliases
|
||||
alias chuck="fortune -a $fortunes_dir"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
|
||||
# Automatically generate or update Chuck's compiled fortune data file
|
||||
if [[ "$fortunes_dir/chucknorris" -ot "$fortunes_dir/chucknorris.dat" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
|
||||
local strfile="${commands[strfile]:-/usr/sbin/strfile}"
|
||||
if [[ ! -x "$strfile" ]]; then
|
||||
echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
|
||||
echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
# Generate the compiled fortune data file
|
||||
$strfile "$fortunes_dir/chucknorris" "$fortunes_dir/chucknorris.dat" >/dev/null
|
||||
}
|
568
zsh/.oh-my-zsh/plugins/chucknorris/fortunes/chucknorris
Normal file
568
zsh/.oh-my-zsh/plugins/chucknorris/fortunes/chucknorris
Normal file
@ -0,0 +1,568 @@
|
||||
King Kong climbed the Empire State building in fear of Chuck Norris who was downstairs at the time.
|
||||
%
|
||||
"2012" is code for, Chuck Norris when he is pissed.
|
||||
%
|
||||
"The Big Chuck Norris Roundhouse-Kick Theory"
|
||||
%
|
||||
"The wind cries Chuck Norris"
|
||||
%
|
||||
"Walker Texas Ranger: The Movie 3-D" was considered by Warner Brothers; however the technology to create the visual effects will never be possible.
|
||||
%
|
||||
A Handicapped parking sign does not signify that this spot is for handicapped people. It is actually in fact a warning, that the spot belongs to Chuck Norris and that you will be handicapped if you park there.
|
||||
%
|
||||
Abraham Lincoln didn't die because he was shot, Chuck Norris roundhouse-kicked so fast his foot went back in time and killed Abraham Lincoln.
|
||||
%
|
||||
Achievement Unlocked: Chuck Norris of Death
|
||||
%
|
||||
After Chuck counted to infinity the first time, he vowed to count to infinity a second time....by counting the bodies of those previously roundhoused.
|
||||
%
|
||||
Aliens fear that Chuck Norris might abduct them.
|
||||
%
|
||||
An angry glare from Chuck Norris is known to kill on the spot.
|
||||
%
|
||||
Behind every successful man is Chuck Norris.
|
||||
%
|
||||
Beware of dogs... Dogs, beware of Chuck Norris.
|
||||
%
|
||||
Bruce Lee didn't defeat Chuck Norris. Chuck hit Bruce with a Delayed roundhouse kick that was so fast that Lee only felt the impact a year later!
|
||||
%
|
||||
CNN was originally created as the "Chuck Norris Network" to update Americans with on-the-spot ass kicking in real-time.
|
||||
%
|
||||
Casinos pay Chuck Norris not to play at anything or wish anyone good luck.
|
||||
%
|
||||
Chuck Norris - the new standard.
|
||||
%
|
||||
Chuck Norris CAN balance the light-switch between ON and OFF.
|
||||
%
|
||||
Chuck Norris CAN believe it's not butter.
|
||||
%
|
||||
Chuck Norris CAN spell with an I before E even after C.
|
||||
%
|
||||
Chuck Norris can play the theme from the Twilight Zone with his beard.
|
||||
%
|
||||
Chuck Norris can power solar panels. At night.
|
||||
%
|
||||
Chuck Norris watches "the Nat.Geo. Specials" on Discovery Channel.
|
||||
%
|
||||
Chuck Norris bowled a 301 after constructing another pin out of his beard hair.
|
||||
%
|
||||
Chuck Norris burnt a fire proof vest, UNDERWATER!
|
||||
%
|
||||
Chuck Norris can French kiss his elbow.
|
||||
%
|
||||
Chuck Norris can bake in a freezer.
|
||||
%
|
||||
Chuck Norris can defuse a bomb by cutting the wrong wire.
|
||||
%
|
||||
Chuck Norris can dig a hole in air.
|
||||
%
|
||||
Chuck Norris can divide by zero.
|
||||
%
|
||||
Chuck Norris can do a regime change with a roundhouse kick.
|
||||
%
|
||||
Chuck Norris can fit 10 gallons of water in a 5 gallon bucket.
|
||||
%
|
||||
Chuck Norris can grill a popsicle.
|
||||
%
|
||||
Chuck Norris can lead a horse to water AND make it drink.
|
||||
%
|
||||
Chuck Norris can make his own megazord "The Chuck Norris Roundhouse Kickers Ultimate Super Awesome Megazord".
|
||||
%
|
||||
Chuck Norris can milk an alligator.
|
||||
%
|
||||
Chuck Norris can play the death waltz with his chin.
|
||||
%
|
||||
Chuck Norris can roundhouse kick someone through a window without breaking the glass.
|
||||
%
|
||||
Chuck Norris can roundhouse-kick round houses into squares.
|
||||
%
|
||||
Chuck Norris can rub two fires together and make a stick!
|
||||
%
|
||||
Chuck Norris can see in 3D with just one eye.
|
||||
%
|
||||
Chuck Norris can slam a revolving door.
|
||||
%
|
||||
Chuck Norris can terminate a repeating decimal.
|
||||
%
|
||||
Chuck Norris can turn toast back into bread.
|
||||
%
|
||||
Chuck Norris can win a game of Connect Four in only three moves.
|
||||
%
|
||||
Chuck Norris can win in a top spinning tournament with a cube.
|
||||
%
|
||||
Chuck Norris can't perform Hadoukens, he IS a Hadouken.
|
||||
%
|
||||
Chuck Norris checks under his bed for Fedor Emelianenko because he takes Fedor to the vet regularly.
|
||||
%
|
||||
Chuck Norris counted to infinity - twice.
|
||||
%
|
||||
Chuck Norris created Heavy Metal when he was upset.
|
||||
%
|
||||
Chuck Norris does not get frostbite. Chuck Norris bites frost.
|
||||
%
|
||||
Chuck Norris does not have a cell phone because he hears everything.
|
||||
%
|
||||
Chuck Norris does not sleep. He waits.
|
||||
%
|
||||
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
|
||||
%
|
||||
Chuck Norris doesn't call the wrong number, you just answer the wrong phone.
|
||||
%
|
||||
Chuck Norris doesn't cheat death, he beats it fair and square.
|
||||
%
|
||||
Chuck Norris doesn't churn butter. He roundhouse kicks the cows and the butter comes straight out.
|
||||
%
|
||||
Chuck Norris doesn't eat, he just sucks the energy out of food by staring at it.
|
||||
%
|
||||
Chuck Norris doesn't exhale. The air runs desperately scared out of his lungs.
|
||||
%
|
||||
Chuck Norris doesn't go hunting.... CHUCK NORRIS GOES KILLING.
|
||||
%
|
||||
Chuck Norris doesn't let it go.
|
||||
%
|
||||
Chuck Norris doesn't like Mudkipz.
|
||||
%
|
||||
Chuck Norris doesn't look for fun. The fun looks for Chuck Norris.
|
||||
%
|
||||
Chuck Norris doesn't need a bulletproof vest. He catches them with his bare hands.
|
||||
%
|
||||
Chuck Norris doesn't need air, he is air.
|
||||
%
|
||||
Chuck Norris doesn't need sunglasses, the sun needs Chuck Norris glasses.
|
||||
%
|
||||
Chuck Norris doesn't need to brush his teeth, his spit acts as a bleach.
|
||||
%
|
||||
Chuck Norris doesn't read books. He stares them down until he gets the information he wants.
|
||||
%
|
||||
Chuck Norris doesn't throw up if he drinks too much. Chuck Norris throws down!
|
||||
%
|
||||
Chuck Norris doesn't eat salad, he eats vegetarians.
|
||||
%
|
||||
Chuck Norris doesn't wash his clothes, he disembowels them.
|
||||
%
|
||||
Chuck Norris doesn't wear a watch. HE decides what time it is.
|
||||
%
|
||||
Chuck Norris doesn't carry a list. He always knows what to do.
|
||||
%
|
||||
Chuck Norris drives an ice cream truck covered in human skulls.
|
||||
%
|
||||
Chuck Norris drowned a man ON LAND.
|
||||
%
|
||||
Chuck Norris fed the Hunger Games.
|
||||
%
|
||||
Chuck Norris found the hay in the needle stack.
|
||||
%
|
||||
Chuck Norris found the last digit of pi.
|
||||
%
|
||||
Chuck Norris had a knife thrown at him. The knife didn't impale him; he impaled the knife.
|
||||
%
|
||||
Chuck Norris has a battle cruiser AND a car.
|
||||
%
|
||||
Chuck Norris has killed the Dead Sea.
|
||||
%
|
||||
Chuck Norris has made a 148 break at snooker.
|
||||
%
|
||||
Chuck Norris invented Kentucky Fried Chicken's famous secret recipe, with eleven herbs and spices. But nobody ever mentions the twelfth ingredient: Fear.
|
||||
%
|
||||
Chuck Norris is allowed two carry-ons.
|
||||
%
|
||||
Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.
|
||||
%
|
||||
Chuck Norris is currently suing any broadway theater that plays "The Nutcracker". He claims its an infringement on his "other" roundhouse kick.
|
||||
%
|
||||
Chuck Norris is entitled to his own facts.
|
||||
%
|
||||
Chuck Norris is my Homeboy.
|
||||
%
|
||||
Chuck Norris is so fast, he can run around the world and punch himself in the back of the head.
|
||||
%
|
||||
Chuck Norris is so hard, he uses diamonds as stress balls.
|
||||
%
|
||||
Chuck Norris is so scary, he makes sharks swim backwards away from him.
|
||||
%
|
||||
Chuck Norris is ten feet tall, weighs two-tons, breathes fire, and could eat a hammer and take a shotgun blast standing.
|
||||
%
|
||||
Chuck Norris is the ghost in paranormal activity.
|
||||
%
|
||||
Chuck Norris is the life of parties he doesn't attend.
|
||||
%
|
||||
Chuck Norris is the meaning of life. Too bad he's also the meaning of death.
|
||||
%
|
||||
Chuck Norris is the only man to ever defeat a brick wall in a game of tennis.
|
||||
%
|
||||
Chuck Norris is the only one who can tear a facebook page!
|
||||
%
|
||||
Chuck Norris is the reason that the world will end in 2012. He was getting bored with the Earth.
|
||||
%
|
||||
Chuck Norris is the reason tumbleweeds tumble.
|
||||
%
|
||||
Chuck Norris is the reason why Waldo is hiding.
|
||||
%
|
||||
Chuck Norris is waiting for Mt. St. Helens to erupt again. He's hoping the lava is hot enough to soften his beard so he can shave for the first time.
|
||||
%
|
||||
Chuck Norris isn't allowed at the zoo, because when he's there the animals are too terrified to come out of their cages.
|
||||
%
|
||||
Chuck Norris made a statue bleed.
|
||||
%
|
||||
Chuck Norris made the big bang just by clicking his fingers.
|
||||
%
|
||||
Chuck Norris never trains, because he's Chuck Norris.
|
||||
%
|
||||
Chuck Norris once cried just to see what it was like. The end result was the creation of life.
|
||||
%
|
||||
Chuck Norris once cut a knife with a stick of butter.
|
||||
%
|
||||
Chuck Norris once got a 200 yard punt return.
|
||||
%
|
||||
Chuck Norris once had a pet monkey named KING KONG.
|
||||
%
|
||||
Chuck Norris once had a street named after him. The name removed at once, because nobody crosses Chuck Norris, and lives.
|
||||
%
|
||||
Chuck Norris once had a weak moment, just to know what it felt like.
|
||||
%
|
||||
Chuck Norris once played Duck Duck Goose with a group of Kindergarteners. Only one kid made it to first grade.
|
||||
%
|
||||
Chuck Norris once proved p^~p by induction on his beard hairs.
|
||||
%
|
||||
Chuck Norris once punched the ground to stop an earthquake. The resulting aftershock caused the BP oil spill.
|
||||
%
|
||||
Chuck Norris once round-house kicked a salesman. Over the phone.
|
||||
%
|
||||
Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet.
|
||||
%
|
||||
Chuck Norris once thought he was wrong. He was, however, mistaken.
|
||||
%
|
||||
Chuck Norris once walked down a street with his fists in his pockets. He was then arrested for concealing two deadly weapons.
|
||||
%
|
||||
Chuck Norris once won the Tour de France riding a "big wheel".
|
||||
%
|
||||
Chuck Norris originally appeared in the "Street Fighter II" video game, but was removed by Beta Testers because every button caused him to do a roundhouse kick. When asked bout this "glitch," Norris replied, "That's no glitch."
|
||||
%
|
||||
Chuck Norris owns all number 1 pencils.
|
||||
%
|
||||
Chuck Norris pees Adamantium.
|
||||
%
|
||||
Chuck Norris plays Texas Hold'Em with Zeus, every second Wednesday of the month.
|
||||
%
|
||||
Chuck Norris played "Got your Nose" with Voldemort and won.
|
||||
%
|
||||
Chuck Norris played the game of thrones and won.
|
||||
%
|
||||
Chuck Norris protects his bodyguards.
|
||||
%
|
||||
Chuck Norris rolled a 20 on a 6 sided die.
|
||||
%
|
||||
Chuck Norris roundhouse kicks people in the face first and asks questions later.
|
||||
%
|
||||
Chuck Norris sent a BBM to an iPhone.
|
||||
%
|
||||
Chuck Norris shops at Sam's Club, but leaves without having his receipt checked.
|
||||
%
|
||||
Chuck Norris splattered tiger blood and Adonis' DNA on Charlie Sheen with 1 roundhouse kick!
|
||||
%
|
||||
Chuck Norris started Chuck Norris.
|
||||
%
|
||||
Chuck Norris starts his day with 6 live chickens, two cows, three pigs, and a boiling hot cup of pure fury.
|
||||
%
|
||||
Chuck Norris told me to put this here.
|
||||
%
|
||||
Chuck Norris uses a real mouse to move the cursor, type on the keyboard, write e-mails, code entire websites, and make coffee.
|
||||
%
|
||||
Chuck Norris uses pepper spray to spice up his steaks.
|
||||
%
|
||||
Chuck Norris was heard in a soundproof room!
|
||||
%
|
||||
Chuck Norris was once turned down for American Idol. When Simon was questioned about it, he replied "I'm retiring after this season". I wonder why?
|
||||
%
|
||||
Chuck Norris was originally in Mortal Kombat, but that version was deleted because no one can beat Chuck Norris in a fight.
|
||||
%
|
||||
Chuck Norris was the image used for Papa Smurf.
|
||||
%
|
||||
Chuck Norris was the reason why the Great Wall of China was constructed. It failed miserably.
|
||||
%
|
||||
Chuck Norris was what Willis was talking about.
|
||||
%
|
||||
Chuck Norris wasn't born on his birthday.
|
||||
%
|
||||
Chuck Norris watched the first steps on the moon... from his summer home on Mars.
|
||||
%
|
||||
Chuck Norris went up the creek without a paddle... or a canoe.
|
||||
%
|
||||
Chuck Norris will attain statehood in 2009. His state flower will be the Magnolia.
|
||||
%
|
||||
Chuck Norris wins NASCAR races with all right turns.
|
||||
%
|
||||
Chuck Norris won a stepdance contest by standing on his hands.
|
||||
%
|
||||
Chuck Norris yells at drill Sergeants.
|
||||
%
|
||||
Chuck Norris' dog picks up after him.
|
||||
%
|
||||
Chuck Norris' films are factual documentaries.
|
||||
%
|
||||
Chuck Norris' first job was as a paperboy. There were no survivors.
|
||||
%
|
||||
Chuck Norris' glass is never half full or half empty. It stays full even after he takes a drink.
|
||||
%
|
||||
Chuck Norris' hand is the only hand that can beat a Royal Flush.
|
||||
%
|
||||
Chuck Norris' personal airplane is called Air Force Chuck.
|
||||
%
|
||||
Chuck Norris. Enough said.
|
||||
%
|
||||
Chuck Norris: even Naruto can't believe it.
|
||||
%
|
||||
Chuck Norris can make sour milk turn fresh.
|
||||
%
|
||||
Contrary to popular belief, Rome WAS built in a day, by Chuck Norris.
|
||||
%
|
||||
Contrary to popular belief, America is not a democracy, it is a Chucktatorship.
|
||||
%
|
||||
Contrary to popular belief, Chuck Norris, not the box jellyfish of northern Australia, is the most venomous creature on Earth.
|
||||
%
|
||||
Cops don't need badges in their wallets, but only a picture of Chuck Norris.
|
||||
%
|
||||
Crop circles are Chuck Norris' way of telling the world that sometimes corn needs to lie down.
|
||||
%
|
||||
Did you hear about the boy who cried Chuck Norris?
|
||||
%
|
||||
Dog the Bounty Hunter can't track Chuck Norris down.
|
||||
%
|
||||
Don't get Chuck Norris angry. Last time somebody did that, Chuck Norris made the Grand Canyon.
|
||||
%
|
||||
Earth's rotation is purely governed by the direction that Chuck Norris is walking.
|
||||
%
|
||||
Ever wonder what really happened to the dinosaurs? They all dug their own graves when they heard Chuck Norris was coming.
|
||||
%
|
||||
Every line in a Chuck Norris haiku is "A roundhouse kick to the face." And they all have the correct number of syllables.
|
||||
%
|
||||
Every phobia known to man has a phobia of Chuck Norris.
|
||||
%
|
||||
Every time there's an earthquake, you know Chuck Norris is hungry. The earthquake is caused by his stomach growling.
|
||||
%
|
||||
Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris.
|
||||
%
|
||||
Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic.
|
||||
%
|
||||
Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
|
||||
%
|
||||
Ghosts can see Chuck Norris.
|
||||
%
|
||||
Guns don't kill people. Chuck Norris kills people.
|
||||
%
|
||||
How much wood could a woodchuck chuck if a woodchuck could chuck wood? No woodchuck could chuck Chuck's wood!
|
||||
%
|
||||
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
|
||||
%
|
||||
If Chuck Norris were to get into a fight with another Chuck Norris, Chuck Norris would win.
|
||||
%
|
||||
If God doesn't know, Chuck does.
|
||||
%
|
||||
If Goliath listened to Chuck Norris, he would have won.
|
||||
%
|
||||
If at first you don't succeed, you're not Chuck Norris.
|
||||
%
|
||||
If you ask Chuck Norris what time it is, he always says, "Two seconds 'til." After you ask, "Two seconds 'til what?" he roundhouse kicks you in the face.
|
||||
%
|
||||
If you put in the correct cheat code in Halo 2, you can have Master Chief play without his helmet, revealing himself to be Chuck Norris.
|
||||
%
|
||||
If you see a man in the street who looks like Chuck Norris, but isn't, run: you don't want to be caught in the resulting roundhouse kick to his face.
|
||||
%
|
||||
If you spell Chuck Norris in Scrabble, you win. Forever.
|
||||
%
|
||||
In 1945 The US army asked if they could clone Chuck Norris. Instead he said he could sort out the Japanese.
|
||||
%
|
||||
In Texas, there are five sizes for fountain drinks: small, medium, large, Texas sized, and Chuck Norris sized. It is a cup made of a human skull.
|
||||
%
|
||||
In a rain storm Chuck Norris stays dry. Rain drops are scared to hit him.
|
||||
%
|
||||
In the back of the book of world records, it says "All records are held by Chuck Norris. The ones listed are in second place."
|
||||
%
|
||||
James Bond has a license to kill. He got it from Chuck Norris.
|
||||
%
|
||||
Jedis are now taught to use the "Chuck".
|
||||
%
|
||||
MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
|
||||
%
|
||||
Machiavelli said it is better to be feared than loved because he was inspired by Chuck Norris.
|
||||
%
|
||||
May the Force be with Chuck Norris... for its own good.
|
||||
%
|
||||
Merlin was Chuck Norris' assistant.
|
||||
%
|
||||
Most people have 23 pairs of chromosomes. Chuck Norris has 72... and they're all poisonous.
|
||||
%
|
||||
Note to self: Don't be the cashier to tell Chuck Norris his coupons have expired.
|
||||
%
|
||||
Chuck Norris' keyboard has no control key. Chuck Norris is always in control.
|
||||
%
|
||||
Once upon a time, Chuck Norris found himself in a town called Shit Creek. He opened a Paddle Store.
|
||||
%
|
||||
One glance from Chuck Norris and snow turns itself yellow.
|
||||
%
|
||||
One time a test cheated on Chuck Norris.
|
||||
%
|
||||
Only Chuck Norris can win the mind game, 'cause he never minds.
|
||||
%
|
||||
Only Chuck Norris is stronger than an Altoid.
|
||||
%
|
||||
Outer space exists because it's afraid to be on the same planet with Chuck Norris.
|
||||
%
|
||||
Ozzy Osbourne once accidentally bit the head off a live bat - Chuck Norris once deliberately bit the head off a live pterodactyl.
|
||||
%
|
||||
Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
|
||||
%
|
||||
Police label anyone attacking Chuck Norris as a Code 45-11.... a suicide.
|
||||
%
|
||||
Remember the Soviet Union? They decided to quit after watching a DeltaForce marathon on Satellite TV.
|
||||
%
|
||||
Simon doesn't say... Chuck Norris says.
|
||||
%
|
||||
Some boots were made for walking. Some boots may walk all over you, but Chuck Norris' boots walk THROUGH you.
|
||||
%
|
||||
Some kids pee their name in snow. Chuck Norris pees his name in concrete.
|
||||
%
|
||||
Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag.
|
||||
%
|
||||
Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
|
||||
%
|
||||
Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face.
|
||||
%
|
||||
Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS.
|
||||
%
|
||||
That's not an eclipse. That's the sun hiding from Chuck Norris.
|
||||
%
|
||||
The Beatles are on iTunes because Chuck Norris bought a Mac.
|
||||
%
|
||||
The Earth is made up of two-thirds water and one-third Chuck Norris.
|
||||
%
|
||||
The Earth was almost destroyed by a 50 km wide asteroid in 1984, but Chuck Norris roundhouse kicked it into the Sun.
|
||||
%
|
||||
The Great Wall of China was originally created to keep Chuck Norris out. It failed miserably.
|
||||
%
|
||||
The Joneses are trying to keep up with Chuck Norris.
|
||||
%
|
||||
The Matrix Trilogy would have ended on the first movie had Keanu Reeves said, “I know Chuck Norris.”
|
||||
%
|
||||
The answer to life, the universe and everything isn't 42. It's Chuck Norris.
|
||||
%
|
||||
The apple falls far from the tree, when Chuck's roundhouse kick is taken to the trunk.
|
||||
%
|
||||
The best part of waking up is not Folgers in your cup. it's knowing that Chuck Norris let you live.
|
||||
%
|
||||
The chief export of Chuck Norris is pain.
|
||||
%
|
||||
The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship.
|
||||
%
|
||||
The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
|
||||
%
|
||||
The letters in Chuck Norris cannot be unscrambled.
|
||||
%
|
||||
The only place where the Starship Enterprise refuses to boldly go is Chuck Norris' planet... which is all of them.
|
||||
%
|
||||
The only reason that USA lost the 2011 world cup to Japan is because Chuck Norris wasn't there.
|
||||
%
|
||||
The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||
%
|
||||
The only way sharks will come near CN underwater is when CN is inside of a cage.
|
||||
%
|
||||
The only word that rhymes with orange is Chuck Norris.
|
||||
%
|
||||
The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender".
|
||||
%
|
||||
The quickest way to a man's heart is with Chuck Norris' fist.
|
||||
%
|
||||
The reason why Batman only comes out at night is because he's afraid he might encounter Chuck Norris in the morning and afternoon.
|
||||
%
|
||||
The red phone in the oval office rings directly to Chuck Norris' cell phone.
|
||||
%
|
||||
The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
|
||||
%
|
||||
The square root of Chuck Norris is pain. Do not try to square Chuck Norris. The result is death.
|
||||
%
|
||||
The sun only rises every morning because Chuck Norris allows it to.
|
||||
%
|
||||
The truth hurts, doesn't it? Chuck Norris' truth kills.
|
||||
%
|
||||
There is no chin behind Chuck Norris' beard. There is only another fist.
|
||||
%
|
||||
There is no limbo, only a world that doesn't know of Chuck Norris.
|
||||
%
|
||||
There is no such thing as global warming. Chuck Norris was cold, so he turned the sun up.
|
||||
%
|
||||
There is no theory of evolution, just a list of creatures Chuck Norris has allowed to live.
|
||||
%
|
||||
This one time at band camp... BAM! Chuck Norris.
|
||||
%
|
||||
Those who ignore history, are doomed by Chuck Norris.
|
||||
%
|
||||
Trick me once, shame on you, trick Chuck Norris.. rest in peace.
|
||||
%
|
||||
Unlike Jack Bauer, Chuck Norris doesn't need bullets. A quick roundhouse to the face kills twice as fast.
|
||||
%
|
||||
Walker: Texas Ranger went into syndication before the first episode was shot.
|
||||
%
|
||||
What was going through the minds of all of Chuck Norris' victims before they died? His shoe.
|
||||
%
|
||||
Whatever Chuck Norris wants, it will instantly appear.
|
||||
%
|
||||
When Betty White gets angry, she turns into the Hulk. When Valerie Bertinelli gets mad, she turns into Chuck Norris.
|
||||
%
|
||||
When Chuck Norris creates a login, it tells him "password not strong enough." He types in his name and it tells him "password too strong."
|
||||
%
|
||||
When Chuck Norris does a pushup, he isn't lifting himself up, he's pushing the Earth down.
|
||||
%
|
||||
When Chuck Norris drinks water, the water automatically pasteurized.
|
||||
%
|
||||
When Chuck Norris goes to Vegas, he doesn't have to gamble. The casinos just give him stacks of money.
|
||||
%
|
||||
When Chuck Norris goes to rodeos, bulls ride him.
|
||||
%
|
||||
When Chuck Norris goes to the library, he looks for the Guinness book of records in the comedy section.
|
||||
%
|
||||
When Chuck Norris inhales helium, his voice doesn't change.
|
||||
%
|
||||
When Chuck Norris performs a roundhouse kick, he's actually measuring the circumference of the universe.
|
||||
%
|
||||
When Chuck Norris played the card game War with a friend, France surrendered.
|
||||
%
|
||||
When Chuck Norris pokes the Pillsbury Doughboy, it's not a laughing matter.
|
||||
%
|
||||
When Chuck Norris roundhouse-kicks you, he decides when you will feel the impact.
|
||||
%
|
||||
When Chuck Norris sends in his taxes, he sends blank forms and includes only a picture of himself, crouched and ready to attack. Chuck Norris has not had to pay taxes, ever.
|
||||
%
|
||||
When Chuck Norris tosses a coin, it lands on both heads and tails.
|
||||
%
|
||||
When God said "Let there be light!", Chuck Norris said "Only for half the day."
|
||||
%
|
||||
When Presidents speak, their nation listens. When Chuck Norris blinks, the whole world listens.
|
||||
%
|
||||
When Steven Seagal kills a ninja, he only takes its hide. When Chuck Norris kills a ninja, he uses every part.
|
||||
%
|
||||
When chuck Norris was in school, he made his PE teacher run laps.
|
||||
%
|
||||
When does Chuck Norris run out of shotgun bullets? whenever he wants to.
|
||||
%
|
||||
When taking the SAT, write "Chuck Norris" for every answer. You will score over 8000.
|
||||
%
|
||||
When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.
|
||||
%
|
||||
When things go bump in the night, it's Chuck Norris
|
||||
%
|
||||
While visiting the Hexagon, Chuck Norris was asked to demonstrate his famous roundhouse kick. Henceforth, it has been known as the Pentagon.
|
||||
%
|
||||
Why didn't the chicken cross the road? Because Chuck Norris got to it first.
|
||||
%
|
||||
You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "Godzilla". Oh, and his pet turtle starred in "Gamera" as well.
|
||||
%
|
||||
http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one.
|
||||
%
|
||||
Chuck Norris made the first Giraffe by uppercutting a horse.
|
||||
%
|
||||
Chuck Norris can hear sign language.
|
||||
%
|
||||
Chuck Norris make onions cry.
|
||||
%
|
||||
Chuck Norris doesn't shake hands, he makes them tremble.
|
||||
%
|
58
zsh/.oh-my-zsh/plugins/cloudfoundry/README.md
Normal file
58
zsh/.oh-my-zsh/plugins/cloudfoundry/README.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Cloudfoundry Plugin
|
||||
|
||||
This plugin is intended to offer a few simple aliases for regular users of the [Cloud Foundry Cli][1]. Most are just simple aliases that will save a bit of typing. Others include mini functions and or accept parameters. Take a look at the table below for details.
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------|-----------------------------|--------------------------------------------------------------------------|
|
||||
| cfl | `cf login` | Login to Cloud Foundry |
|
||||
| cft | `cf target` | Target the cli at a specific Org/Space in Cloud Foundry |
|
||||
| cfa | `cf apps` | List all applications in the current Org/Space |
|
||||
| cfs | `cf services` | List all services in the current Org/Space |
|
||||
| cfm | `cf marketplace` | List the services available in the Marketplace |
|
||||
| cfp | `cf push` | Push your application code to Cloud Foundry |
|
||||
| cfcs | `cf create-service` | Create a service based on a Marketplace offering |
|
||||
| cfbs | `cf bind-service` | Bind an application to a service you created |
|
||||
| cfus | `cf unbind-service` | Unbind a service from an application |
|
||||
| cfds | `cf delete-service` | Delete a service you no longer have bound |
|
||||
| cfup | `cf cups` | Create a "user-provided-service" |
|
||||
| cflg | `cf logs` | Tail the logs of an application (requires <APP_NAME>) |
|
||||
| cfr | `cf routes` | List all the routes in the current Space |
|
||||
| cfe | `cf env` | Show the environment variables for an application (requires <APP_NAME>) |
|
||||
| cfsh | `cf ssh` | Attach to a running container (requires an <APP_NAME> etc.) |
|
||||
| cfsc | `cf scale` | Scale an application (requires an <APP_NAME> etc.) |
|
||||
| cfev | `cf events` | Show the application events (requires <APP_NAME>) |
|
||||
| cfdor | `cf delete-orphaned-routes` | Delete routes that are no longer bound to applications |
|
||||
| cfbpk | `cf buildpacks` | List the available buildpacks |
|
||||
| cfdm | `cf domains` | List the domains associates with this Cloud Foundry foundation |
|
||||
| cfsp | `cf spaces` | List all the Spaces in the current Org |
|
||||
| cfap | `cf app` | Show the details of a deployed application (requires <APP_NAME>) |
|
||||
| cfh. | `export CF_HOME=$PWD/.cf` | Set the current directory as CF_HOME |
|
||||
| cfh~ | `export CF_HOME=~/.cf` | Set the user's root directory as CF_HOME |
|
||||
| cfhu | `unset CF_HOME` | Unsets CF_HOME |
|
||||
| cfpm | `cf push -f` | Push an application using a manifest (requires <MANIFEST_FILE> location) |
|
||||
| cflr | `cf logs --recent` | Show the recent logs (requires <APP_NAME>) |
|
||||
| cfsrt | `cf start` | Start an application (requires <APP_NAME>) |
|
||||
| cfstp | `cf stop` | Stop an application (requires <APP_NAME>) |
|
||||
| cfstg | `cf restage` | Restage an application (requires <APP_NAME>) |
|
||||
| cfdel | `cf delete` | Delete an application (requires <APP_NAME>) |
|
||||
| cfsrtall | - | Start all apps that are currently in the "Stopped" state |
|
||||
| cfstpall | - | Stop all apps that are currently in the "Started" state |
|
||||
|
||||
For help and advice on what any of the commands does, consult the built in `cf` help functions as follows:-
|
||||
|
||||
```bash
|
||||
cf help # List the most popular and commonly used commands
|
||||
cf help -a # Complete list of all possible commands
|
||||
cf <COMMAND_NAME> --help # Help on a specific command including arguments and examples
|
||||
```
|
||||
|
||||
Alternatively, seek out the [online documentation][3]. And don't forget, there are loads of great [community plugins for the cf-cli][4] command line tool that can greatly extend its power and usefulness.
|
||||
|
||||
## Contributors
|
||||
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
|
||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||
[2]: https://github.com/benwilcock
|
||||
[3]: https://docs.cloudfoundry.org/cf-cli/getting-started.html
|
||||
[4]: https://plugins.cloudfoundry.org/
|
34
zsh/.oh-my-zsh/plugins/cloudfoundry/cloudfoundry.plugin.zsh
Normal file
34
zsh/.oh-my-zsh/plugins/cloudfoundry/cloudfoundry.plugin.zsh
Normal file
@ -0,0 +1,34 @@
|
||||
# Some Useful CloudFoundry Aliases & Functions
|
||||
alias cfl="cf login"
|
||||
alias cft="cf target"
|
||||
alias cfa="cf apps"
|
||||
alias cfs="cf services"
|
||||
alias cfm="cf marketplace"
|
||||
alias cfp="cf push"
|
||||
alias cfcs="cf create-service"
|
||||
alias cfbs="cf bind-service"
|
||||
alias cfus="cf unbind-service"
|
||||
alias cfds="cf delete-service"
|
||||
alias cfup="cf cups"
|
||||
alias cflg="cf logs"
|
||||
alias cfr="cf routes"
|
||||
alias cfe="cf env"
|
||||
alias cfsh="cf ssh"
|
||||
alias cfsc="cf scale"
|
||||
alias cfev="cf events"
|
||||
alias cfdor="cf delete-orphaned-routes"
|
||||
alias cfbpk="cf buildpacks"
|
||||
alias cfdm="cf domains"
|
||||
alias cfsp="cf spaces"
|
||||
function cfap() { cf app $1 }
|
||||
function cfh.() { export CF_HOME=$PWD/.cf }
|
||||
function cfh~() { export CF_HOME=~/.cf }
|
||||
function cfhu() { unset CF_HOME }
|
||||
function cfpm() { cf push -f $1 }
|
||||
function cflr() { cf logs $1 --recent }
|
||||
function cfsrt() { cf start $1 }
|
||||
function cfstp() { cf stop $1 }
|
||||
function cfstg() { cf restage $1 }
|
||||
function cfdel() { cf delete $1 }
|
||||
function cfsrtall() {cf apps | awk '/stopped/ { system("cf start " $1)}'}
|
||||
function cfstpall() {cf apps | awk '/started/ { system("cf stop " $1)}'}
|
8
zsh/.oh-my-zsh/plugins/codeclimate/README.md
Normal file
8
zsh/.oh-my-zsh/plugins/codeclimate/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# codeclimate plugin
|
||||
|
||||
This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate).
|
||||
|
||||
To use it, add `codeclimate` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... codeclimate)
|
||||
```
|
82
zsh/.oh-my-zsh/plugins/codeclimate/_codeclimate
Normal file
82
zsh/.oh-my-zsh/plugins/codeclimate/_codeclimate
Normal file
@ -0,0 +1,82 @@
|
||||
#compdef codeclimate
|
||||
|
||||
_codeclimate_all_engines() {
|
||||
engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`)
|
||||
}
|
||||
|
||||
_codeclimate_installed_engines() {
|
||||
_codeclimate_all_engines
|
||||
|
||||
engines_installed=()
|
||||
|
||||
if [ -e .codeclimate.yml ]
|
||||
then
|
||||
for engine in $engines_all
|
||||
do
|
||||
if grep -q $engine ".codeclimate.yml"
|
||||
then
|
||||
engines_installed+=$engine
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_codeclimate_not_installed_engines() {
|
||||
_codeclimate_all_engines
|
||||
|
||||
engines_not_installed=()
|
||||
|
||||
if [ -e .codeclimate.yml ]
|
||||
then
|
||||
for engine in $engines_all
|
||||
do
|
||||
if ! grep -q $engine ".codeclimate.yml"
|
||||
then
|
||||
engines_not_installed+=$engine
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local expl
|
||||
local -a engines_all engines_installed engines_not_installed
|
||||
|
||||
_arguments \
|
||||
'1: :->cmds' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_values "bundle command" \
|
||||
"analyze[Analyze all relevant files in the current working directory]" \
|
||||
"console[Start an interactive session providing access to the classes within the CLI]" \
|
||||
"engines\:disable[Prevents the engine from being used in this project]" \
|
||||
"engines\:enable[This engine will be run the next time your project is analyzed]" \
|
||||
"engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \
|
||||
"engines\:list[Lists all available engines in the Code Climate Docker Hub]" \
|
||||
"engines\:remove[Removes an engine from your .codeclimate.yml file]" \
|
||||
"help[Displays a list of commands that can be passed to the Code Climate CLI]" \
|
||||
"init[Generates a new .codeclimate.yml file in the current working directory]" \
|
||||
"validate-config[Validates the .codeclimate.yml file in the current working directory]" \
|
||||
"version[Displays the current version of the Code Climate CLI]"
|
||||
ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
engines:enable)
|
||||
_codeclimate_not_installed_engines
|
||||
_wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;;
|
||||
engines:disable|engines:remove)
|
||||
_codeclimate_installed_engines
|
||||
_wanted engines_installed expl 'installed engines' compadd -a engines_installed ;;
|
||||
analyze)
|
||||
_arguments \
|
||||
'-f:Output Format:(text json)'
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
31
zsh/.oh-my-zsh/plugins/coffee/README.md
Normal file
31
zsh/.oh-my-zsh/plugins/coffee/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Coffeescript Plugin
|
||||
|
||||
This plugin provides aliases for quickly compiling and previewing your
|
||||
coffeescript code.
|
||||
|
||||
When writing Coffeescript it's very common to want to preview the output of a
|
||||
certain snippet of code, either because you want to test the output or because
|
||||
you'd like to execute it in a browser console which doesn't accept Coffeescript.
|
||||
|
||||
Preview the compiled result of your coffeescript with `cf "code"` as per the
|
||||
following:
|
||||
|
||||
```zsh
|
||||
$ cf 'if a then b else c'
|
||||
if (a) {
|
||||
b;
|
||||
} else {
|
||||
c;
|
||||
}
|
||||
```
|
||||
|
||||
Also provides the following aliases:
|
||||
|
||||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
||||
to run the code in a JS console.
|
||||
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||
to compile large/multi-line snippets
|
||||
|
||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
||||
the result back to clipboard.
|
81
zsh/.oh-my-zsh/plugins/coffee/_coffee
Normal file
81
zsh/.oh-my-zsh/plugins/coffee/_coffee
Normal file
@ -0,0 +1,81 @@
|
||||
#compdef coffee
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Coffee.js v0.6.11 (https://coffeescript.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Mario Fernandez (https://github.com/sirech)
|
||||
# * Dong Weiming (https://github.com/dongweiming)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local curcontext="$curcontext" state line ret=1 version opts first second third
|
||||
typeset -A opt_args
|
||||
version=(${(f)"$(_call_program version $words[1] --version)"})
|
||||
version=${${(z)${version[1]}}[3]}
|
||||
first=$(echo $version|cut -d '.' -f 1)
|
||||
second=$(echo $version|cut -d '.' -f 2)
|
||||
third=$(echo $version|cut -d '.' -f 3)
|
||||
if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then
|
||||
opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]'
|
||||
'(-r --require)'{-r,--require}'[require a library before executing your script]:library')
|
||||
fi
|
||||
|
||||
|
||||
_arguments -C \
|
||||
'(- *)'{-h,--help}'[display this help message]' \
|
||||
'(- *)'{-v,--version}'[display the version number]' \
|
||||
$opts \
|
||||
'(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
|
||||
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
|
||||
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
|
||||
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
|
||||
'(--nodejs)--nodejs[pass options directly to the "node" binary]' \
|
||||
'(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
|
||||
'(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
|
||||
'(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
|
||||
'(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
|
||||
'(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
|
||||
'(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
|
||||
'(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
|
||||
'*:script or directory:_files' && ret=0
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
16
zsh/.oh-my-zsh/plugins/coffee/coffee.plugin.zsh
Normal file
16
zsh/.oh-my-zsh/plugins/coffee/coffee.plugin.zsh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# compile a string of coffeescript and print to output
|
||||
cf () {
|
||||
coffee -peb "$1"
|
||||
}
|
||||
# compile & copy to clipboard
|
||||
cfc () {
|
||||
cf "$1" | clipcopy
|
||||
}
|
||||
|
||||
# compile from clipboard & print
|
||||
alias cfp='cf "$(clippaste)"'
|
||||
|
||||
# compile from clipboard and copy to clipboard
|
||||
alias cfpc='cfp | clipcopy'
|
1
zsh/.oh-my-zsh/plugins/colemak/.gitignore
vendored
Normal file
1
zsh/.oh-my-zsh/plugins/colemak/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.less
|
48
zsh/.oh-my-zsh/plugins/colemak/README.md
Normal file
48
zsh/.oh-my-zsh/plugins/colemak/README.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Colemak plugin
|
||||
|
||||
This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps)
|
||||
for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position:
|
||||
|
||||

|
||||
|
||||
To use it, add it to the plugins array in your `~/.zshrc` file:
|
||||
|
||||
```
|
||||
plugins=(... colemak)
|
||||
```
|
||||
|
||||
You will also need to enable `vi` mode, so add another line to `~/.zshrc`:
|
||||
```
|
||||
bindkey -v
|
||||
```
|
||||
|
||||
Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode,
|
||||
and start navigating `zsh` with your new keybindings!
|
||||
|
||||
## Key bindings for vicmd
|
||||
|
||||
| Old | New | Binding | Description |
|
||||
|------------|------------|---------------------------|----------------------------------------------------|
|
||||
| `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line |
|
||||
| `j` | `n` | down-line-or-history | Move one line down or command history forwards |
|
||||
| `k` | `e` | up-line-or-history | Move one line up or command history backwards |
|
||||
| `l` | `i` | vi-forward-char | Move one character to the right |
|
||||
| `n` | `k` | vi-repeat-search | Repeat command search forwards |
|
||||
| `N` | `K` | vi-rev-repeat-search | Repeat command search backwards |
|
||||
| `i` | `u` | vi-insert | Enter insert mode |
|
||||
| `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode |
|
||||
| `<none>` | `l` | vi-undo-change | Undo change |
|
||||
| `J` | `N` | vi-join | Join the current line with the next one |
|
||||
| `e` | `j` | vi-forward-word-end | Move to the end of the next word |
|
||||
| `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word |
|
||||
|
||||
## Key bindings for less
|
||||
|
||||
| Keyboard shortcut | `less` key binding |
|
||||
|-------------------|--------------------|
|
||||
| `n` | forw-line |
|
||||
| `e` | back-line |
|
||||
| `k` | repeat-search |
|
||||
| `ESC`+`k` | repeat-search-all |
|
||||
| `K` | reverse-search |
|
||||
| `ESC`+`K` | reverse-search-all |
|
6
zsh/.oh-my-zsh/plugins/colemak/colemak-less
Normal file
6
zsh/.oh-my-zsh/plugins/colemak/colemak-less
Normal file
@ -0,0 +1,6 @@
|
||||
n forw-line
|
||||
e back-line
|
||||
k repeat-search
|
||||
\ek repeat-search-all
|
||||
K reverse-search
|
||||
\eK reverse-search-all
|
33
zsh/.oh-my-zsh/plugins/colemak/colemak.plugin.zsh
Normal file
33
zsh/.oh-my-zsh/plugins/colemak/colemak.plugin.zsh
Normal file
@ -0,0 +1,33 @@
|
||||
# ctrl-j newline
|
||||
bindkey '^n' accept-line
|
||||
bindkey -a '^n' accept-line
|
||||
|
||||
# another rotation to match qwerty
|
||||
bindkey -a 'n' down-line-or-history
|
||||
bindkey -a 'e' up-line-or-history
|
||||
bindkey -a 'i' vi-forward-char
|
||||
|
||||
# make qwerty
|
||||
bindkey -a 'k' vi-repeat-search
|
||||
bindkey -a 'K' vi-rev-repeat-search
|
||||
bindkey -a 'u' vi-insert
|
||||
bindkey -a 'U' vi-insert-bol
|
||||
bindkey -a 'l' vi-undo-change
|
||||
bindkey -a 'N' vi-join
|
||||
|
||||
# spare
|
||||
bindkey -a 'j' vi-forward-word-end
|
||||
bindkey -a 'J' vi-forward-blank-word-end
|
||||
|
||||
# New less versions will read this file directly
|
||||
export LESSKEYIN="${0:h:A}/colemak-less"
|
||||
|
||||
# Only run lesskey if less version is older than v582
|
||||
less_ver=$(less --version | awk '{print $2;exit}')
|
||||
autoload -Uz is-at-least
|
||||
if ! is-at-least 582 $less_ver; then
|
||||
# Old less versions will read this transformed file
|
||||
export LESSKEY="${0:h:A}/.less"
|
||||
lesskey -o "$LESSKEY" "$LESSKEYIN" 2>/dev/null
|
||||
fi
|
||||
unset less_ver
|
32
zsh/.oh-my-zsh/plugins/colored-man-pages/README.md
Normal file
32
zsh/.oh-my-zsh/plugins/colored-man-pages/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# Colored man pages plugin
|
||||
|
||||
This plugin adds colors to man pages.
|
||||
|
||||
To use it, add `colored-man-pages` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... colored-man-pages)
|
||||
```
|
||||
|
||||
It will also automatically colorize man pages displayed by `dman` or `debman`,
|
||||
from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies).
|
||||
|
||||
You can also try to color other pages by prefixing the respective command with `colored`:
|
||||
|
||||
```zsh
|
||||
colored git help clone
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
The plugin declares global associative array `less_termcap`, which maps termcap capabilities to escape
|
||||
sequences for the `less` pager. This mapping can be further customized by the user after the plugin is
|
||||
loaded. Check out sources for more.
|
||||
|
||||
For example: `less_termcap[md]` maps to `LESS_TERMCAP_md` which is the escape sequence that tells `less`
|
||||
how to print something in bold. It's currently shown in bold red, but if you want to change it, you
|
||||
can redefine `less_termcap[md]` in your zshrc file, after OMZ is sourced:
|
||||
|
||||
```zsh
|
||||
less_termcap[md]="${fg_bold[blue]}" # this tells less to print bold text in bold blue
|
||||
```
|
@ -0,0 +1,48 @@
|
||||
# Requires colors autoload.
|
||||
# See termcap(5).
|
||||
|
||||
# Set up once, and then reuse. This way it supports user overrides after the
|
||||
# plugin is loaded.
|
||||
typeset -AHg less_termcap
|
||||
|
||||
# bold & blinking mode
|
||||
less_termcap[mb]="${fg_bold[red]}"
|
||||
less_termcap[md]="${fg_bold[red]}"
|
||||
less_termcap[me]="${reset_color}"
|
||||
# standout mode
|
||||
less_termcap[so]="${fg_bold[yellow]}${bg[blue]}"
|
||||
less_termcap[se]="${reset_color}"
|
||||
# underlining
|
||||
less_termcap[us]="${fg_bold[green]}"
|
||||
less_termcap[ue]="${reset_color}"
|
||||
|
||||
# Absolute path to this file's directory.
|
||||
typeset __colored_man_pages_dir="${0:A:h}"
|
||||
|
||||
function colored() {
|
||||
local -a environment
|
||||
|
||||
# Convert associative array to plain array of NAME=VALUE items.
|
||||
local k v
|
||||
for k v in "${(@kv)less_termcap}"; do
|
||||
environment+=( "LESS_TERMCAP_${k}=${v}" )
|
||||
done
|
||||
|
||||
# Prefer `less` whenever available, since we specifically configured
|
||||
# environment for it.
|
||||
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
||||
|
||||
# See ./nroff script.
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
environment+=( PATH="${__colored_man_pages_dir}:$PATH" )
|
||||
fi
|
||||
|
||||
command env $environment "$@"
|
||||
}
|
||||
|
||||
# Colorize man and dman/debman (from debian-goodies)
|
||||
function man \
|
||||
dman \
|
||||
debman {
|
||||
colored $0 "$@"
|
||||
}
|
12
zsh/.oh-my-zsh/plugins/colored-man-pages/nroff
Executable file
12
zsh/.oh-my-zsh/plugins/colored-man-pages/nroff
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The whole point of this wrapper is to replace emboldening factor -u0 with
|
||||
# -u1 under certain circumstances on Solaris.
|
||||
|
||||
if [ "$1,$2,$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u1 "$@"
|
||||
else
|
||||
# Some other invocation of nroff
|
||||
exec /usr/bin/nroff "$@"
|
||||
fi
|
56
zsh/.oh-my-zsh/plugins/colorize/README.md
Normal file
56
zsh/.oh-my-zsh/plugins/colorize/README.md
Normal file
@ -0,0 +1,56 @@
|
||||
# colorize
|
||||
|
||||
With this plugin you can syntax-highlight file contents of over 300 supported languages and other text formats.
|
||||
|
||||
Colorize will highlight the content based on the filename extension. If it can't find a syntax-highlighting
|
||||
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
|
||||
is found it will just cat the file normally, without syntax highlighting.
|
||||
|
||||
## Setup
|
||||
|
||||
To use it, add colorize to the plugins array of your `~/.zshrc` file:
|
||||
```
|
||||
plugins=(... colorize)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Requirements
|
||||
|
||||
This plugin requires that at least one of the following tools is installed:
|
||||
|
||||
* [Chroma](https://github.com/alecthomas/chroma)
|
||||
* [Pygments](https://pygments.org/download/)
|
||||
|
||||
### Colorize tool
|
||||
|
||||
Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
|
||||
|
||||
```
|
||||
ZSH_COLORIZE_TOOL=chroma
|
||||
```
|
||||
|
||||
### Styles
|
||||
|
||||
Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
|
||||
|
||||
```
|
||||
ZSH_COLORIZE_STYLE="colorful"
|
||||
```
|
||||
|
||||
### Chroma Formatter Settings
|
||||
|
||||
Chroma supports terminal output in 8 color, 256 color, and true-color. If you need to change the default terminal output style from the standard 8 color output, set the `ZSH_COLORIZE_CHROMA_FORMATTER` environment variable:
|
||||
|
||||
```
|
||||
ZSH_COLORIZE_CHROMA_FORMATTER=terminal256
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
||||
If no files are passed it will colorize the standard input.
|
||||
|
||||
* `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
|
||||
If no files are passed it will colorize the standard input.
|
||||
The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
|
114
zsh/.oh-my-zsh/plugins/colorize/colorize.plugin.zsh
Normal file
114
zsh/.oh-my-zsh/plugins/colorize/colorize.plugin.zsh
Normal file
@ -0,0 +1,114 @@
|
||||
# Easier alias to use the plugin
|
||||
alias ccat="colorize_cat"
|
||||
alias cless="colorize_less"
|
||||
|
||||
# '$0:A' gets the absolute path of this file
|
||||
ZSH_COLORIZE_PLUGIN_PATH=$0:A
|
||||
|
||||
colorize_check_requirements() {
|
||||
local -a available_tools
|
||||
available_tools=("chroma" "pygmentize")
|
||||
|
||||
if [ -z "$ZSH_COLORIZE_TOOL" ]; then
|
||||
if (( $+commands[pygmentize] )); then
|
||||
ZSH_COLORIZE_TOOL="pygmentize"
|
||||
elif (( $+commands[chroma] )); then
|
||||
ZSH_COLORIZE_TOOL="chroma"
|
||||
else
|
||||
echo "Neither 'pygments' nor 'chroma' is installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
|
||||
echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
|
||||
return 1
|
||||
elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
|
||||
echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
colorize_cat() {
|
||||
if ! colorize_check_requirements; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# If the environment variable ZSH_COLORIZE_STYLE
|
||||
# is set, use that theme instead. Otherwise,
|
||||
# use the default.
|
||||
if [ -z "$ZSH_COLORIZE_STYLE" ]; then
|
||||
# Both pygmentize & chroma support 'emacs'
|
||||
ZSH_COLORIZE_STYLE="emacs"
|
||||
fi
|
||||
|
||||
# Use stdin if no arguments have been passed.
|
||||
if [ $# -eq 0 ]; then
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
|
||||
fi
|
||||
return $?
|
||||
fi
|
||||
|
||||
# Guess lexer from file extension, or guess it from file contents if unsuccessful.
|
||||
local FNAME lexer
|
||||
for FNAME in "$@"; do
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||
else
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||
fi
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
|
||||
# caused by the lack of the ability to follow the file within pygmentize.
|
||||
colorize_less() {
|
||||
if ! colorize_check_requirements; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
_cless() {
|
||||
# LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
|
||||
local LESS="-R $LESS"
|
||||
|
||||
# This variable tells less to pipe every file through the specified command
|
||||
# (see the man page of less INPUT PREPROCESSOR).
|
||||
# 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
|
||||
# the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
|
||||
# Therefore we must source this file to make colorize_cat available in the
|
||||
# preprocessor without the interactive mode.
|
||||
# `2>/dev/null` will suppress the error for large files 'broken pipe' of the python
|
||||
# script pygmentize, which will show up if less has not fully "loaded the file"
|
||||
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
|
||||
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
||||
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
||||
colorize_cat %s 2> /dev/null'"
|
||||
|
||||
# LESSCLOSE will be set to prevent any errors by executing a user script
|
||||
# which assumes that his LESSOPEN has been executed.
|
||||
local LESSCLOSE=""
|
||||
|
||||
LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" command less "$@"
|
||||
}
|
||||
|
||||
if [ -t 0 ]; then
|
||||
_cless "$@"
|
||||
else
|
||||
# The input is not associated with a terminal, therefore colorize_cat will
|
||||
# colorize this input and pass it to less.
|
||||
# Less has now to decide what to use. If any files have been provided, less
|
||||
# will ignore the input by default, otherwise the colorized input will be used.
|
||||
# If files have been supplied and the input has been redirected, this will
|
||||
# lead to unnecessary overhead, but retains the ability to use the less options
|
||||
# without checking for them inside this script.
|
||||
colorize_cat | _cless "$@"
|
||||
fi
|
||||
}
|
33
zsh/.oh-my-zsh/plugins/command-not-found/README.md
Normal file
33
zsh/.oh-my-zsh/plugins/command-not-found/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# command-not-found plugin
|
||||
|
||||
This plugin uses the command-not-found package for zsh to provide suggested packages to be installed if a command cannot be found.
|
||||
|
||||
To use it, add `command-not-found` to the plugins array of your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... command-not-found)
|
||||
```
|
||||
|
||||
An example of how this plugin works in Ubuntu:
|
||||
```
|
||||
$ mutt
|
||||
The program 'mutt' can be found in the following packages:
|
||||
* mutt
|
||||
* mutt-kz
|
||||
* mutt-patched
|
||||
Try: sudo apt install <selected package>
|
||||
```
|
||||
|
||||
### Supported platforms
|
||||
|
||||
It works out of the box with the command-not-found packages for:
|
||||
|
||||
- [Ubuntu](https://www.porcheron.info/command-not-found-for-zsh/)
|
||||
- [Debian](https://packages.debian.org/search?keywords=command-not-found)
|
||||
- [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found)
|
||||
- [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
|
||||
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
|
||||
- [Termux](https://github.com/termux/command-not-found)
|
||||
|
||||
You can add support for other platforms by submitting a Pull Request.
|
@ -0,0 +1,62 @@
|
||||
## Platforms with a built-in command-not-found handler init file
|
||||
|
||||
for file (
|
||||
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
||||
/usr/share/doc/pkgfile/command-not-found.zsh
|
||||
# macOS (M1 and classic Homebrew): https://github.com/Homebrew/homebrew-command-not-found
|
||||
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
); do
|
||||
if [[ -r "$file" ]]; then
|
||||
source "$file"
|
||||
unset file
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
unset file
|
||||
|
||||
|
||||
## Platforms with manual command_not_found_handler() setup
|
||||
|
||||
# Debian and derivatives: https://launchpad.net/ubuntu/+source/command-not-found
|
||||
if [[ -x /usr/lib/command-not-found || -x /usr/share/command-not-found/command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
if [[ -x /usr/lib/command-not-found ]]; then
|
||||
/usr/lib/command-not-found -- "$1"
|
||||
return $?
|
||||
elif [[ -x /usr/share/command-not-found/command-not-found ]]; then
|
||||
/usr/share/command-not-found/command-not-found -- "$1"
|
||||
return $?
|
||||
else
|
||||
printf "zsh: command not found: %s\n" "$1" >&2
|
||||
return 127
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Fedora: https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound
|
||||
if [[ -x /usr/libexec/pk-command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
if [[ -S /var/run/dbus/system_bus_socket && -x /usr/libexec/packagekitd ]]; then
|
||||
/usr/libexec/pk-command-not-found "$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
printf "zsh: command not found: %s\n" "$1" >&2
|
||||
return 127
|
||||
}
|
||||
fi
|
||||
|
||||
# NixOS: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found
|
||||
if [[ -x /run/current-system/sw/bin/command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
/run/current-system/sw/bin/command-not-found -- "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
# Termux: https://github.com/termux/command-not-found
|
||||
if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
/data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1"
|
||||
}
|
||||
fi
|
123
zsh/.oh-my-zsh/plugins/common-aliases/README.md
Normal file
123
zsh/.oh-my-zsh/plugins/common-aliases/README.md
Normal file
@ -0,0 +1,123 @@
|
||||
# Common Aliases Plugin
|
||||
|
||||
This plugin creates helpful shortcut aliases for many commonly used commands.
|
||||
|
||||
To use it add `common-aliases` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... common-aliases)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
### ls command
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|---------------|--------------------------------------------------------------------------------|
|
||||
| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
|
||||
| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
|
||||
| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
|
||||
| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
|
||||
| ll | `ls -l` | List files as a long list |
|
||||
| ldot | `ls -ld .*` | List dot files as a long list |
|
||||
| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
|
||||
| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
|
||||
| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
|
||||
|
||||
### File handling
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------|------------------------------------------------------------------------------------|
|
||||
| rm | `rm -i` | Remove a file |
|
||||
| cp | `cp -i` | Copy a file |
|
||||
| mv | `mv -i` | Move a file |
|
||||
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
|
||||
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
|
||||
| duf | `du -sh` | Display the size of files in current location in human-readable form |
|
||||
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
|
||||
|
||||
### find and grep
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------------------------------------|-----------------------------------------|
|
||||
| fd\* | `find . -type d -name` | Find a directory with the given name |
|
||||
| ff | `find . -type f -name` | Find a file with the given name |
|
||||
| grep | `grep --color` | Searches for a query string |
|
||||
| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
|
||||
|
||||
\* Only if the [`fd`](https://github.com/sharkdp/fd) command isn't installed.
|
||||
|
||||
### Other Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|---------------------|-------------------------------------------------------------|
|
||||
| h | `history` | Lists all recently used commands |
|
||||
| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
|
||||
| help | `man` | Opens up the man page for a command |
|
||||
| p | `ps -f` | Displays currently executing processes |
|
||||
| sortnr | `sort -n -r` | Used to sort the lines of a text file |
|
||||
| unexport | `unset` | Used to unset an environment variable |
|
||||
|
||||
## Global aliases
|
||||
|
||||
These aliases are expanded in any position in the command line, meaning you can use them even at the
|
||||
end of the command you've typed. Examples:
|
||||
|
||||
Quickly pipe to less:
|
||||
```zsh
|
||||
$ ls -l /var/log L
|
||||
# will run
|
||||
$ ls -l /var/log | less
|
||||
```
|
||||
Silences stderr output:
|
||||
```zsh
|
||||
$ find . -type f NE
|
||||
# will run
|
||||
$ find . -type f 2>/dev/null
|
||||
```
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------------|-------------------------------------------------------------|
|
||||
| H | `\| head` | Pipes output to head which outputs the first part of a file |
|
||||
| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
|
||||
| G | `\| grep` | Pipes output to grep to search for some word |
|
||||
| L | `\| less` | Pipes output to less, useful for paging |
|
||||
| M | `\| most` | Pipes output to more, useful for paging |
|
||||
| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
|
||||
| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
|
||||
| NE | `2 > /dev/null` | Silences stderr |
|
||||
| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
|
||||
| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
|
||||
|
||||
## File extension aliases
|
||||
|
||||
These are special aliases that are triggered when a file name is passed as the command. For example,
|
||||
if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
|
||||
that file will be open with `acroread`.
|
||||
|
||||
### Reading Docs
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------|-------------------------------------|
|
||||
| pdf | `acroread` | Opens up a document using acroread |
|
||||
| ps | `gv` | Opens up a .ps file using gv |
|
||||
| dvi | `xdvi` | Opens up a .dvi file using xdvi |
|
||||
| chm | `xchm` | Opens up a .chm file using xchm |
|
||||
| djvu | `djview` | Opens up a .djvu file using djview |
|
||||
|
||||
### Listing files inside a packed file
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-------------|-------------------------------------|
|
||||
| zip | `unzip -l` | Lists files inside a .zip file |
|
||||
| rar | `unrar l` | Lists files inside a .rar file |
|
||||
| tar | `tar tf` | Lists files inside a .tar file |
|
||||
| tar.gz | `echo` | Lists files inside a .tar.gz file |
|
||||
| ace | `unace l` | Lists files inside a .ace file |
|
||||
|
||||
### Some other features
|
||||
|
||||
- Opens urls in terminal using browser specified by the variable `$BROWSER`
|
||||
- Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR`
|
||||
- Opens images using image viewer specified by the variable `$XIVIEWER`
|
||||
- Opens videos and other media using mplayer
|
@ -0,0 +1,88 @@
|
||||
# Advanced Aliases.
|
||||
# Use with caution
|
||||
#
|
||||
|
||||
# ls, the common ones I use a lot shortened for rapid fire usage
|
||||
alias l='ls -lFh' #size,show type,human readable
|
||||
alias la='ls -lAFh' #long list,show almost all,show type,human readable
|
||||
alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
|
||||
alias lt='ls -ltFh' #long list,sorted by date,show type,human readable
|
||||
alias ll='ls -l' #long list
|
||||
alias ldot='ls -ld .*'
|
||||
alias lS='ls -1FSsh'
|
||||
alias lart='ls -1Fcart'
|
||||
alias lrt='ls -1Fcrt'
|
||||
|
||||
alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file
|
||||
|
||||
alias grep='grep --color'
|
||||
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
|
||||
|
||||
alias t='tail -f'
|
||||
|
||||
# Command line head / tail shortcuts
|
||||
alias -g H='| head'
|
||||
alias -g T='| tail'
|
||||
alias -g G='| grep'
|
||||
alias -g L="| less"
|
||||
alias -g M="| most"
|
||||
alias -g LL="2>&1 | less"
|
||||
alias -g CA="2>&1 | cat -A"
|
||||
alias -g NE="2> /dev/null"
|
||||
alias -g NUL="> /dev/null 2>&1"
|
||||
alias -g P="2>&1| pygmentize -l pytb"
|
||||
|
||||
alias dud='du -d 1 -h'
|
||||
alias duf='du -sh *'
|
||||
(( $+commands[fd] )) || alias fd='find . -type d -name'
|
||||
alias ff='find . -type f -name'
|
||||
|
||||
alias h='history'
|
||||
alias hgrep="fc -El 0 | grep"
|
||||
alias help='man'
|
||||
alias p='ps -f'
|
||||
alias sortnr='sort -n -r'
|
||||
alias unexport='unset'
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
autoload -Uz is-at-least
|
||||
if is-at-least 4.2.0; then
|
||||
# open browser on urls
|
||||
if [[ -n "$BROWSER" ]]; then
|
||||
_browser_fts=(htm html de org net com at cx nl se dk)
|
||||
for ft in $_browser_fts; do alias -s $ft='$BROWSER'; done
|
||||
fi
|
||||
|
||||
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
|
||||
for ft in $_editor_fts; do alias -s $ft='$EDITOR'; done
|
||||
|
||||
if [[ -n "$XIVIEWER" ]]; then
|
||||
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
|
||||
for ft in $_image_fts; do alias -s $ft='$XIVIEWER'; done
|
||||
fi
|
||||
|
||||
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
for ft in $_media_fts; do alias -s $ft=mplayer; done
|
||||
|
||||
#read documents
|
||||
alias -s pdf=acroread
|
||||
alias -s ps=gv
|
||||
alias -s dvi=xdvi
|
||||
alias -s chm=xchm
|
||||
alias -s djvu=djview
|
||||
|
||||
#list whats inside packed file
|
||||
alias -s zip="unzip -l"
|
||||
alias -s rar="unrar l"
|
||||
alias -s tar="tar tf"
|
||||
alias -s tar.gz="echo "
|
||||
alias -s ace="unace l"
|
||||
fi
|
||||
|
||||
# Make zsh know about hosts already accessed by SSH
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
9
zsh/.oh-my-zsh/plugins/compleat/README.md
Normal file
9
zsh/.oh-my-zsh/plugins/compleat/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# compleat plugin
|
||||
|
||||
This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion.
|
||||
|
||||
To use it, add compleat to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... compleat)
|
||||
```
|
20
zsh/.oh-my-zsh/plugins/compleat/compleat.plugin.zsh
Normal file
20
zsh/.oh-my-zsh/plugins/compleat/compleat.plugin.zsh
Normal file
@ -0,0 +1,20 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# FILE: compleat.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if (( ${+commands[compleat]} )); then
|
||||
local prefix="${commands[compleat]:h:h}"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
|
||||
if [[ -f "$setup" ]]; then
|
||||
if ! bashcompinit >/dev/null 2>&1; then
|
||||
autoload -U bashcompinit
|
||||
bashcompinit -i
|
||||
fi
|
||||
|
||||
source "$setup"
|
||||
fi
|
||||
fi
|
31
zsh/.oh-my-zsh/plugins/composer/README.md
Normal file
31
zsh/.oh-my-zsh/plugins/composer/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# composer
|
||||
|
||||
This plugin provides completion for [composer](https://getcomposer.org/), as well as aliases
|
||||
for frequent composer commands. It also adds Composer's global binaries to the PATH, using
|
||||
Composer if available.
|
||||
|
||||
To use it add `composer` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... composer)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `c` | `composer` | Starts composer |
|
||||
| `csu` | `composer self-update` | Updates composer to the latest version |
|
||||
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
|
||||
| `cr` | `composer require` | Adds new packages to `composer.json` |
|
||||
| `crm` | `composer remove` | Removes packages from `composer.json` |
|
||||
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
|
||||
| `ccp` | `composer create-project` | Create new project from an existing package |
|
||||
| `cdu` | `composer dump-autoload` | Updates the autoloader |
|
||||
| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
|
||||
| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
|
||||
| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
|
||||
| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
|
||||
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
|
||||
| `co` | `composer outdated` | Shows a list of installed packages with available updates |
|
||||
| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user