| @ -0,0 +1,10 @@ | |||
| root = true | |||
| [*] | |||
| end_of_line = lf | |||
| insert_final_newline = true | |||
| charset = utf-8 | |||
| [*.sh] | |||
| indent_size = 4 | |||
| indent_style = tab | |||
| @ -0,0 +1,3 @@ | |||
| # Plugin owners | |||
| plugins/gitfast/ @felipec | |||
| plugins/sdk/ @rgoldberg | |||
| @ -0,0 +1,36 @@ | |||
| --- | |||
| name: Bug report | |||
| about: Create a report to help us improve Oh My Zsh | |||
| labels: 'Type: support' | |||
| --- | |||
| <!-- | |||
| Fill this out before posting. You can delete irrelevant sections, but | |||
| an issue where no sections have been filled will be deleted without comment. | |||
| --> | |||
| **Describe the bug** | |||
| A clear description of what the bug is. | |||
| **To Reproduce** | |||
| 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 brief description of what should happen. | |||
| **Screenshots and/or Recordings** | |||
| If applicable, add screenshots to help explain your problem. | |||
| You can also record an asciinema session: https://asciinema.org/ | |||
| **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. This can be themes, plugins, custom configs. | |||
| @ -0,0 +1,26 @@ | |||
| --- | |||
| name: Feature request | |||
| about: Suggest a feature for Oh My Zsh | |||
| labels: 'Type: feature' | |||
| --- | |||
| <!-- | |||
| Fill this out before posting. You can delete irrelevant sections, but | |||
| 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 that you would like us to improve. [...] | |||
| **Is your feature request related to a problem? Please describe.** | |||
| A description of what the problem is. Ex. I'm always frustrated when [...] | |||
| **Describe the solution you'd like** | |||
| A description of what you want to happen. | |||
| **Describe alternatives 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. Also if you have any PRs related to this issue that are already open that you would like us to look at. | |||
| @ -0,0 +1,10 @@ | |||
| --- | |||
| name: Support | |||
| about: Request support for any problem you're having with Oh My Zsh | |||
| 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 | |||
| @ -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: | |||
| ... | |||
| @ -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 | |||
| @ -1,8 +1,8 @@ | |||
| # custom files | |||
| custom/ | |||
| !custom/plugins/example | |||
| !custom/example.zsh | |||
| # temp files directories | |||
| cache/ | |||
| log/ | |||
| *.swp | |||
| .DS_Store | |||
| @ -0,0 +1,76 @@ | |||
| # Contributor Covenant Code of Conduct | |||
| ## Our Pledge | |||
| In the interest of fostering an open and welcoming environment, we as | |||
| contributors and maintainers pledge to making participation in our project and | |||
| our community a harassment-free experience for everyone, regardless of age, body | |||
| size, disability, ethnicity, sex characteristics, gender identity and expression, | |||
| level of experience, education, socio-economic status, nationality, personal | |||
| appearance, race, religion, or sexual identity and orientation. | |||
| ## Our Standards | |||
| Examples of behavior that contributes to creating a positive environment | |||
| include: | |||
| * Using welcoming and inclusive language | |||
| * Being respectful of differing viewpoints and experiences | |||
| * Gracefully accepting constructive criticism | |||
| * Focusing on what is best for the community | |||
| * Showing empathy towards other community members | |||
| Examples of unacceptable behavior by participants include: | |||
| * The use of sexualized language or imagery and unwelcome sexual attention or | |||
| advances | |||
| * Trolling, insulting/derogatory comments, and personal or political attacks | |||
| * Public or private harassment | |||
| * Publishing others' private information, such as a physical or electronic | |||
| address, without explicit permission | |||
| * Other conduct which could reasonably be considered inappropriate in a | |||
| professional setting | |||
| ## Our Responsibilities | |||
| Project maintainers are responsible for clarifying the standards of acceptable | |||
| behavior and are expected to take appropriate and fair corrective action in | |||
| response to any instances of unacceptable behavior. | |||
| Project maintainers have the right and responsibility to remove, edit, or | |||
| reject comments, commits, code, wiki edits, issues, and other contributions | |||
| that are not aligned to this Code of Conduct, or to ban temporarily or | |||
| permanently any contributor for other behaviors that they deem inappropriate, | |||
| threatening, offensive, or harmful. | |||
| ## Scope | |||
| This Code of Conduct applies within all project spaces, and it also applies when | |||
| an individual is representing the project or its community in public spaces. | |||
| Examples of representing a project or community include using an official | |||
| project e-mail address, posting via an official social media account, or acting | |||
| as an appointed representative at an online or offline event. Representation of | |||
| a project may be further defined and clarified by project maintainers. | |||
| ## Enforcement | |||
| Instances of abusive, harassing, or otherwise unacceptable behavior may be | |||
| reported by contacting the project team at ohmyzsh@planetargon.com. All | |||
| complaints will be reviewed and investigated and will result in a response that | |||
| is deemed necessary and appropriate to the circumstances. The project team is | |||
| obligated to maintain confidentiality with regard to the reporter of an incident. | |||
| Further details of specific enforcement policies may be posted separately. | |||
| Project maintainers who do not follow or enforce the Code of Conduct in good | |||
| faith may face temporary or permanent repercussions as determined by other | |||
| members of the project's leadership. | |||
| ## Attribution | |||
| This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | |||
| available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | |||
| [homepage]: https://www.contributor-covenant.org | |||
| For answers to common questions about this code of conduct, see | |||
| https://www.contributor-covenant.org/faq | |||
| @ -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 | |||
| } | |||
| ) | |||
| } | |||
| @ -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" | |||
| fi | |||
| # Ignore these folders (if the necessary grep flags are available) | |||
| EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}" | |||
| # ignore VCS folders (if the necessary grep flags are available) | |||
| VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}" | |||
| # 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 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 | |||
| 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" | |||
| # export grep settings | |||
| alias grep="grep $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 | |||
| # clean up | |||
| unset GREP_OPTIONS | |||
| unset VCS_FOLDERS | |||
| unfunction grep-flag-available | |||
| unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES | |||
| @ -0,0 +1,46 @@ | |||
| # alias-finder plugin | |||
| This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier. | |||
| To use it, add `alias-finder` to the `plugins` array of your zshrc file: | |||
| ``` | |||
| plugins=(... alias-finder) | |||
| ``` | |||
| ## Usage | |||
| To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this. | |||
| ## Options | |||
| - Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input). | |||
| - Use `--exact` or `-e` to avoid matching aliases that are shorter than the input. | |||
| ## Examples | |||
| ``` | |||
| $ alias-finder "git pull" | |||
| gl='git pull' | |||
| g=git | |||
| ``` | |||
| ``` | |||
| $ alias-finder "web_search google oh my zsh" | |||
| google='web_search google' | |||
| ``` | |||
| ``` | |||
| $ alias-finder "git commit -v" | |||
| gc="git commit -v" | |||
| g=git | |||
| ``` | |||
| ``` | |||
| $ alias-finder -e "git commit -v" | |||
| gc='git commit -v' | |||
| ``` | |||
| ``` | |||
| $ alias-finder -l "git commit -v" | |||
| gc='git commit -v' | |||
| 'gc!'='git commit -v --amend' | |||
| gca='git commit -v -a' | |||
| 'gca!'='git commit -v -a --amend' | |||
| 'gcan!'='git commit -v -a --no-edit --amend' | |||
| 'gcans!'='git commit -v -a -s --no-edit --amend' | |||
| 'gcn!'='git commit -v --no-edit --amend' | |||
| ``` | |||
| @ -0,0 +1,47 @@ | |||
| alias-finder() { | |||
| local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd="" | |||
| for i in $@; do | |||
| case $i in | |||
| -e|--exact) exact=true;; | |||
| -l|--longer) longer=true;; | |||
| *) | |||
| if [[ -z $cmd ]]; then | |||
| cmd=$i | |||
| else | |||
| cmd="$cmd $i" | |||
| fi | |||
| ;; | |||
| esac | |||
| done | |||
| cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep | |||
| if (( $(wc -l <<< $cmd) == 1 )); then | |||
| while [[ $cmd != "" ]]; do | |||
| if [[ $longer = true ]]; then | |||
| wordStart="'{0,1}" | |||
| else | |||
| wordEnd="$" | |||
| multiWordEnd="'$" | |||
| fi | |||
| if [[ $cmd == *" "* ]]; then | |||
| local finder="'$cmd$multiWordEnd" | |||
| else | |||
| local finder=$wordStart$cmd$wordEnd | |||
| fi | |||
| alias | grep -E "=$finder" | |||
| if [[ $exact = true || $longer = true ]]; then | |||
| break | |||
| else | |||
| cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word | |||
| fi | |||
| done | |||
| fi | |||
| } | |||
| preexec_alias-finder() { | |||
| if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then | |||
| alias-finder $1 | |||
| fi | |||
| } | |||
| autoload -U add-zsh-hook | |||
| add-zsh-hook preexec preexec_alias-finder | |||
| @ -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) | |||
| @ -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] | | |||
| @ -0,0 +1,20 @@ | |||
| # Autoenv plugin | |||
| This plugin loads the [Autoenv](https://github.com/inishchith/autoenv). | |||
| To use it, add `autoenv` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... autoenv) | |||
| ``` | |||
| ## Functions | |||
| * `use_env()`: creates and/or activates a virtualenv. For use in `.env` files. | |||
| See the source code for details. | |||
| ## Requirements | |||
| In order to make this work, you will need to have the autoenv installed. | |||
| More info on the usage and install at [the project's homepage](https://github.com/inishchith/autoenv). | |||
| @ -1,23 +1,34 @@ | |||
| if [ $commands[autojump] ]; then # check if autojump is installed | |||
| if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation | |||
| . $HOME/.autojump/etc/profile.d/autojump.zsh | |||
| elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation | |||
| . $HOME/.autojump/share/autojump/autojump.zsh | |||
| elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation | |||
| . $HOME/.nix-profile/etc/profile.d/autojump.zsh | |||
| elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation | |||
| . /run/current-system/sw/share/autojump/autojump.zsh | |||
| elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package | |||
| . /usr/share/autojump/autojump.zsh | |||
| elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation | |||
| . /etc/profile.d/autojump.zsh | |||
| elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation | |||
| . /etc/profile.d/autojump.sh | |||
| elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation | |||
| . /usr/local/share/autojump/autojump.zsh | |||
| elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports | |||
| . /opt/local/etc/profile.d/autojump.sh | |||
| elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew | |||
| . `brew --prefix`/etc/autojump.sh | |||
| declare -a autojump_paths | |||
| autojump_paths=( | |||
| $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation | |||
| $HOME/.autojump/share/autojump/autojump.zsh # manual installation | |||
| $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation | |||
| /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation | |||
| /usr/share/autojump/autojump.zsh # Debian and Ubuntu package | |||
| /etc/profile.d/autojump.zsh # manual installation | |||
| /etc/profile.d/autojump.sh # Gentoo installation | |||
| /usr/local/share/autojump/autojump.zsh # FreeBSD installation | |||
| /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts | |||
| /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default) | |||
| ) | |||
| for file in $autojump_paths; do | |||
| if [[ -f "$file" ]]; then | |||
| source "$file" | |||
| found=1 | |||
| break | |||
| fi | |||
| done | |||
| # if no path found, try Homebrew | |||
| if (( ! found && $+commands[brew] )); then | |||
| file=$(brew --prefix)/etc/profile.d/autojump.sh | |||
| if [[ -f "$file" ]]; then | |||
| source "$file" | |||
| found=1 | |||
| fi | |||
| fi | |||
| (( ! found )) && echo '[oh-my-zsh] autojump not found. Please install it first.' | |||
| unset autojump_paths file found | |||
| @ -1,49 +1,106 @@ | |||
| _homebrew-installed() { | |||
| type brew &> /dev/null | |||
| _xit=$? | |||
| if [ $_xit -eq 0 ];then | |||
| # ok , we have brew installed | |||
| # speculatively we check default brew prefix | |||
| if [ -h /usr/local/opt/awscli ];then | |||
| _brew_prefix="/usr/local/opt/awscli" | |||
| else | |||
| # ok , it is not default prefix | |||
| # this call to brew is expensive ( about 400 ms ), so at least let's make it only once | |||
| _brew_prefix=$(brew --prefix awscli) | |||
| fi | |||
| return 0 | |||
| else | |||
| return $_xit | |||
| fi | |||
| } | |||
| _awscli-homebrew-installed() { | |||
| [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null | |||
| } | |||
| function agp { | |||
| function agp() { | |||
| echo $AWS_PROFILE | |||
| } | |||
| function asp { | |||
| local rprompt=${RPROMPT/<aws:$(agp)>/} | |||
| # AWS profile selection | |||
| function asp() { | |||
| if [[ -z "$1" ]]; then | |||
| unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE | |||
| echo AWS profile cleared. | |||
| return | |||
| fi | |||
| local -a available_profiles | |||
| available_profiles=($(aws_profiles)) | |||
| if [[ -z "${available_profiles[(r)$1]}" ]]; then | |||
| echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2 | |||
| echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2 | |||
| return 1 | |||
| fi | |||
| export AWS_DEFAULT_PROFILE=$1 | |||
| export AWS_PROFILE=$1 | |||
| export AWS_EB_PROFILE=$1 | |||
| } | |||
| function aws_change_access_key() { | |||
| if [[ -z "$1" ]]; then | |||
| echo "usage: $0 <profile>" | |||
| return 1 | |||
| fi | |||
| echo Insert the credentials when asked. | |||
| asp "$1" || return 1 | |||
| AWS_PAGER="" aws iam create-access-key | |||
| AWS_PAGER="" aws configure --profile "$1" | |||
| echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\` | |||
| echo Your current keys are: | |||
| AWS_PAGER="" aws iam list-access-keys | |||
| } | |||
| export RPROMPT="<aws:$AWS_PROFILE>$rprompt" | |||
| function aws_profiles() { | |||
| [[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1 | |||
| grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/' | |||
| } | |||
| function aws_profiles { | |||
| reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) | |||
| function _aws_profiles() { | |||
| reply=($(aws_profiles)) | |||
| } | |||
| compctl -K aws_profiles asp | |||
| compctl -K _aws_profiles asp aws_change_access_key | |||
| if which aws_zsh_completer.sh &>/dev/null; then | |||
| _aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null) | |||
| elif _homebrew-installed && _awscli-homebrew-installed; then | |||
| _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh | |||
| # AWS prompt | |||
| function aws_prompt_info() { | |||
| [[ -z $AWS_PROFILE ]] && return | |||
| echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}" | |||
| } | |||
| if [ "$SHOW_AWS_PROMPT" != false ]; then | |||
| RPROMPT='$(aws_prompt_info)'"$RPROMPT" | |||
| fi | |||
| [ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path | |||
| unset _aws_zsh_completer_path | |||
| # Load awscli completions | |||
| # 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) | |||
| fi | |||
| } | |||
| # get aws_zsh_completer.sh location from $PATH | |||
| _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]" | |||
| # otherwise check common locations | |||
| if [[ -z $_aws_zsh_completer_path ]]; then | |||
| # Homebrew | |||
| if _awscli-homebrew-installed; then | |||
| _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh | |||
| # Ubuntu | |||
| elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then | |||
| _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli | |||
| # NixOS | |||
| elif [[ -e "${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" ]]; then | |||
| _aws_zsh_completer_path="${commands[aws]:P:h:h}/share/zsh/site-functions/aws_zsh_completer.sh" | |||
| # RPM | |||
| else | |||
| _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh | |||
| fi | |||
| fi | |||
| [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path | |||
| unset _aws_zsh_completer_path _brew_prefix | |||
| fi | |||
| @ -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. | |||
| @ -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 | |||
| } | |||
| @ -1,9 +0,0 @@ | |||
| # Bwana | |||
| This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/). | |||
| To use it add bwana to the plugins array in your zshrc file. | |||
| ```bash | |||
| plugins=(... bwana) | |||
| ``` | |||
| @ -1,13 +0,0 @@ | |||
| # | |||
| # Requires https://www.bruji.com/bwana/ | |||
| # | |||
| if [[ -e /Applications/Bwana.app ]] || | |||
| ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) | |||
| then | |||
| function man() { | |||
| open "man:$1" | |||
| } | |||
| else | |||
| echo "Bwana lets you read man files in Safari through a man: URI scheme" | |||
| echo "To use it within Zsh, install it from https://www.bruji.com/bwana/" | |||
| fi | |||
| @ -0,0 +1,16 @@ | |||
| # cakephp3 plugin | |||
| The plugin adds aliases and autocompletion for [cakephp3](https://book.cakephp.org/3.0/en/index.html). | |||
| To use it, add `cakephp3` to the plugins array of your zshrc file: | |||
| ``` | |||
| plugins=(... cakephp3) | |||
| ``` | |||
| ## Aliases | |||
| | Alias | Command | | |||
| |-----------|-------------------------------| | |||
| | c3 | `bin/cake` | | |||
| | c3cache | `bin/cake orm_cache clear` | | |||
| | c3migrate | `bin/cake migrations migrate` | | |||
| @ -0,0 +1,20 @@ | |||
| # chruby plugin | |||
| This plugin loads [chruby](https://github.com/postmodern/chruby), a tool that changes the | |||
| current Ruby version, and completion and a prompt function to display the Ruby version. | |||
| Supports brew and manual installation of chruby. | |||
| To use it, add `chruby` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... chruby) | |||
| ``` | |||
| ## Usage | |||
| If you'd prefer to specify an explicit path to load chruby from | |||
| you can set variables like so: | |||
| ``` | |||
| zstyle :omz:plugins:chruby path /local/path/to/chruby.sh | |||
| zstyle :omz:plugins:chruby auto /local/path/to/auto.sh | |||
| ``` | |||
| @ -0,0 +1,26 @@ | |||
| # CloudApp plugin | |||
| ## The CloudApp API is deprecated, so the plugin will be removed shortly | |||
| [CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. | |||
| To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: | |||
| ```zsh | |||
| plugins=(... cloudapp) | |||
| ``` | |||
| ## Requirements | |||
| 1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) | |||
| 2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: | |||
| ``` | |||
| password | |||
| ``` | |||
| ## Usage | |||
| - `cloudapp <filename>`: uploads `<filename>` to your CloudApp account, and if you're using | |||
| macOS, copies the URL to your clipboard. | |||
| @ -1,2 +1,4 @@ | |||
| #!/bin/zsh | |||
| alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb | |||
| print -Pn "%F{yellow}" | |||
| print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will" | |||
| print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list." | |||
| print -Pn "%f" | |||
| @ -1,60 +0,0 @@ | |||
| #!/usr/bin/env ruby | |||
| # | |||
| # cloudapp | |||
| # Zach Holman / @holman | |||
| # | |||
| # Uploads a file from the command line to CloudApp, drops it into your | |||
| # clipboard (on a Mac, at least). | |||
| # | |||
| # Example: | |||
| # | |||
| # cloudapp drunk-blake.png | |||
| # | |||
| # This requires Aaron Russell's cloudapp_api gem: | |||
| # | |||
| # gem install cloudapp_api | |||
| # | |||
| # Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: | |||
| # | |||
| # password | |||
| require 'rubygems' | |||
| begin | |||
| require 'cloudapp_api' | |||
| rescue LoadError | |||
| puts "You need to install cloudapp_api: gem install cloudapp_api" | |||
| exit!(1) | |||
| end | |||
| config_file = "#{ENV['HOME']}/.cloudapp" | |||
| unless File.exist?(config_file) | |||
| puts "You need to type your email and password (one per line) into "+ | |||
| "`~/.cloudapp`" | |||
| exit!(1) | |||
| end | |||
| email,password = File.read(config_file).split("\n") | |||
| class HTTParty::Response | |||
| # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU | |||
| # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT | |||
| def ok? ; true end | |||
| end | |||
| if ARGV[0].nil? | |||
| puts "You need to specify a file to upload." | |||
| exit!(1) | |||
| end | |||
| CloudApp.authenticate(email,password) | |||
| url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url | |||
| # Say it for good measure. | |||
| puts "Uploaded to #{url}." | |||
| # Get the embed link. | |||
| url = "#{url}/#{ARGV[0].split('/').last}" | |||
| # Copy it to your (Mac's) clipboard. | |||
| `echo '#{url}' | tr -d "\n" | pbcopy` | |||
| @ -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) | |||
| ``` | |||
| @ -0,0 +1,48 @@ | |||
| # Colemak plugin | |||
| This plugin remaps keys in `zsh`'s [`vi`-style navigation mode](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps) | |||
| for a [Colemak](https://colemak.com/) keyboard layout, to match the QWERTY position: | |||
|  | |||
| To use it, add it to the plugins array in your `~/.zshrc` file: | |||
| ``` | |||
| plugins=(... colemak) | |||
| ``` | |||
| You will also need to enable `vi` mode, so add another line to `~/.zshrc`: | |||
| ``` | |||
| bindkey -v | |||
| ``` | |||
| Restart your shell and hit the `<ESC>` key to activate `vicmd` (navigation) mode, | |||
| and start navigating `zsh` with your new keybindings! | |||
| ## Key bindings for vicmd | |||
| | Old | New | Binding | Description | | |||
| |------------|------------|---------------------------|----------------------------------------------------| | |||
| | `CTRL`+`j` | `CTRL`+`n` | accept-line | Insert new line | | |||
| | `j` | `n` | down-line-or-history | Move one line down or command history forwards | | |||
| | `k` | `e` | up-line-or-history | Move one line up or command history backwards | | |||
| | `l` | `i` | vi-forward-char | Move one character to the right | | |||
| | `n` | `k` | vi-repeat-search | Repeat command search forwards | | |||
| | `N` | `K` | vi-rev-repeat-search | Repeat command search backwards | | |||
| | `i` | `u` | vi-insert | Enter insert mode | | |||
| | `I` | `U` | vi-insert-bol | Move to first non-blank char and enter insert mode | | |||
| | `<none>` | `l` | vi-undo-change | Undo change | | |||
| | `J` | `N` | vi-join | Join the current line with the next one | | |||
| | `e` | `j` | vi-forward-word-end | Move to the end of the next word | | |||
| | `E` | `J` | vi-forward-blank-word-end | Move to end of the current or next word | | |||
| ## Key bindings for less | |||
| | Keyboard shortcut | `less` key binding | | |||
| |-------------------|--------------------| | |||
| | `n` | forw-line | | |||
| | `e` | back-line | | |||
| | `k` | repeat-search | | |||
| | `ESC`+`k` | repeat-search-all | | |||
| | `K` | reverse-search | | |||
| | `ESC`+`K` | reverse-search-all | | |||
| @ -0,0 +1,18 @@ | |||
| # Colored man pages plugin | |||
| This plugin adds colors to man pages. | |||
| To use it, add `colored-man-pages` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... colored-man-pages) | |||
| ``` | |||
| It will also automatically colorize man pages displayed by `dman` or `debman`, | |||
| from [`debian-goodies`](https://packages.debian.org/stable/debian-goodies). | |||
| You can also try to color other pages by prefixing the respective command with `colored`: | |||
| ```zsh | |||
| colored git help clone | |||
| ``` | |||
| @ -1,28 +1,113 @@ | |||
| # easier alias to use the plugin | |||
| alias ccat='colorize_via_pygmentize' | |||
| # 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 variable ZSH_COLORIZE_STYLE | |||
| # is set, use that theme instead. Otherwise, | |||
| # use the default. | |||
| if [ -z "$ZSH_COLORIZE_STYLE" ]; then | |||
| # Both pygmentize & chroma support 'emacs' | |||
| ZSH_COLORIZE_STYLE="emacs" | |||
| fi | |||
| # pygmentize stdin if no arguments passed | |||
| # Use stdin if no arguments have been passed. | |||
| if [ $# -eq 0 ]; then | |||
| pygmentize -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 -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 -g "$FNAME" | |||
| chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME" | |||
| fi | |||
| done | |||
| } | |||
| # The less option 'F - Forward forever; like "tail -f".' will not work in this implementation | |||
| # caused by the lack of the ability to follow the file within pygmentize. | |||
| colorize_less() { | |||
| if ! colorize_check_requirements; then | |||
| return 1 | |||
| fi | |||
| _cless() { | |||
| # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options. | |||
| local LESS="-R $LESS" | |||
| # This variable tells less to pipe every file through the specified command | |||
| # (see the man page of less INPUT PREPROCESSOR). | |||
| # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like | |||
| # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. | |||
| # Therefore we must source this file to make colorize_cat available in the | |||
| # preprocessor without the interactive mode. | |||
| # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python | |||
| # script pygmentize, which will show up if less has not fully "loaded the file" | |||
| # (e.g. when not scrolled to the bottom) while already the next file will be displayed. | |||
| local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ | |||
| ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ | |||
| colorize_cat %s 2> /dev/null'" | |||
| # LESSCLOSE will be set to prevent any errors by executing a user script | |||
| # which assumes that his LESSOPEN has been executed. | |||
| local LESSCLOSE="" | |||
| LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" less "$@" | |||
| } | |||
| if [ -t 0 ]; then | |||
| _cless "$@" | |||
| else | |||
| # The input is not associated with a terminal, therefore colorize_cat will | |||
| # colorize this input and pass it to less. | |||
| # Less has now to decide what to use. If any files have been provided, less | |||
| # will ignore the input by default, otherwise the colorized input will be used. | |||
| # If files have been supplied and the input has been redirected, this will | |||
| # lead to unnecessary overhead, but retains the ability to use the less options | |||
| # without checking for them inside this script. | |||
| colorize_cat | _cless "$@" | |||
| fi | |||
| } | |||
| @ -0,0 +1,121 @@ | |||
| # Common Aliases Plugin | |||
| This plugin creates helpful shortcut aliases for many commonly used commands. | |||
| To use it add `common-aliases` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... common-aliases) | |||
| ``` | |||
| ## Aliases | |||
| ### ls command | |||
| | Alias | Command | Description | | |||
| |-------|---------------|--------------------------------------------------------------------------------| | |||
| | l | `ls -lFh` | List files as a long list, show size, type, human-readable | | |||
| | la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable | | |||
| | lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable | | |||
| | lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable | | |||
| | ll | `ls -l` | List files as a long list | | |||
| | ldot | `ls -ld .*` | List dot files as a long list | | |||
| | lS | `ls -1FSsh` | List files showing only size and name sorted by size | | |||
| | lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) | | |||
| | lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) | | |||
| ### File handling | |||
| | Alias | Command | Description | | |||
| |-------|-----------------------|------------------------------------------------------------------------------------| | |||
| | rm | `rm -i` | Remove a file | | |||
| | cp | `cp -i` | Copy a file | | |||
| | mv | `mv -i` | Move a file | | |||
| | zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file | | |||
| | dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form | | |||
| | duf | `du -sh` | Display the size of files in current location in human-readable form | | |||
| | t | `tail -f` | Shorthand for tail which outputs the last part of a file | | |||
| ### find and grep | |||
| | Alias | Command | Description | | |||
| |-------|-----------------------------------------------------|-----------------------------------------| | |||
| | fd | `find . -type d -name` | Find a directory with the given name | | |||
| | ff | `find . -type f -name` | Find a file with the given name | | |||
| | grep | `grep --color` | Searches for a query string | | |||
| | sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files | | |||
| ### Other Aliases | |||
| | Alias | Command | Description | | |||
| |-----------|---------------------|-------------------------------------------------------------| | |||
| | h | `history` | Lists all recently used commands | | |||
| | hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands | | |||
| | help | `man` | Opens up the man page for a command | | |||
| | p | `ps -f` | Displays currently executing processes | | |||
| | sortnr | `sort -n -r` | Used to sort the lines of a text file | | |||
| | unexport | `unset` | Used to unset an environment variable | | |||
| ## Global aliases | |||
| These aliases are expanded in any position in the command line, meaning you can use them even at the | |||
| end of the command you've typed. Examples: | |||
| Quickly pipe to less: | |||
| ```zsh | |||
| $ ls -l /var/log L | |||
| # will run | |||
| $ ls -l /var/log | less | |||
| ``` | |||
| Silences stderr output: | |||
| ```zsh | |||
| $ find . -type f NE | |||
| # will run | |||
| $ find . -type f 2>/dev/null | |||
| ``` | |||
| | Alias | Command | Description | | |||
| |-------|-----------------------------|-------------------------------------------------------------| | |||
| | H | `\| head` | Pipes output to head which outputs the first part of a file | | |||
| | T | `\| tail` | Pipes output to tail which outputs the last part of a file | | |||
| | G | `\| grep` | Pipes output to grep to search for some word | | |||
| | L | `\| less` | Pipes output to less, useful for paging | | |||
| | M | `\| most` | Pipes output to more, useful for paging | | |||
| | LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less | | |||
| | CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat | | |||
| | NE | `2 > /dev/null` | Silences stderr | | |||
| | NUL | `> /dev/null 2>&1` | Silences both stdout and stderr | | |||
| | P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize | | |||
| ## File extension aliases | |||
| These are special aliases that are triggered when a file name is passed as the command. For example, | |||
| if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf` | |||
| that file will be open with `acroread`. | |||
| ### Reading Docs | |||
| | Alias | Command | Description | | |||
| |-------|-------------|-------------------------------------| | |||
| | pdf | `acroread` | Opens up a document using acroread | | |||
| | ps | `gv` | Opens up a .ps file using gv | | |||
| | dvi | `xdvi` | Opens up a .dvi file using xdvi | | |||
| | chm | `xchm` | Opens up a .chm file using xchm | | |||
| | djvu | `djview` | Opens up a .djvu file using djview | | |||
| ### Listing files inside a packed file | |||
| | Alias | Command | Description | | |||
| |---------|-------------|-------------------------------------| | |||
| | zip | `unzip -l` | Lists files inside a .zip file | | |||
| | rar | `unrar l` | Lists files inside a .rar file | | |||
| | tar | `tar tf` | Lists files inside a .tar file | | |||
| | tar.gz | `echo` | Lists files inside a .tar.gz file | | |||
| | ace | `unace l` | Lists files inside a .ace file | | |||
| ### Some other features | |||
| - Opens urls in terminal using browser specified by the variable `$BROWSER` | |||
| - Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR` | |||
| - Opens images using image viewer specified by the variable `$XIVIEWER` | |||
| - Opens videos and other media using mplayer | |||
| @ -0,0 +1,9 @@ | |||
| # compleat plugin | |||
| This plugin looks for [compleat](https://github.com/mbrubeck/compleat) and loads its completion. | |||
| To use it, add compleat to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... compleat) | |||
| ``` | |||
| @ -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) | |||
| ``` | |||
| @ -0,0 +1,28 @@ | |||
| # Dash plugin | |||
| This plugin adds command line functionality for [Dash](https://kapeli.com/dash), | |||
| an API Documentation Browser for macOS. This plugin requires Dash to be installed | |||
| to work. | |||
| To use it, add `dash` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(... dash) | |||
| ``` | |||
| ## Usage | |||
| - Open and switch to the dash application. | |||
| ``` | |||
| dash | |||
| ``` | |||
| - Query for something in dash app: `dash query` | |||
| ``` | |||
| dash golang | |||
| ``` | |||
| - You can optionally provide a keyword: `dash [keyword:]query` | |||
| ``` | |||
| dash python:tuple | |||
| ``` | |||
| @ -1,75 +1,85 @@ | |||
| # debian | |||
| This plugin provides debian related zsh aliases. | |||
| This plugin provides Debian-related aliases and functions for zsh. | |||
| To use it add `debian` to the plugins array in your zshrc file. | |||
| ```zsh | |||
| plugins=(... debian) | |||
| ``` | |||
| ## Settings | |||
| - `$apt_pref`: use apt or aptitude if installed, fallback is apt-get. | |||
| - `$apt_upgr`: use upgrade or safe-upgrade (for aptitude). | |||
| Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior. | |||
| ## Common Aliases | |||
| | Alias | Command | Description | | |||
| | -------- | ------------------------------------------------------------------------------|--------------------------------------------------------------------------- | | |||
| | `age` | apt-get | Command line tool for handling packages | | |||
| | `api` | aptitude | Same functionality as `apt-get`, provides extra options while installation | | |||
| | `acs` | apt-cache search | Command line tool for searching apt software package cache | | |||
| | `aps` | aptitude search | Searches installed packages using aptitude | | |||
| | `as` | aptitude -F \"* %p -> %d \n(%v/%V)\" \ -no-gui --disable-columns search | - | | |||
| | `afs` | apt-file search --regexp | Search file in packages | | |||
| | `asrc` | apt-get source | Fetch source packages through `apt-get` | | |||
| | `app` | apt-cache policy | Displays priority of package sources | | |||
| | Alias | Command | Description | | |||
| | ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- | | |||
| | `age` | `apt-get` | Command line tool for handling packages | | |||
| | `api` | `aptitude` | Same functionality as `apt-get`, provides extra options | | |||
| | `acs` | `apt-cache search` | Command line tool for searching apt software package cache | | |||
| | `aps` | `aptitude search` | Searches installed packages using aptitude | | |||
| | `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format | | |||
| | `afs` | `apt-file search --regexp` | Search file in packages | | |||
| | `asrc` | `apt-get source` | Fetch source packages through `apt-get` | | |||
| | `app` | `apt-cache policy` | Displays priority of package sources | | |||
| ## Superuser Operations Aliases | |||
| | Alias | Command | Description | | |||
| | -------- | -------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------- | | |||
| | `aac` | sudo $apt_pref autoclean | Clears out the local repository of retrieved package files | | |||
| | `abd` | sudo $apt_pref build-dep | Installs all dependencies for building packages | | |||
| | `ac` | sudo $apt_pref clean | Clears out the local repository of retrieved package files except lock files | | |||
| | `ad` | sudo $apt_pref update | Updates the package lists for upgrades for packages | | |||
| | `adg` | sudo $apt_pref update && sudo $apt_pref $apt_upgr | Update and upgrade packages | | |||
| | `adu` | sudo $apt_pref update && sudo $apt_pref dist-upgrade | Smart upgrade that handles dependencies | | |||
| | `afu` | sudo apt-file update | Update the files in packages | | |||
| | `au` | sudo $apt_pref $apt_upgr | - | | |||
| | `ai` | sudo $apt_pref install | Command-line tool to install package | | |||
| | `ail` | sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install | Install all packages given on the command line while using only the first word of each line | | |||
| | `ap` | sudo $apt_pref purge | Removes packages along with configuration files | | |||
| | `ar` | sudo $apt_pref remove | Removes packages, keeps the configuration files | | |||
| | `ads` | sudo apt-get dselect-upgrade | Installs packages from list and removes all not in the list | | |||
| | `dia` | sudo dpkg -i ./*.deb | Install all .deb files in the current directory | | |||
| | `di` | sudo dpkg -i | Install all .deb files in the current directory | | |||
| | `kclean` | sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`)) | Remove ALL kernel images and headers EXCEPT the one in use | | |||
| - `$apt_pref` - Use apt or aptitude if installed, fallback is apt-get. | |||
| - `$apt_upgr` - Use upgrade. | |||
| | Alias | Command | Description | | |||
| | -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | |||
| | `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files | | |||
| | `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages | | |||
| | `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files | | |||
| | `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages | | |||
| | `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages | | |||
| | `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies | | |||
| | `afu` | `sudo apt-file update` | Update the files in packages | | |||
| | `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades | | |||
| | `ai` | `sudo $apt_pref install` | Command-line tool to install package | | |||
| | `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line | | |||
| | `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files | | |||
| | `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files | | |||
| | `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list | | |||
| | `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory | | |||
| | `di` | `sudo dpkg -i` | Install all .deb files in the current directory | | |||
| | `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use | | |||
| ## Aliases - Commands using `su` | |||
| | Alias | Command | | |||
| | -------- | ------------------------------------------------------------------------------| | |||
| | `aac` | su -ls \'$apt_pref autoclean\' root | | |||
| | `ac` | su -ls \'$apt_pref clean\' root | | |||
| | `ad` | su -lc \'$apt_pref update\' root | | |||
| | `adg` | su -lc \'$apt_pref update && aptitude $apt_upgr\' root | | |||
| | `adu` | su -lc \'$apt_pref update && aptitude dist-upgrade\' root | | |||
| | `afu` | su -lc "apt-file update | | |||
| | `ag` | su -lc \'$apt_pref $apt_upgr\' root | | |||
| | `dia` | su -lc "dpkg -i ./*.deb" root | | |||
| | Alias | Command | | |||
| | ----- | --------------------------------------------------------- | | |||
| | `aac` | `su -ls "$apt_pref autoclean" root` | | |||
| | `ac` | `su -ls "$apt_pref clean" root` | | |||
| | `ad` | `su -lc "$apt_pref update" root` | | |||
| | `adg` | `su -lc "$apt_pref update && aptitude $apt_upgr" root` | | |||
| | `adu` | `su -lc "$apt_pref update && aptitude dist-upgrade" root` | | |||
| | `afu` | `su -lc "apt-file update"` | | |||
| | `au` | `su -lc "$apt_pref $apt_upgr" root` | | |||
| | `dia` | `su -lc "dpkg -i ./*.deb" root` | | |||
| ## Miscellaneous Aliases | |||
| | Alias | Command | Description | | |||
| | -------- | -------------------------------------------------|---------------------------------------- | | |||
| | `allpkgs`| aptitude search -F "%p" --disable-columns ~i | Display all installed packages | | |||
| | `mydeb` | time dpkg-buildpackage -rfakeroot -us -uc | Create a basic .deb package | | |||
| | Alias | Command | Description | | |||
| | --------- | ---------------------------------------------- | ------------------------------ | | |||
| | `allpkgs` | `aptitude search -F "%p" --disable-columns ~i` | Display all installed packages | | |||
| | `mydeb` | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package | | |||
| ## Functions | |||
| | Fucntion | Description | | |||
| |-----------------------|-------------------------------------------------------------------------------| | |||
| | `apt-copy` | Create a simple script that can be used to 'duplicate' a system | | |||
| | `apt-history` | Displays apt history for a command | | |||
| | `kerndeb` | Builds kernel packages | | |||
| | `apt-list-packages` | List packages by size | | |||
| | Function | Description | | |||
| | ------------------- | --------------------------------------------------------------- | | |||
| | `apt-copy` | Create a simple script that can be used to 'duplicate' a system | | |||
| | `apt-history` | Displays apt history for a command | | |||
| | `kerndeb` | Builds kernel packages | | |||
| | `apt-list-packages` | List packages by size | | |||
| ## Authors | |||
| - [@AlexBio](https://github.com/AlexBio) | |||
| - [@dbb](https://github.com/dbb) | |||
| - [@Mappleconfusers](https://github.com/Mappleconfusers) | |||
| @ -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 | |||
| @ -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 | |||
| @ -0,0 +1,51 @@ | |||
| # Dnote Plugin | |||
| This plugin adds auto-completion for [Dnote](https://dnote.io) project. | |||
| To use it, add `dnote` to the plugins array in your zshrc file: | |||
| ```zsh | |||
| plugins=(dnote) | |||
| ``` | |||
| ## Usage | |||
| At the basic level, this plugin completes all Dnote commands. | |||
| ```zsh | |||
| $ dnote a(press <TAB> here) | |||
| ``` | |||
| would result in: | |||
| ```zsh | |||
| $ dnote add | |||
| ``` | |||
| For some commands, this plugin dynamically suggests matching book names. | |||
| For instance, if you have three books that begin with 'j': 'javascript', 'job', 'js', | |||
| ```zsh | |||
| $ dnote view j(press <TAB> here) | |||
| ``` | |||
| would result in: | |||
| ```zsh | |||
| $ dnote v j | |||
| javascript job js | |||
| ``` | |||
| As another example, | |||
| ```zsh | |||
| $ dnote edit ja(press <TAB> here) | |||
| ``` | |||
| would result in: | |||
| ```zsh | |||
| $ dnote v javascript | |||
| `````` | |||
| @ -0,0 +1,39 @@ | |||
| #compdef dnote | |||
| local -a _1st_arguments | |||
| _1st_arguments=( | |||
| 'add:add a new note' | |||
| 'view:list books, notes, or view a content' | |||
| 'edit:edit a note or a book' | |||
| 'remove:remove a note or a book' | |||
| 'find:find notes by keywords' | |||
| 'sync:sync data with the server' | |||
| 'login:login to the dnote server' | |||
| 'logout:logout from the dnote server' | |||
| 'version:print the current version' | |||
| 'help:get help about any command' | |||
| ) | |||
| get_booknames() { | |||
| local names=$(dnote view --name-only) | |||
| local -a ret | |||
| while read -r line; do | |||
| ret+=("${line}") | |||
| done <<< "$names" | |||
| echo "$ret" | |||
| } | |||
| if (( CURRENT == 2 )); then | |||
| _describe -t commands "dnote subcommand" _1st_arguments | |||
| return | |||
| elif (( CURRENT == 3 )); then | |||
| case "$words[2]" in | |||
| v|view|a|add) | |||
| _alternative \ | |||
| "names:book names:($(get_booknames))" | |||
| esac | |||
| fi | |||