1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-24 13:21:57 +00:00

Merge branch 'master' into patch-1

This commit is contained in:
Moulick Aggarwal 2020-06-15 23:03:00 +05:30 committed by GitHub
commit 4963f830cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
323 changed files with 9513 additions and 6286 deletions

3
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,3 @@
# Plugin owners
plugins/gitfast/ @felipec
plugins/sdk/ @rgoldberg

View file

@ -1,6 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help us improve Oh My Zsh
labels: 'Type: support'
---
@ -10,29 +11,26 @@ an issue where no sections have been filled will be deleted without comment.
-->
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
A clear description of what the bug is.
**To Reproduce**
<!--
Steps to reproduce the behavior:
1. Enable plugin '...'
2. Run command '...', _or_ try to complete command '...', _etc._
Steps to reproduce the behavior, for example:
1. Enable this plugin '...'
2. Run command '...' or try the autocomplete command '...'
3. See error
-->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
A brief description of what should happen.
**Screenshots or recordings**
<!--
If applicable, add screenshots or record an asciinema session (https://asciinema.org/)
to help explain your problem.
-->
**Screenshots and/or Recordings**
If applicable, add screenshots to help explain your problem.
You can also record an asciinema session: https://asciinema.org/
**System:**
- OS: [e.g. macOS]
- Zsh version [e.g. 5.6]
**Desktop (please complete the following information):**
- OS / Distro: [e.g. Arch Linux, macOS]
- Latest ohmyzsh Update?: [e.g. Yes/No]
- ZSH Version: [e.g. 5.6]
- Terminal emulator [e.g. iTerm2]
**Additional context**
<!-- Add any other context about the problem here. -->
Add any other context about the problem here. This can be themes, plugins, custom configs.

View file

@ -11,16 +11,16 @@ an issue where no sections have been filled will be deleted without comment.
-->
**Is your feature request related to a particular plugin or theme? If so, specify it.**
<!-- The name of the plugin or theme you'd like us to improve. -->
The name of the plugin or theme that you would like us to improve. [...]
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
A description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
A description of what you want to happen.
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
A description of any alternative solutions or features you've considered. This can also include other plugins or aliases.
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
Add any other context or screenshots about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.

View file

@ -5,8 +5,6 @@ labels: 'Type: support'
---
<!--
1. Look for similar issues already posted (including closed ones)
2. Include as much relevant information as possible
3. Try to make sure the issue is due to Oh My Zsh
-->

17
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,17 @@
## Standards checklist:
- [ ] The PR title is descriptive.
- [ ] The PR doesn't replicate another PR which is already open.
- [ ] I have read the contribution guide and followed all the instructions.
- [ ] The code follows the code style guide detailed in the wiki.
- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
- [ ] The code is stable and I have tested it myself, to the best of my abilities.
## Changes:
- [...]
## Other comments:
...

36
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: CI
on:
pull_request:
types:
- opened
- synchronize
branches:
- master
push:
branches:
- master
jobs:
tests:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Set up git repository
uses: actions/checkout@v2
- name: Install zsh
if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh
- name: Test installer
run: sh ./tools/install.sh
- name: Check syntax
run: |
for file in ./oh-my-zsh.sh \
./lib/*.zsh \
./plugins/*/*.plugin.zsh \
./plugins/*/_* \
./themes/*.zsh-theme; do
zsh -n "$file" || return 1
done

2
.gitignore vendored
View file

@ -4,3 +4,5 @@ custom/
# temp files directories
cache/
log/
*.swp
.DS_Store

View file

@ -31,7 +31,7 @@ your problem.
If you find one, comment on it so we can know there are more people experiencing it.
If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting)
If not, look at the [Troubleshooting](https://github.com/ohmyzsh/ohmyzsh/wiki/Troubleshooting)
page for instructions on how to gather data to better debug your problem.
Then, you can go ahead and create an issue with as much detail as you can provide.
@ -62,7 +62,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
You should be familiar with the basics of
[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork
[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices).
[properly set up](https://github.com/ohmyzsh/ohmyzsh/wiki/Contribution-Technical-Practices).
You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree.
@ -85,7 +85,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
### You have an addition
Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now)
Please [do not](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#dont-send-us-your-theme-for-now)
send themes for now.
Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests
@ -109,7 +109,7 @@ to help you check whether a similar contribution to yours already exists. Please
before making any contribution, it avoids duplicates and eases maintenance. Trust me,
that works 90% of the time.
You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ)
You can also take a look at the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ)
to be sure your contribution has not already come up.
If all fails, your thing has probably not been reported yet, so you can go ahead
@ -121,5 +121,5 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque
Very nice!! :)
Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers)
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
page for instructions on where to start and more.

View file

@ -1,7 +1,6 @@
The MIT License (MIT)
MIT License
Copyright (c) 2009-2019 Robby Russell and contributors
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -12,16 +12,20 @@ Once installed, your terminal shell will become the talk of the town _or your mo
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬
To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and/or join us on Discord.
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
## Getting Started
### Prerequisites
* A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL is preferred, but cygwin or msys also mostly work.
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (run `zsh --version` to confirm), check the following instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed
* `git` should be installed
* `git` should be installed (recommended v1.7.2 or higher)
### Basic Installation
@ -30,13 +34,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
#### via curl
```shell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
#### via wget
```shell
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
#### Manual inspection
@ -46,7 +50,7 @@ that by downloading the install script first, looking through it so everything l
then running it:
```shell
curl -Lo install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh
```
@ -54,7 +58,7 @@ sh install.sh
### Plugins
Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available.
Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) directory and/or the [wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) to see what's currently available.
#### Enabling Plugins
@ -86,7 +90,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
### Themes
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki. Check them out!
#### Selecting a Theme
@ -102,7 +106,7 @@ To use a different theme, simply change the value to match the name of your desi
```shell
ZSH_THEME="agnoster" # (this is one of the fancy ones)
# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
```
_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
@ -111,7 +115,7 @@ Open up a new terminal window and your prompt should look something like this:
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes).
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
@ -129,6 +133,16 @@ ZSH_THEME_RANDOM_CANDIDATES=(
)
```
If you only know which themes you don't like, you can add them similarly to a blacklist:
```shell
ZSH_THEME_RANDOM_BLACKLIST=(pygmalion tjkirch_mod)
```
### FAQ
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
## Advanced Topics
If you're the type that likes to get their hands dirty, these sections might resonate.
@ -157,14 +171,14 @@ flag `--unattended` to the `install.sh` script. This will have the effect of not
the default shell, and also won't run `zsh` when the installation has finished.
```shell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
```
#### Installing from a forked repository
The install script also accepts these variables to allow installation of a different repository:
- `REPO` (default: `robbyrussell/oh-my-zsh`): this takes the form of `owner/repository`. If you set
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
- `REMOTE` (default: `https://github.com/${REPO}.git`): this is the full URL of the git repository
@ -188,7 +202,7 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
##### 1. Clone the repository:
```shell
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
```
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
@ -270,13 +284,13 @@ Before you participate in our delightful community, please read the [code of con
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
See [Contributing](CONTRIBUTING.md) for more details.
### Do NOT send us themes
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
## Contributors

195
lib/cli.zsh Normal file
View file

@ -0,0 +1,195 @@
#!/usr/bin/env zsh
function omz {
[[ $# -gt 0 ]] || {
_omz::help
return 1
}
local command="$1"
shift
# Subcommand functions start with _ so that they don't
# appear as completion entries when looking for `omz`
(( $+functions[_omz::$command] )) || {
_omz::help
return 1
}
_omz::$command "$@"
}
function _omz {
local -a cmds subcmds
cmds=(
'help:Usage information'
'pr:Commands for Oh My Zsh Pull Requests'
)
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
pr) subcmds=( 'test:Test a Pull Request' 'clean:Delete all Pull Request branches' )
_describe 'command' subcmds ;;
esac
fi
return 0
}
compdef _omz omz
function _omz::help {
cat <<EOF
Usage: omz <command> [options]
Available commands:
help Print this help message
pr <command> Commands for Oh My Zsh Pull Requests
EOF
}
function _omz::log {
# if promptsubst is set, a message with `` or $()
# will be run even if quoted due to `print -P`
setopt localoptions nopromptsubst
# $1 = info|warn|error|debug
# $@ = text
local logtype=$1
local logname=${${functrace[1]#_}%:*}
shift
# Don't print anything if debug is not active
if [[ $logtype = debug && -z $_OMZ_DEBUG ]]; then
return
fi
# Choose coloring based on log type
case "$logtype" in
prompt) print -Pn "%S%F{blue}$logname%f%s: $@" ;;
debug) print -P "%F{white}$logname%f: $@" ;;
info) print -P "%F{green}$logname%f: $@" ;;
warn) print -P "%S%F{yellow}$logname%f%s: $@" ;;
error) print -P "%S%F{red}$logname%f%s: $@" ;;
esac >&2
}
function _omz::pr {
(( $# > 0 && $+functions[_omz::pr::$1] )) || {
cat <<EOF
Usage: omz pr <command> [options]
Available commands:
clean Delete all PR branches (ohmyzsh/pull-*)
test <PR_number_or_URL> Fetch PR #NUMBER and rebase against master
EOF
return 1
}
local command="$1"
shift
_omz::pr::$command "$@"
}
function _omz::pr::clean {
(
set -e
builtin cd -q "$ZSH"
_omz::log info "removing all Oh My Zsh Pull Request branches..."
command git branch --list 'ohmyzsh/pull-*' | while read branch; do
command git branch -D "$branch"
done
)
}
function _omz::pr::test {
# Allow $1 to be a URL to the pull request
if [[ "$1" = https://* ]]; then
1="${1:t}"
fi
# Check the input
if ! [[ -n "$1" && "$1" =~ ^[[:digit:]]+$ ]]; then
echo >&2 "Usage: omz pr test <PR_NUMBER_or_URL>"
return 1
fi
# Save current git HEAD
local branch
branch=$(builtin cd -q "$ZSH"; git symbolic-ref --short HEAD) || {
_omz::log error "error when getting the current git branch. Aborting..."
return 1
}
# Fetch PR onto ohmyzsh/pull-<PR_NUMBER> branch and rebase against master
# If any of these operations fail, undo the changes made
(
set -e
builtin cd -q "$ZSH"
# Get the ohmyzsh git remote
command git remote -v | while read remote url _; do
case "$url" in
https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
esac
done
(( $found )) || {
_omz::log error "could not found the ohmyzsh git remote. Aborting..."
return 1
}
# Fetch pull request head
_omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {
_omz::log error "error when trying to fetch PR #$1."
return 1
}
# Rebase pull request branch against the current master
_omz::log info "rebasing PR #$1..."
command git rebase master ohmyzsh/pull-$1 || {
command git rebase --abort &>/dev/null
_omz::log warn "could not rebase PR #$1 on top of master."
_omz::log warn "you might not see the latest stable changes."
_omz::log info "run \`zsh\` to test the changes."
return 1
}
_omz::log info "fetch of PR #${1} successful."
)
# If there was an error, abort running zsh to test the PR
[[ $? -eq 0 ]] || return 1
# Run zsh to test the changes
_omz::log info "running \`zsh\` to test the changes. Run \`exit\` to go back."
command zsh -l
# After testing, go back to the previous HEAD if the user wants
_omz::log prompt "do you want to go back to the previous branch? [Y/n] "
read -r -k 1
[[ "$REPLY" = [nN] ]] && return
(
set -e
builtin cd -q "$ZSH"
command git checkout "$branch" -- || {
_omz::log error "could not go back to the previous branch ('$branch')."
return 1
}
)
}

View file

@ -3,10 +3,23 @@
# This file has support for doing system clipboard copy and paste operations
# from the command line in a generic cross-platform fashion.
#
# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
# "system clipboard", and the X Windows `xclip` command must be installed.
# This is uses essentially the same heuristic as neovim, with the additional
# special support for Cygwin.
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
#
# - pbcopy, pbpaste (macOS)
# - cygwin (Windows running Cygwin)
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
# - xclip (if $DISPLAY is set)
# - xsel (if $DISPLAY is set)
# - lemonade (for SSH) https://github.com/pocke/lemonade
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows)
# - tmux (if $TMUX is set)
#
# Defines two functions, clipcopy and clippaste, based on the detected platform.
##
#
# clipcopy - Copy data to clipboard
#
# Usage:
@ -15,41 +28,8 @@
#
# clipcopy <file> - copies a file's contents to clipboard
#
function clipcopy() {
emulate -L zsh
local file=$1
if [[ $OSTYPE == darwin* ]]; then
if [[ -z $file ]]; then
pbcopy
else
cat $file | pbcopy
fi
elif [[ $OSTYPE == cygwin* ]]; then
if [[ -z $file ]]; then
cat > /dev/clipboard
else
cat $file > /dev/clipboard
fi
else
if (( $+commands[xclip] )); then
if [[ -z $file ]]; then
xclip -in -selection clipboard
else
xclip -in -selection clipboard $file
fi
elif (( $+commands[xsel] )); then
if [[ -z $file ]]; then
xsel --clipboard --input
else
cat "$file" | xsel --clipboard --input
fi
else
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1
fi
fi
}
##
#
# clippaste - "Paste" data from clipboard to stdout
#
# Usage:
@ -67,20 +47,61 @@ function clipcopy() {
#
# # Paste to a file
# clippaste > file.txt
function clippaste() {
#
function detect-clipboard() {
emulate -L zsh
if [[ $OSTYPE == darwin* ]]; then
pbpaste
elif [[ $OSTYPE == cygwin* ]]; then
cat /dev/clipboard
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
function clippaste() { pbpaste; }
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
function clippaste() { cat /dev/clipboard; }
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { wl-copy < "${1:-/dev/stdin}"; }
function clippaste() { wl-paste; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
function clippaste() { xclip -out -selection clipboard; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
function clippaste() { xsel --clipboard --output; }
elif (( ${+commands[lemonade]} )); then
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
function clippaste() { lemonade paste; }
elif (( ${+commands[doitclient]} )); then
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
function clippaste() { doitclient wclip -r; }
elif (( ${+commands[win32yank]} )); then
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
function clippaste() { win32yank -o; }
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; }
function clippaste() { termux-clipboard-get; }
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer "${1:--}"; }
function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
else
if (( $+commands[xclip] )); then
xclip -out -selection clipboard
elif (( $+commands[xsel] )); then
xsel --clipboard --output
else
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1
fi
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift
if detect-clipboard; then
"${clipcmd}" "$@"
else
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1
fi
}
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1
fi
}
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
# which is not really an error. If the user calls them, they will attempt to redetect
# (for example, perhaps the user has now installed xclip) and then either print an error
# or proceed successfully.
detect-clipboard || true

View file

@ -41,8 +41,8 @@ fi
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
@ -71,3 +71,6 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
fi
# automatically load bash completion functions
autoload -U +X bashcompinit && bashcompinit

View file

@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() {
command ls -ld ~/.oh*
builtin echo
builtin echo oh-my-zsh git state:
(cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
(builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
if [[ $verbose -ge 1 ]]; then
(cd $ZSH && git reflog --date=default | command grep pull)
(builtin cd $ZSH && git reflog --date=default | command grep pull)
fi
builtin echo
if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then
custom_dir=$(cd $custom_dir && pwd -P)
custom_dir=$(builtin cd $custom_dir && pwd -P)
fi
builtin echo "oh-my-zsh custom dir:"
builtin echo " $ZSH_CUSTOM ($custom_dir)"
(cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
(builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
builtin echo
fi

View file

@ -3,11 +3,12 @@ function zsh_stats() {
}
function uninstall_oh_my_zsh() {
env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
}
function upgrade_oh_my_zsh() {
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
command rm -rf "$ZSH/log/update.lock"
}
function take() {
@ -88,7 +89,7 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
(( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
[[ ${parameters[$1]} = *-export* ]] && return 0
export "$1=$2" && return 3
}

View file

@ -12,11 +12,21 @@ function git_prompt_info() {
function parse_git_dirty() {
local STATUS
local -a FLAGS
FLAGS=('--porcelain' '--ignore-submodules=dirty')
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
case "$GIT_STATUS_IGNORE_SUBMODULES" in
git)
# let git decide (this respects per-repo config in .gitmodules)
;;
*)
# if unset: ignore dirty submodules
# other values are passed to --ignore-submodules
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
;;
esac
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
@ -189,3 +199,12 @@ function git_current_user_name() {
function git_current_user_email() {
command git config user.email 2>/dev/null
}
# Output the name of the root directory of the git repository
# Usage example: $(git_repo_name)
function git_repo_name() {
local repo_path
if repo_path="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
echo ${repo_path:t}
fi
}

View file

@ -1,28 +1,41 @@
# is x grep argument available?
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
GREP_OPTIONS=""
# See if there's a cache file modified in the last day
__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
if [[ -n "$__GREP_ALIAS_CACHES" ]]; then
source "$__GREP_CACHE_FILE"
else
grep-flags-available() {
command grep "$@" "" &>/dev/null <<< ""
}
# color grep results
if grep-flag-available --color=auto; then
GREP_OPTIONS+=" --color=auto"
# Ignore these folders (if the necessary grep flags are available)
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
# isn't available, --color won't be either (they were released at the same
# time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
if grep-flags-available --color=auto --exclude-dir=.cvs; then
GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
elif grep-flags-available --color=auto --exclude=.cvs; then
GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
fi
if [[ -n "$GREP_OPTIONS" ]]; then
# export grep, egrep and fgrep settings
alias grep="grep $GREP_OPTIONS"
alias egrep="egrep $GREP_OPTIONS"
alias fgrep="fgrep $GREP_OPTIONS"
# write to cache file if cache directory is writable
if [[ -w "$ZSH_CACHE_DIR" ]]; then
alias -L grep egrep fgrep >| "$__GREP_CACHE_FILE"
fi
fi
# Clean up
unset GREP_OPTIONS EXC_FOLDERS
unfunction grep-flags-available
fi
# ignore VCS folders (if the necessary grep flags are available)
VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
if grep-flag-available --exclude-dir=.cvs; then
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
elif grep-flag-available --exclude=.cvs; then
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
fi
# export grep settings
alias grep="grep $GREP_OPTIONS"
# clean up
unset GREP_OPTIONS
unset VCS_FOLDERS
unfunction grep-flag-available
unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES

View file

@ -27,8 +27,8 @@ esac
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=10000
[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
@ -36,5 +36,4 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data

View file

@ -3,15 +3,15 @@ autoload -Uz is-at-least
# *-magic is known buggy in some versions; disable if so
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
for d in $fpath; do
if [[ -e "$d/url-quote-magic" ]]; then
if is-at-least 5.1; then
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
fi
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
break
fi
if [[ -e "$d/url-quote-magic" ]]; then
if is-at-least 5.1; then
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
fi
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
break
fi
done
fi
@ -25,7 +25,7 @@ env_default 'LESS' '-R'
alias _='sudo '
## more intelligent acking for ubuntu users
if which ack-grep &> /dev/null; then
if (( $+commands[ack-grep] )); then
alias afind='ack-grep -il'
else
alias afind='ack -il'

View file

@ -1,4 +1,3 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
@ -6,32 +5,31 @@
typeset -AHg FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
# Show all 256 colors with color number
function spectrum_ls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}
# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
for code in {000..255}; do
print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
done
}

View file

@ -17,7 +17,7 @@ function title {
: ${2=$1}
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|ansi)
cygwin|xterm*|putty*|rxvt*|konsole*|ansi)
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
;;
@ -32,10 +32,10 @@ function title {
# Try to use terminfo to set the title
# If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl
print -Pn "$1"
echoti fsl
fi
echoti tsl
print -Pn "$1"
echoti fsl
fi
fi
;;
esac
@ -50,22 +50,52 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
emulate -L zsh
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
return
fi
[[ "$DISABLE_AUTO_TITLE" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return
emulate -L zsh
setopt extended_glob
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
return
# split command into array of arguments
local -a cmdargs
cmdargs=("${(z)2}")
# if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in
<->) # %number argument:
# use the same <number> passed as an argument
job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument:
# use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac
# override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}"
fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
@ -75,8 +105,9 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<'
}
precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
# Keep Apple Terminal.app's current working directory updated
@ -90,16 +121,17 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
# Percent-encode the pathname.
local URL_PATH="$(omz_urlencode -P $PWD)"
[[ $? != 0 ]] && return 1
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
precmd_functions+=(update_terminalapp_cwd)
add-zsh-hook precmd update_terminalapp_cwd
# Run once to get initial cwd set
update_terminalapp_cwd
fi

View file

@ -4,11 +4,6 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
# Migrate .zsh-update file to $ZSH_CACHE_DIR
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
fi
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
@ -32,8 +27,8 @@ fi
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| builtin test -f $base_dir/plugins/$name/_$name
}
# Add all defined plugins to fpath. This must be done
@ -61,6 +56,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
# Construct zcompdump OMZ metadata
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
zcompdump_fpath="#omz fpath: $fpath"
# Delete the zcompdump file if OMZ zcompdump metadata changed
if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
|| ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
command rm -f "$ZSH_COMPDUMP"
zcompdump_refresh=1
fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user
@ -72,6 +78,19 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}"
fi
# Append zcompdump metadata if missing
if (( $zcompdump_refresh )); then
# Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
# See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF
$zcompdump_revision
$zcompdump_fpath
EOF
fi
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
@ -97,25 +116,12 @@ done
unset config_file
# Load the theme
if [[ "$ZSH_THEME" == "random" ]]; then
if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then
themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme)
if [ ! "$ZSH_THEME" = "" ]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
else
themes=($ZSH/themes/*zsh-theme)
fi
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ ! "$ZSH_THEME" = "" ]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi

View file

@ -4,7 +4,7 @@ alias-finder() {
case $i in
-e|--exact) exact=true;;
-l|--longer) longer=true;;
*)
*)
if [[ -z $cmd ]]; then
cmd=$i
else
@ -14,7 +14,7 @@ alias-finder() {
esac
done
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
if [[ $(wc -l <<< $cmd) == 1 ]]; then
if (( $(wc -l <<< $cmd) == 1 )); then
while [[ $cmd != "" ]]; do
if [[ $longer = true ]]; then
wordStart="'{0,1}"
@ -43,4 +43,5 @@ preexec_alias-finder() {
fi
}
preexec_functions+=(preexec_alias-finder)
autoload -U add-zsh-hook
add-zsh-hook preexec preexec_alias-finder

View file

@ -1,19 +1,21 @@
## APACHE2 MACPORTS PLUGIN
# 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:
### FEATURES
```zsh
plugins=(... apache2-macports)
```
| Alias | Function | Description |
|:--------------:|:-------------------------------------------------------------------------------|----------------------:|
| apache2restart | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart | Restart apache daemon |
| apache2start | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start | Start apache daemon |
| apache2stop | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop | Stop apache daemon |
## 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)
## Contributors
---
- Alexander Rinass (alex@rinass.net)

View file

@ -1,5 +1,41 @@
## arcanist
**Maintainer:** [@emzar](https://github.com/emzar)
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
This plugin adds many useful aliases.
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] |

View file

@ -9,13 +9,29 @@ 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'
alias arpa='arc patch'
#
# 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}"
}

View file

@ -1,5 +1,13 @@
# Archlinux 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
#### YAY
@ -119,7 +127,7 @@
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
| pacfiles | pacman -Fs | Search package file names for matching strings |
| 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 |

View file

@ -149,7 +149,7 @@ 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 -Fs'
alias pacfiles='pacman -F'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
@ -208,7 +208,7 @@ function pacmansignkeys() {
if (( $+commands[xdg-open] )); then
function pacweb() {
pkg="$1"
infos="$(pacman -Si "$pkg")"
infos="$(LANG=C pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then
return
fi

View file

@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
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

View file

@ -7,8 +7,14 @@ 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: https://github.com/inishchith/autoenv
More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv).

View file

@ -1,12 +1,39 @@
# Activates autoenv or reports its failure
# Initialization: activate autoenv or report its absence
() {
local d autoenv_dir install_locations
if ! type autoenv_init >/dev/null; then
for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do
# 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
break
fi
done
fi
# Complain if autoenv is not installed
if [[ -z $autoenv_dir ]]; then
cat <<END >&2
-------- AUTOENV ---------
@ -17,6 +44,7 @@ In the meantime the autoenv plugin is DISABLED.
END
return 1
fi
# Load autoenv
source $autoenv_dir/activate.sh
fi
}
@ -27,17 +55,17 @@ fi
# It only performs an action if the requested virtualenv is not the current one.
use_env() {
typeset 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
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
}

View file

@ -8,4 +8,4 @@ To use it, add `autojump` to the plugins array in your zshrc file:
plugins=(... autojump)
```
More info on the usage: https://github.com/wting/autojump
**Note:** you have to [install autojump](https://github.com/wting/autojump#installation) first.

View file

@ -29,6 +29,6 @@ if (( ! found && $+commands[brew] )); then
fi
fi
(( ! found )) && echo '[oh-my-zsh] autojump script not found'
(( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.'
unset autojump_paths file found

View file

@ -10,7 +10,8 @@ function asp() {
return
fi
local available_profiles=($(aws_profiles))
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
@ -30,12 +31,12 @@ function aws_change_access_key() {
echo Insert the credentials when asked.
asp "$1" || return 1
aws iam create-access-key
aws configure --profile "$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 iam list-access-keys
AWS_PAGER="" aws iam list-access-keys
}
function aws_profiles() {
@ -61,36 +62,45 @@ fi
# Load awscli completions
function _awscli-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
if [[ -x /usr/local/bin/aws_completer ]]; 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)
# 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
}
# 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
# RPM
else
_aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
fi
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path _brew_prefix
fi
[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path _brew_prefix

View file

@ -11,22 +11,21 @@
# Modified to add support for FreeBSD #
###########################################
if [[ "$OSTYPE" = darwin* ]] ; then
if [[ "$OSTYPE" = darwin* ]]; then
function battery_pct() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
integer i=$(((currentcapacity/maxcapacity) * 100))
echo $i
function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
}
function plugged_in() {
[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ Yes') -eq 1 ]
function battery_pct() {
local battery_status="$(ioreg -rc AppleSmartBattery)"
local -i capacity=$(sed -n -e '/MaxCapacity/s/^.*"MaxCapacity"\ =\ //p' <<< $battery_status)
local -i current=$(sed -n -e '/CurrentCapacity/s/^.*"CurrentCapacity"\ =\ //p' <<< $battery_status)
echo $(( current * 100 / capacity ))
}
function battery_pct_remaining() {
if plugged_in ; then
if battery_is_charging; then
echo "External Power"
else
battery_pct
@ -35,9 +34,9 @@ if [[ "$OSTYPE" = darwin* ]] ; then
function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
if [ $timeremaining -gt 720 ] ; then
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))"
@ -48,39 +47,36 @@ if [[ "$OSTYPE" = darwin* ]] ; then
}
function battery_pct_prompt () {
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
b=$(battery_pct_remaining)
if [ $b -gt 50 ] ; then
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 [ $b -gt 20 ] ; then
elif [[ $battery_pct -gt 20 ]]; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
else
echo "∞"
fi
}
function battery_is_charging() {
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
}
elif [[ "$OSTYPE" = freebsd* ]] ; then
elif [[ "$OSTYPE" = freebsd* ]]; then
function battery_is_charging() {
[[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
}
function battery_pct() {
if (( $+commands[sysctl] )) ; then
echo "$(sysctl -n hw.acpi.battery.life)"
if (( $+commands[sysctl] )); then
sysctl -n hw.acpi.battery.life
fi
}
function battery_pct_remaining() {
if [ ! $(battery_is_charging) ] ; then
if ! battery_is_charging; then
battery_pct
else
echo "External Power"
@ -88,45 +84,46 @@ elif [[ "$OSTYPE" = freebsd* ]] ; then
}
function battery_time_remaining() {
local remaining_time
remaining_time=$(sysctl -n hw.acpi.battery.time)
if [[ $remaining_time -ge 0 ]] ; then
# calculation from https://www.unix.com/shell-programming-and-scripting/23695-convert-minutes-hours-minutes-seconds.html
((hour=$remaining_time/60))
((minute=$remaining_time-$hour*60))
echo $hour:$minute
if [[ $remaining_time -ge 0 ]]; then
((hour = $remaining_time / 60 ))
((minute = $remaining_time % 60 ))
printf %02d:%02d $hour $minute
fi
}
function battery_pct_prompt() {
b=$(battery_pct_remaining)
if [ ! $(battery_is_charging) ] ; then
if [ $b -gt 50 ] ; then
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 [ $b -gt 20 ] ; then
elif [[ $battery_pct -gt 20 ]]; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
else
echo "∞"
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
fi
}
elif [[ "$OSTYPE" = linux* ]] ; then
elif [[ "$OSTYPE" = linux* ]]; then
function battery_is_charging() {
! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging'
}
function battery_pct() {
if (( $+commands[acpi] )) ; then
echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
if (( $+commands[acpi] )); then
acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]'
fi
}
function battery_pct_remaining() {
if [ ! $(battery_is_charging) ] ; then
if ! battery_is_charging; then
battery_pct
else
echo "External Power"
@ -134,76 +131,81 @@ elif [[ "$OSTYPE" = linux* ]] ; then
}
function battery_time_remaining() {
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
echo $(acpi 2>/dev/null | cut -f3 -d ',')
if ! battery_is_charging; then
acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ','
fi
}
function battery_pct_prompt() {
b=$(battery_pct_remaining)
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
if [ $b -gt 50 ] ; then
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 [ $b -gt 20 ] ; then
elif [[ $battery_pct -gt 20 ]]; then
color='yellow'
else
color='red'
fi
echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
else
echo "∞"
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
fi
}
else
# Empty functions so we don't cause errors in prompts
function battery_pct_remaining() {
}
function battery_time_remaining() {
}
function battery_pct_prompt() {
}
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:-6};
local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-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 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 battery_remaining_percentage=$(battery_pct);
local battery_remaining_percentage=$(battery_pct)
local filled empty gauge_color
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
local empty=$(($gauge_slots - $filled));
filled=$(( ($battery_remaining_percentage * $gauge_slots) / 100 ))
empty=$(( $gauge_slots - $filled ))
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
else local gauge_color=$color_red;
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
local filled=$gauge_slots;
local empty=0;
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
filled=$gauge_slots
empty=0
filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}
fi
local charging=' ' && battery_is_charging && charging=$charging_symbol;
local charging=' '
battery_is_charging && charging=$charging_symbol
printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
# 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}
printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
# Suffix
print -n ${color_reset}${battery_suffix}${color_reset}
}

5
plugins/bazel/README.md Normal file
View 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
plugins/bazel/_bazel Normal file
View 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
}

View file

@ -4,7 +4,7 @@ This plugin adds completion for [Bower](https://bower.io/) and a few useful alia
To use it, add `bower` to the plugins array in your zshrc file:
```
```zsh
plugins=(... bower)
```
@ -15,4 +15,3 @@ plugins=(... bower)
| 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. |

View file

@ -3,19 +3,27 @@
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 formulae, preventing them from being upgraded when issuing the brew upgrade <formulae> command. |
| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. |
| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. |
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. |
| 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 and all formulae, then list outdated formulae. |
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae, then run cleanup. |
| `bubu` | `bubo && bubc` | Do the last two operations above. |
| `bcubo` | `brew update && brew cask outdated` | Update Homebrew and alll formulae, then list outdated casks. |
| `bcubc` | `brew cask reinstall $(brew cask outdated) && 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.

View file

@ -6,19 +6,3 @@ alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
alias bcubo='brew update && brew cask outdated'
alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
print -P '%F{yellow}'Oh My Zsh brew plugin:
cat <<-'EOF'
With the advent of their 1.0 release, Homebrew has 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.
You will only see this message once.
EOF
print -P '%f'
fi

View file

@ -1,7 +1,9 @@
# Bundler
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- Adds completion for basic bundler commands
- Adds short aliases for common bundler commands
- `ba` aliased to `bundle add`
- `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list`
@ -10,9 +12,12 @@
- `bout` aliased to `bundle outdated`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
- `bcn` aliased to `bundle clean`
- `bck` aliased to `bundle check`
- Adds a wrapper for common gems:
- Looks for a binstub under `./bin/` and executes it (if present)
- Calls `bundle exec <gem executable>` 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`.
@ -24,25 +29,29 @@ Please use the exact name of the executable and not the gem name.
### Add additional gems to be wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...)
```
This will add the wrapper for the `rubocop` gem (i.e. the executable).
### Exclude gems from being wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...)
```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems
These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification.
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`

View file

@ -1,3 +1,4 @@
alias ba="bundle add"
alias be="bundle exec"
alias bl="bundle list"
alias bp="bundle package"
@ -6,6 +7,7 @@ alias bout="bundle outdated"
alias bu="bundle update"
alias bi="bundle_install"
alias bcn="bundle clean"
alias bck="bundle check"
bundled_commands=(
annotate

View file

@ -10,6 +10,6 @@ plugins=(... cake)
## Note
This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
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.

View file

@ -2,28 +2,16 @@
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)
## Enabling the plugin
1. Open your `.zshrc` file and add `catimg` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
catimg
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Functions
| Function | Description |

View file

@ -1,6 +1,6 @@
# chucknorris
Chuck Norris fortunes plugin for oh-my-zsh
Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD.
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
@ -10,11 +10,31 @@ To use it add `chucknorris` to the plugins array in you zshrc file.
plugins=(... chucknorris)
```
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
## 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, ...

File diff suppressed because it is too large Load diff

View file

@ -4,8 +4,8 @@
To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file:
```
plugins=(... dash)
```zsh
plugins=(... cloudapp)
```
## Requirements

View 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)
```

View file

@ -1,4 +1,4 @@
## Coffeescript Plugin
# Coffeescript Plugin
This plugin provides aliases for quickly compiling and previewing your
coffeescript code.

View file

@ -8,6 +8,9 @@ To use it, add `colored-man-pages` to the plugins array in your zshrc file:
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

View file

@ -17,7 +17,7 @@ EOF
fi
function colored() {
env \
command env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
@ -31,6 +31,9 @@ function colored() {
"$@"
}
function man() {
colored man "$@"
# Colorize man and dman/debman (from debian-goodies)
function man \
dman \
debman {
colored $0 "$@"
}

View file

@ -6,30 +6,43 @@ Colorize will highlight the content based on the filename extension. If it can't
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.
To use it, add colorize to the plugins array of your zshrc file:
## Setup
To use it, add colorize to the plugins array of your `~/.zshrc` file:
```
plugins=(... colorize)
```
## Styles
## 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"`
```
ZSH_COLORIZE_STYLE="colorful"
```
## Usage
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
If no arguments are passed it will colorize the standard input or stdin.
* `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 <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
open less. If no arguments are passed it will colorize the standard input or stdin.
Note that `cless` will behave as less when provided more than one file: you have to navigate files with
the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
In the latter form, the file contents will be concatenated and presented by less as a single file.
## Requirements
You have to install Pygments first: [pygments.org](http://pygments.org/download/)
* `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.

View file

@ -1,57 +1,113 @@
# easier alias to use the plugin
alias ccat='colorize_via_pygmentize'
alias cless='colorize_via_pygmentize_less'
# Easier alias to use the plugin
alias ccat="colorize_cat"
alias cless="colorize_less"
colorize_via_pygmentize() {
if ! (( $+commands[pygmentize] )); then
echo "package 'Pygments' is not installed!"
# '$0:A' gets the absolute path of this file
ZSH_COLORIZE_PLUGIN_PATH=$0:A
colorize_check_requirements() {
local 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 varianle ZSH_COLORIZE_STYLE
# If the environment variable ZSH_COLORIZE_STYLE
# is set, use that theme instead. Otherwise,
# use the default.
if [ -z $ZSH_COLORIZE_STYLE ]; then
ZSH_COLORIZE_STYLE="default"
if [ -z "$ZSH_COLORIZE_STYLE" ]; then
# Both pygmentize & chroma support 'emacs'
ZSH_COLORIZE_STYLE="emacs"
fi
# pygmentize stdin if no arguments passed
# Use stdin if no arguments have been passed.
if [ $# -eq 0 ]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else
chroma --style="$ZSH_COLORIZE_STYLE"
fi
return $?
fi
# guess lexer from file extension, or
# guess it from file contents if unsuccessful
# Guess lexer from file extension, or guess it from file contents if unsuccessful.
local FNAME lexer
for FNAME in "$@"
do
lexer=$(pygmentize -N "$FNAME")
if [[ $lexer != text ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
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
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
fi
done
}
colorize_via_pygmentize_less() (
# this function is a subshell so tmp_files can be shared to cleanup function
declare -a tmp_files
# 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
cleanup () {
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
exit
_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" less "$@"
}
trap 'cleanup' EXIT HUP TERM INT
while (( $# != 0 )); do #TODO: filter out less opts
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
tmp_files+=("$tmp_file")
colorize_via_pygmentize "$1" > "$tmp_file"
shift 1
done
less -f "${tmp_files[@]}"
)
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
}

View file

@ -26,10 +26,8 @@ fi
# OSX command-not-found support
# https://github.com/Homebrew/homebrew-command-not-found
if type brew &> /dev/null; then
if brew command command-not-found-init > /dev/null 2>&1; then
eval "$(brew command-not-found-init)";
fi
if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
fi
# NixOS command-not-found support

View file

@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt'
alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file
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} '
@ -50,6 +50,7 @@ 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

View file

@ -3,6 +3,7 @@
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)
```

View file

@ -12,18 +12,20 @@ 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 --optimize-autoloader | 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 |
| 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 |

View file

@ -15,20 +15,16 @@ _composer_get_required_list () {
}
_composer () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->command'\
'*: :->args'
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'*:: :->subcmds'
case $state in
command)
compadd $(_composer_get_command_list)
;;
*)
compadd $(_composer_get_required_list)
;;
esac
if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
compadd $(_composer_get_command_list)
else
compadd $(_composer_get_required_list)
fi
}
compdef _composer composer
@ -43,17 +39,29 @@ alias crm='composer remove'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
alias cdo='composer dump-autoload --optimize-autoloader'
alias cdo='composer dump-autoload -o'
alias cgu='composer global update'
alias cgr='composer global require'
alias cgrm='composer global remove'
alias co='composer outdated'
alias cod='composer outdated --direct'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH, using Composer if available.
if (( $+commands[composer] )); then
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
_retrieve_cache composer
if [[ -z $__composer_bin_dir ]]; then
__composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
_store_cache composer __composer_bin_dir
fi
# Add Composer's global binaries to PATH
export PATH="$PATH:$__composer_bin_dir"
unset __composer_bin_dir
else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin

View file

@ -1,9 +1,9 @@
# copy the active line from the command line buffer
# onto the system clipboard (requires clipcopy plugin)
# onto the system clipboard
copybuffer () {
if which clipcopy &>/dev/null; then
echo $BUFFER | clipcopy
printf "%s" "$BUFFER" | clipcopy
else
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
fi

View file

@ -3,7 +3,8 @@
Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array:
```
```zsh
plugins=(... copyfile)
```

View file

@ -1,9 +1,9 @@
# Cpanm
This plugin provides completion for [Cpanm](https://github.com/miyagawa/cpanminus) ([docs](https://metacpan.org/pod/App::cpanminus)).
To use it add cpanm to the plugins array in your zshrc file.
```bash
```zsh
plugins=(... cpanm)
```

View file

@ -15,10 +15,10 @@ This plugin enables directory navigation similar to using back and forward on br
)
```
2. Reload the source file or restart your Terminal session:
2. Restart the shell or restart your Terminal session:
```console
$ source ~/.zshrc
$ exec zsh
$
```

15
plugins/direnv/README.md Normal file
View file

@ -0,0 +1,15 @@
# direnv plugin
This plugin creates the [Direnv](https://direnv.net/) hook.
To use it, add `direnv` to the plugins array in your zshrc file:
```zsh
plugins=(... direnv)
```
## Requirements
In order to make this work, you will need to have the direnv installed.
More info on the usage and install: https://github.com/direnv/direnv

View file

@ -0,0 +1,16 @@
# Don't continue if direnv is not found
command -v direnv &>/dev/null || return
_direnv_hook() {
trap -- '' SIGINT;
eval "$(direnv export zsh)";
trap - SIGINT;
}
typeset -ag precmd_functions;
if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
fi
typeset -ag chpwd_functions;
if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
fi

View file

@ -7,6 +7,7 @@ To use it, add `dirhistory` to the plugins array in your zshrc file:
```zsh
plugins=(... dirhistory)
```
## Keyboard Shortcuts
| Shortcut | Description |
@ -15,3 +16,24 @@ plugins=(... dirhistory)
| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
## Usage
This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
For example, if the shell was started, and the following commands were entered:
```shell
cd ~
cd /usr
cd share
cd doc
```
Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.

View file

@ -53,7 +53,8 @@ function push_future() {
}
# Called by zsh when directory changes
chpwd_functions+=(chpwd_dirhistory)
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_dirhistory
function chpwd_dirhistory() {
push_past $PWD
# If DIRHISTORY_CD is not set...

View file

@ -1,6 +1,7 @@
# Dirpersist plugin
This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file.
When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file:

View file

@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
chpwd_functions+=(chpwd_dirpersist)
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_dirpersist
chpwd_dirpersist() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack

View file

@ -34,23 +34,3 @@ runfcgi -- run this project as a fastcgi
runserver -- start a lightweight web server for development
...
```
If you want to see the options available for a specific command, try:
```zsh
$> python manage.py makemessages (press <TAB> here)
```
And that would result in:
```zsh
--all -a -- re-examine all code and templates
--domain -d -- domain of the message files (default: "django")
--extensions -e -- file extension(s) to examine (default: ".html")
--help -- display help information
--locale -l -- locale to process (default: all)
--pythonpath -- directory to add to the Python path
--settings -- python path to settings module
...
```

View file

@ -374,7 +374,8 @@ _managepy-commands() {
_applist() {
local line
local -a apps
_call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
_call_program help-command "python -c \"import sys; del sys.path[0];\\
import os.path as op, re, django.conf;\\
bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\

View file

@ -1,10 +1,14 @@
## Description
# dnf plugin
This plugin makes `dnf` usage easier by adding aliases for the most
common commands.
This plugin makes `dnf` usage easier by adding aliases for the most common commands.
`dnf` is the new package manager for RPM-based distributions, which
replaces `yum`.
`dnf` is the new package manager for RPM-based distributions, which replaces `yum`.
To use it, add `dnf` to the plugins array in your zshrc file:
```zsh
plugins=(... dnf)
```
## Aliases

View file

@ -4,7 +4,8 @@ This plugin provides completion for [docker-compose](https://docs.docker.com/com
aliases for frequent docker-compose commands.
To use it, add docker-compose to the plugins array of your zshrc file:
```
```zsh
plugins=(... docker-compose)
```

View file

@ -3,6 +3,7 @@
This plugin adds auto-completion for [docker](https://www.docker.com/).
To use it add `docker` to the plugins array in your zshrc file.
```zsh
plugins=(... docker)
```

View file

@ -9,6 +9,7 @@
# - Felix Riedel
# - Steve Durrheimer
# - Vincent Bernat
# - Rohan Verma
#
# license:
#
@ -604,6 +605,7 @@ __docker_container_subcommand() {
"($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: "
"($help)*--cap-add=[Add Linux capabilities]:capability: "
"($help)*--cap-drop=[Drop Linux capabilities]:capability: "
"($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: "
"($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: "
"($help)--cidfile=[Write the container ID to the file]:CID file:_files"
"($help)--cpus=[Number of CPUs (default 0.000)]:cpus: "
@ -676,6 +678,7 @@ __docker_container_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-reservation=[Memory soft limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
"($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
)
opts_help=("(: -)--help[Print usage]")
@ -801,7 +804,7 @@ __docker_container_subcommand() {
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \
"($help -s --size)"{-s,--size}"[Display total file sizes]" \
"($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0
;;
@ -832,7 +835,7 @@ __docker_container_subcommand() {
_arguments $(__docker_arguments) \
$opts_help \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_complete_containers_ids" && ret=0
"($help -)*:containers:__docker_complete_containers" && ret=0
;;
(rm)
local state
@ -1024,7 +1027,7 @@ __docker_image_subcommand() {
$opts_help \
"($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -)*: :__docker_complete_images" && ret=0
;;
(import)
@ -1056,7 +1059,7 @@ __docker_image_subcommand() {
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
"($help)--format=[Pretty-print images using a Go template]:template: " \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
"($help -): :__docker_complete_repositories" && ret=0
;;
(prune)
@ -1076,6 +1079,7 @@ __docker_image_subcommand() {
(push)
_arguments $(__docker_arguments) \
$opts_help \
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
"($help)--disable-content-trust[Skip image signing]" \
"($help -): :__docker_complete_images" && ret=0
;;
@ -1286,7 +1290,7 @@ __docker_network_subcommand() {
"($help)--no-trunc[Do not truncate the output]" \
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
"($help)--format=[Pretty-print networks using a Go template]:template: " \
"($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0
"($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
;;
(prune)
_arguments $(__docker_arguments) \
@ -2214,7 +2218,6 @@ __docker_stack_subcommand() {
(deploy|up)
_arguments $(__docker_arguments) \
$opts_help \
"($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
"($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \
"($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
"($help -):stack:__docker_complete_stacks" && ret=0
@ -2668,6 +2671,7 @@ __docker_subcommand() {
"($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \
"($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \
"($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \
"($help)--max-download-attempts[Set the max download attempts for each pull]" \
"($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
@ -2783,7 +2787,7 @@ __docker_subcommand() {
$opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \
"($help -u --user)"{-u=,--user=}"[Username]:username: " \
"($help -u --username)"{-u=,--username=}"[Username]:username: " \
"($help -)1:server: " && ret=0
;;
(logout)

View file

@ -4,9 +4,7 @@ Automatically load your project ENV variables from `.env` file when you `cd` int
Storing configuration in the environment is one of the tenets of a [twelve-factor app](https://www.12factor.net). Anything that is likely to change between deployment environments, such as resource handles for databases or credentials for external services, should be extracted from the code into environment variables.
## Installation
Just add the plugin to your `.zshrc`:
To use it, add `dotenv` to the plugins array in your zshrc file:
```sh
plugins=(... dotenv)
@ -17,32 +15,63 @@ plugins=(... dotenv)
Create `.env` file inside your project root directory and put your ENV variables there.
For example:
```sh
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
export MONGO_URI=mongodb://127.0.0.1:27017
export PORT=3001
```
`export` is optional. This format works as well:
```sh
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001
```
You can even mix both formats, although it's probably a bad idea.
## Settings
### ZSH_DOTENV_FILE
You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
If the variable isn't set, the plugin will default to use `.env`.
For example, this will make the plugin look for files named `.dotenv` and load them:
```
```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_FILE=.dotenv
```
### ZSH_DOTENV_PROMPT
Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
You can also choose the `Always` option when prompted to always allow sourcing the .env file
in that directory. See the next section for more details.
### ZSH_DOTENV_ALLOWED_LIST
The default behavior of the plugin is to always ask whether to source a dotenv file. There's
a **Y**es, **N**o, and **A**lways option. If you choose Always, the directory of the .env file
will be added to an allowed list. If a directory is found in this list, the plugin won't ask
for confirmation and will instead source the .env file directly.
This allowed list is saved by default in `$ZSH_CACHE_DIR/dotenv-allowed.list`. If you want
to change that location, change the `$ZSH_DOTENV_ALLOWED_LIST` variable, like so:
```zsh
# in ~/.zshrc, before Oh My Zsh is sourced:
ZSH_DOTENV_ALLOWED_LIST=/path/to/dotenv/allowed/list
```
This file is just a list of directories allowed, separated by a newline character. If you want
to disallow a directory, just edit this file and remove the line for the directory you want to
disallow.
## Version Control
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
@ -52,5 +81,6 @@ ZSH_DOTENV_FILE=.dotenv
This plugin only sources the `.env` file. Nothing less, nothing more. It doesn't do any checks. It's designed to be the fastest and simplest option. You're responsible for the `.env` file content. You can put some code (or weird symbols) there, but do it on your own risk. `dotenv` is the basic tool, yet it does the job.
If you need more advanced and feature-rich ENV management, check out these awesome projects:
* [direnv](https://github.com/direnv/direnv)
* [zsh-autoenv](https://github.com/Tarrasch/zsh-autoenv)

View file

@ -1,23 +1,46 @@
## Settings
# Filename of the dotenv file to look for
: ${ZSH_DOTENV_FILE:=.env}
# Path to the file containing allowed paths
: ${ZSH_DOTENV_ALLOWED_LIST:="${ZSH_CACHE_DIR:-$ZSH/cache}/dotenv-allowed.list"}
## Functions
source_env() {
if [[ -f $ZSH_DOTENV_FILE ]]; then
if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then
local confirmation dirpath="${PWD:A}"
# make sure there is an allowed file
touch "$ZSH_DOTENV_ALLOWED_LIST"
# check if current directory's .env file is allowed or ask for confirmation
if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
# print same-line prompt and output newline character if necessary
echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways) "
read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
# check input
case "$confirmation" in
[nN]) return ;;
[aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;;
*) ;; # interpret anything else as a yes
esac
fi
fi
# test .env syntax
zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2
if [[ -o a ]]; then
source $ZSH_DOTENV_FILE
else
set -a
source $ZSH_DOTENV_FILE
set +a
fi
setopt localoptions allexport
source $ZSH_DOTENV_FILE
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd source_env
if [[ -z $ZSH_DOTENV_FILE ]]; then
ZSH_DOTENV_FILE=.env
fi
source_env

23
plugins/dotnet/README.md Normal file
View file

@ -0,0 +1,23 @@
# .NET Core CLI plugin
This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/).
To use it, add `dotnet` to the plugins array in your zshrc file.
```
plugins=(... dotnet)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|-------------------------------------------------------------------|
| dn | dotnet new | Create a new .NET project or file. |
| dr | dotnet run | Build and run a .NET project output. |
| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
| dw | dotnet watch | Watch for source file changes and restart the dotnet command. |
| dwr | dotnet watch run | Watch for source file changes and restart the `run` command. |
| ds | dotnet sln | Modify Visual Studio solution files. |
| da | dotnet add | Add a package or reference to a .NET project. |
| dp | dotnet pack | Create a NuGet package. |
| dng | dotnet nuget | Provides additional NuGet commands. |

View file

@ -0,0 +1,32 @@
# This scripts is copied from (MIT License):
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
_dotnet_zsh_complete()
{
local completions=("$(dotnet complete "$words")")
# If the completion list is empty, just continue with filename selection
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
# This is not a variable assigment, don't remove spaces!
_values = "${(ps:\n:)completions}"
}
compdef _dotnet_zsh_complete dotnet
# Aliases bellow are here for backwards compatibility
# added by Shaun Tabone (https://github.com/xontab)
alias dn='dotnet new'
alias dr='dotnet run'
alias dt='dotnet test'
alias dw='dotnet watch'
alias dwr='dotnet watch run'
alias ds='dotnet sln'
alias da='dotnet add'
alias dp='dotnet pack'
alias dng='dotnet nuget'

View file

@ -20,7 +20,8 @@ _emacsfun()
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
if [ "$#" -ge "2" -a "$2" = "-" ]
then
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
|| mktemp -t emacs-stdin-$USER)" # support BSD mktemp
cat - > "$tempfile"
_emacsfun --no-wait $tempfile
else

View file

@ -2,7 +2,7 @@
# FILE: emoji-clock.plugin.zsh
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
# https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# -----------------------------------------------------------------------------

View file

@ -8,7 +8,7 @@ To use it, add emotty to the plugins array in your zshrc file:
plugins=(... emotty)
```
**NOTE:** it requires the [emoji plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/emoji).
**NOTE:** it requires the [emoji plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/emoji).
## Usage

View file

@ -1,6 +1,12 @@
# encode64
Alias plugin for encoding or decoding using `base64` command
Alias plugin for encoding or decoding using `base64` command.
To use it, add `encode64` to the plugins array in your zshrc file:
```zsh
plugins=(... encode64)
```
## Functions and Aliases
@ -9,23 +15,6 @@ Alias plugin for encoding or decoding using `base64` command
| `encode64` | `e64` | Encodes given data to base64 |
| `decode64` | `d64` | Decodes given data from base64 |
## Enabling plugin
1. Edit your `.zshrc` file and add `encode64` to the list of plugins:
```sh
plugins=(
# ...other enabled plugins
encode64
)
```
2. Restart your terminal session or reload configuration by running:
```sh
source ~/.zshrc
```
## Usage and examples
### Encoding

View file

@ -25,23 +25,32 @@ plugins=(... extract)
| `gz` | Gzip file |
| `ipsw` | iOS firmware file |
| `jar` | Java Archive |
| `lrz` | LRZ archive |
| `lz4` | LZ4 archive |
| `lzma` | LZMA archive |
| `rar` | WinRAR archive |
| `rpm` | RPM package |
| `sublime-package` | Sublime Text package |
| `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression |
| `tar.lrz` | Tarball with lrzip compression |
| `tar.lz` | Tarball with lzip compression |
| `tar.lz4` | Tarball with lz4 compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
| `tlz` | Tarball with lzma compression |
| `txz` | Tarball with lzma2 compression |
| `tzst` | Tarball with zstd compression |
| `war` | Web Application archive (Java-based) |
| `xpi` | Mozilla XPI module file |
| `xz` | LZMA2 archive |
| `zip` | Zip archive |
| `zst` | Zstandard file (zstd) |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
more information regarding archive formats.

View file

@ -3,5 +3,5 @@
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0

View file

@ -40,14 +40,24 @@ extract() {
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar.zst|*.tzst)
tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$1" \
|| zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
(*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
(*.lz4) lz4 -d "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
@ -58,6 +68,7 @@ extract() {
cd ..; rm *.tar.* debian-binary
cd ..
;;
(*.zst) unzstd "$1" ;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1

View file

@ -4,6 +4,6 @@ This plugin provides completion for [Fabric](https://www.fabfile.org/).
To use it add fabric to the plugins array in your zshrc file.
```bash
```zsh
plugins=(... fabric)
```

View file

@ -4,10 +4,19 @@
local curcontext=$curcontext state line
declare -A opt_args
declare target_list
target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
declare -a target_list
target_list=("${(@f)$(fab -l 2>/dev/null | awk '{
if (NF == 0 || NR == 1) next
if (NF < 2) print $1
else {
docstring=substr($0, index($0,$2))
gsub(":", "\\:", docstring)
print $1":"docstring
}
}')}")
_targets() {
_fab_targets() {
[[ -n "$target_list" ]] || return
_describe -t commands "fabric targets" target_list
}
@ -28,7 +37,7 @@ _arguments -w -S -C \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_fab_targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
@ -53,7 +62,7 @@ if [[ CURRENT -ge 1 ]]; then
levels)
_describe -t commands "output levels" output_levels;;
*)
_targets;;
_fab_targets;;
esac
return

View file

@ -1,10 +1,10 @@
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
zle accept-line -w
else
zle push-input
zle clear-screen
zle push-input -w
zle clear-screen -w
fi
}
zle -N fancy-ctrl-z

21
plugins/fasd/README.md Normal file
View file

@ -0,0 +1,21 @@
# fasd
[`Fasd`](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. Fasd offers quick access to files and directories for POSIX shells.
To use it, add `fasd` to the plugins array in your zshrc file:
```zsh
plugins=(... fasd)
```
## Installation
Please find detailed installation guide [`here`](https://github.com/clvv/fasd#install)
## Aliases
| Alias | Command | Description |
|-------|-------------------------------------------|-------------------------------------------------------------|
| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
| j | `fasd_cd -d -i` | cd with interactive selection |

View file

@ -1,12 +1,16 @@
if [ $commands[fasd] ]; then # check if fasd is installed
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init auto >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
alias v='f -e "$EDITOR"'
alias o='a -e xdg-open'
alias j='zz'
# check if fasd is installed
if (( ! ${+commands[fasd]} )); then
return
fi
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [[ "$commands[fasd]" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
alias v='f -e "$EDITOR"'
alias o='a -e xdg-open'
alias j='zz'

View file

@ -0,0 +1,84 @@
# Fastfile plugin
This plugin adds a way to reference certain files or folders used frequently using
a global alias or shortcut.
To use it, add `fastfile` to the plugins array in your zshrc file:
```zsh
plugins=(... fastfile)
```
## Usage
Example: you access folder `/code/project/backend/database` very frequently.
First, generate a shortcut with the name `pjdb`:
```zsh
$ fastfile pjdb /code/project/backend/database
```
Next time you want to access it, use `§pjdb`. For example:
```zsh
$ cd §pjdb
$ subl §pjdb
```
where § is the fastfile prefix (see [below](#options) for how to change).
**Note:** shortcuts with spaces in the name are assigned a global alias
where the spaces have been substituted with underscores (`_`). For example:
a shortcut named `"hello world"` corresponds with `§hello_world`.
## Functions
- `fastfile <shortcut_name> <path/to/file/or/folder>`: generate a shortcut.
- `fastfile_print <shortcut_name>`: prints a shortcut, with the format
`<prefix><shortcut_name> -> <shortcut_path>`.
- `fastfile_ls`: lists all shortcuts.
- `fastfile_rm <shortcut_name> `: remove a shortcut.
- `fastfile_sync`: generates the global aliases for the shortcuts.
### Internal functions
- `fastfile_resolv <shortcut_name>`: resolves the location of the shortcut
file, i.e., the file in the fastfile directory where the shortcut path
is stored.
- `fastfile_get <shortcut_name>`: get the real path of the shortcut.
## Aliases
| Alias | Function |
|--------|------------------|
| ff | `fastfile` |
| ffp | `fastfile_print` |
| ffrm | `fastfile_rm` |
| ffls | `fastfile_ls` |
| ffsync | `fastfile_sync` |
## Options
These are options you can set to change certain parts of the plugin. To change
them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
For example: `fastfile_var_prefix='@'`.
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
created global aliases.
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
or using `⌥ Option`+`6` in macOS.
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
with a trailing slash.
**Default:** `$HOME/.fastfile/`.
## Author
- [Karolin Varner](https://github.com/koraa)

View file

@ -1,21 +1,11 @@
################################################################################
# FILE: fastfile.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Michael Varner (musikmichael@web.de)
# VERSION: 1.0.0
#
# This plugin adds the ability to on the fly generate and access file shortcuts.
#
################################################################################
###########################
# Settings
# Settings
# These can be overwritten any time.
# If they are not set yet, they will be
# overwritten with their default values
default fastfile_dir "${HOME}/.fastfile/"
default fastfile_dir "${HOME}/.fastfile"
default fastfile_var_prefix "§"
###########################
@ -33,7 +23,7 @@ default fastfile_var_prefix "§"
function fastfile() {
test "$2" || 2="."
file=$(readlink -f "$2")
test "$1" || 1="$(basename "$file")"
name=$(echo "$1" | tr " " "_")
@ -51,7 +41,7 @@ function fastfile() {
# Arguments:
# 1. name - The name of the shortcut
# STDOUT:
# The path
# The path to the shortcut file
#
function fastfile_resolv() {
echo "${fastfile_dir}${1}"
@ -88,12 +78,12 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut
#
function fastfile_ls() {
for f in "${fastfile_dir}"/*; do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
# Special format for colums
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
# Special format for colums
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
done | column -t -s "|"
}
@ -102,7 +92,6 @@ function fastfile_ls() {
#
# Arguments:
# 1. name - The name of the shortcut (default: name of the file)
# 2. file - The file or directory to make the shortcut for
# STDOUT:
# => fastfle_print
#
@ -115,11 +104,11 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
for f in "${fastfile_dir}"/*; do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
done
}
@ -133,6 +122,6 @@ alias ffls=fastfile_ls
alias ffsync=fastfile_sync
##################################
# Init
# Init
fastfile_sync
fastfile_sync

View file

@ -3,7 +3,8 @@
This plugin automatically starts [fbterm](https://github.com/zhangyuanwei/fbterm)
if on a real TTY (`/dev/tty*`).
To use it, add fbterm to the plugins array of your zshrc file:
```
To use it, add `fbterm` to the plugins array of your zshrc file:
```zsh
plugins=(... fbterm)
```

View file

@ -1 +1 @@
The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/dnf) instead.
The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead.

View file

@ -1 +0,0 @@
../dnf/dnf.plugin.zsh

View file

@ -0,0 +1,3 @@
print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f"
source "$ZSH/plugins/dnf/dnf.plugin.zsh"

View file

@ -1,15 +1,23 @@
## forklift
# forklift
Plugin for ForkLift, an FTP application for OS X.
### Requirements
To use it, add `forklift` to the plugins array in your zshrc file:
```zsh
plugins=(... forklift)
```
## Requirements
* [ForkLift](https://binarynights.com/)
### Usage
## Usage
<code>fl [*file_or_folder*]</code>
`fl [<file_or_folder>]`
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift
* If `fl` is called with a non-directory file as the argument, then the file's parent directory is opened.

View file

@ -1,6 +1,7 @@
# Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# Updated to support ForkLift from Setapp by Paul Rudkin
#
# Usage:
# fl [<folder>]
@ -24,6 +25,13 @@ function fl {
fi
osascript 2>&1 1>/dev/null <<END
try
tell application "Finder"
set forkLiftSetapp to name of application file id "com.binarynights.forklift-setapp"
end tell
on error err_msg number err_num
set forkLiftSetapp to null
end try
try
tell application "Finder"
set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
@ -46,7 +54,12 @@ function fl {
set forkLift to null
end try
if forkLift3 is not null and application forkLift3 is running then
if forkLiftSetapp is not null and application forkLiftSetapp is running then
tell application forkLiftSetapp
activate
set forkLiftVersion to version
end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3
activate
set forkLiftVersion to version
@ -62,7 +75,9 @@ function fl {
set forkLiftVersion to version
end tell
else
if forkLift3 is not null then
if forkLiftSetapp is not null then
set appName to forkLiftSetapp
else if forkLift3 is not null then
set appName to forkLift3
else if forkLift2 is not null then
set appName to forkLift2

View file

@ -52,6 +52,7 @@ Available search contexts are:
| mdn | `https://developer.mozilla.org/search?q=` |
| nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` |
| npmjs | `https://www.npmjs.com/search?q=` |
| packagephobia | `https://packagephobia.now.sh/result?p=` |
| qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |

Some files were not shown because too many files have changed in this diff Show more