diff --git a/.antidote/.bumpversion.cfg b/.antidote/.bumpversion.cfg new file mode 100644 index 0000000..1ad414c --- /dev/null +++ b/.antidote/.bumpversion.cfg @@ -0,0 +1,16 @@ +[bumpversion] +current_version = 1.9.7 +parse = v?(?P\d+)\.(?P\d+)\.(?P\d+) +serialize = {major}.{minor}.{revision} + +[bumpversion:file:functions/__antidote_version] + +[bumpversion:file:tests/README.md] + +[bumpversion:file:tests/test_antidote.md] + +[bumpversion:file:tests/test_antidote_core.md] + +[bumpversion:file:tests/test_cmd_update.md] + +[bumpversion:file:README.md] diff --git a/.antidote/.editorconfig b/.antidote/.editorconfig new file mode 100644 index 0000000..41e23c5 --- /dev/null +++ b/.antidote/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.crlf.*] +end_of_line = crlf + +[*.md] +trim_trailing_whitespace = false + +[makefile] +indent_style = tab +indent_size = 4 diff --git a/.antidote/.github/CODE_OF_CONDUCT.md b/.antidote/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..eae7ea8 --- /dev/null +++ b/.antidote/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,77 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make 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 getantidote@gmail.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 diff --git a/.antidote/.github/workflows/test.yml b/.antidote/.github/workflows/test.yml new file mode 100644 index 0000000..0f45744 --- /dev/null +++ b/.antidote/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: test + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + test: + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + with: + repository: "aureliojargas/clitest" + path: bin/clitest + - run: sudo apt install zsh + if: ${{ runner.os == 'Linux' }} + - run: PATH=$GITHUB_WORKSPACE/bin/clitest:$PATH make test + shell: zsh {0} diff --git a/.antidote/.gitignore b/.antidote/.gitignore new file mode 100644 index 0000000..7b4d121 --- /dev/null +++ b/.antidote/.gitignore @@ -0,0 +1,12 @@ +~* +*.zwc +*.zwc.old +.cache/ +!/tests/**/.cache/ +.tmp/ +.plugins/ +.todo/ +sandbox/ +*.old +**/realzdotdir/zsh_plugins.zsh +foo*.* diff --git a/.antidote/LICENSE b/.antidote/LICENSE new file mode 100644 index 0000000..b58162e --- /dev/null +++ b/.antidote/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2015-2017 Carlos Alexandro Becker +Copyright (c) 2021-2024 Matt McElheny + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.antidote/README.md b/.antidote/README.md new file mode 100644 index 0000000..1396054 --- /dev/null +++ b/.antidote/README.md @@ -0,0 +1,161 @@ +# antidote + +[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg)](/LICENSE) +![version](https://img.shields.io/badge/version-v1.9.7-df5e88) + + +GetAntidote Logo + + +> [Get the cure][antidote] + +[Antidote][antidote] is a feature-complete Zsh implementation of the legacy +[Antibody][antibody] plugin manager, which in turn was derived from [Antigen][antigen]. +Antidote not only aims to provide continuity for those legacy plugin managers, but also +to delight new users with high-performance, easy-to-use Zsh plugin management. + +## NOTICE + +**The planned upcoming 2.0 release will stop defaulting to compatibility with +antibody.** If maintaining compatibility with antibody is important to you, you can +ensure that your config remains compatible by add the following `zstyle` to your config +**now**, before the 2.0 release goes live: + +```zsh +zstyle ':antidote:compatibility-mode' 'antibody' 'on' +``` + +Breaking compatibility by default will allow antidote to continue to grow and gain new +features, as well as fix some long-standing issues that have always been present in +antibody, for example: + +- In 2.0, `fpath` can be fully set at the beginning of your bundles in you static file, + making setting up completion bundles properly way easier and less frustrating + ([#74](https://github.com/mattmc3/antidote/discussions/74), + [#144](https://github.com/mattmc3/antidote/issues/144)). +- bundles will no longer default to using fugly directory names + ($ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar), making + `zstyle ':antidote:bundle' use-friendly-names on` obsolete. +- probably some other minor deviations as well + +Just to be clear, if you don't specifically care about backwards compatibility with +antibody, you do not need to change a thing. 2.x will not break your 1.x antidote +config. If you do care, be sure to add the compatibility mode `zstyle` above to your +config **now**, before the 2.0 release. + +## Usage + +Basic usage should look really familiar to you if you have used Antibody or Antigen. +Bundles (aka: Zsh plugins) are stored in a file typically called `.zsh_plugins.txt`. + +```zsh +# .zsh_plugins.txt +rupa/z # some bash plugins work too +sindresorhus/pure # enhance your prompt + +# you can even use Oh My Zsh plugins +getantidote/use-omz +ohmyzsh/ohmyzsh path:lib +ohmyzsh/ohmyzsh path:plugins/extract + +# add fish-like features +zsh-users/zsh-syntax-highlighting +zsh-users/zsh-autosuggestions +zsh-users/zsh-history-substring-search +``` + +A typical `.zshrc` might then look like: + +```zsh +# .zshrc +source /path-to-antidote/antidote.zsh +antidote load ${ZDOTDIR:-$HOME}/.zsh_plugins.txt +``` + +The full documentation can be found at [https://antidote.sh][antidote]. + +## Help getting started + +If you want to see a full-featured example Zsh configuration using antidote, you can +have a look at this [example zdotdir](https://github.com/getantidote/zdotdir) project. +Feel free to incorporate code or plugins from it into your own dotfiles, or you can fork +it to get started building your own Zsh config from scratch driven by antidote. + +## Installation + +### Install with git + +You can install the latest release of antidote by cloning it with `git`: + +```zsh +# first, run this from an interactive zsh terminal session: +git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-$HOME}/.antidote +``` + +### Install with a package manager + +antidote may also be available in your system's package manager: + +- [macOS homebrew](https://formulae.brew.sh/formula/antidote): `brew install antidote` +- [Arch AUR](https://aur.archlinux.org/packages/zsh-antidote): `yay -S zsh-antidote` +- [Nix Home-Manager](https://mipmip.github.io/home-manager-option-search/?query=antidote) : `programs.zsh.antidote.enable = true;` + +## Performance + +antidote supports ultra-high performance plugin loads using a static plugin file. +It also allows deferred loading for [plugins that support it](https://github.com/romkatv/zsh-defer#caveats). + +```zsh +# .zsh_plugins.txt +# some plugins support deferred loading +zdharma-continuum/fast-syntax-highlighting kind:defer +zsh-users/zsh-autosuggestions kind:defer +zsh-users/zsh-history-substring-search kind:defer +``` + +```zsh +# .zshrc +# Lazy-load antidote and generate the static load file only when needed +zsh_plugins=${ZDOTDIR:-$HOME}/.zsh_plugins +if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then + ( + source /path-to-antidote/antidote.zsh + antidote bundle <${zsh_plugins}.txt >${zsh_plugins}.zsh + ) +fi +source ${zsh_plugins}.zsh +``` + +## Benchmarks + +You can see how antidote compares with other setups [here][benchmarks]. + +## Plugin authors + +If you authored a Zsh plugin, the recommended snippet for antidote is: + +```zsh +antidote install gh_user/gh_repo +``` + +If your plugin is hosted somewhere other than GitHub, you can use this: + +```zsh +antidote install https://bitbucket.org/bb_user/bb_repo +``` + +## Credits + +A big thank you to [Carlos](https://github.com/caarlos0) for all his work on +[antibody] over the years. + +[antigen]: https://github.com/zsh-users/antigen +[antibody]: https://github.com/getantibody/antibody +[antidote]: https://antidote.sh +[benchmarks]: https://github.com/romkatv/zsh-bench/blob/master/doc/linux-desktop.md +[zsh]: https://www.zsh.org diff --git a/.antidote/antidote b/.antidote/antidote new file mode 100644 index 0000000..677d5d6 --- /dev/null +++ b/.antidote/antidote @@ -0,0 +1,17 @@ +#!/bin/zsh + +### antidote - the cure to slow zsh plugin management +# +# https://antidote.sh +# run `antidote -h` for usage +# +# Note: this gets overridden if using `antidote init`. +# +function antidote { + 0=${(%):-%x} + if ! typeset -f antidote-main > /dev/null; then + source ${0:A:h}/antidote.zsh + fi + antidote-main "$@" +} +antidote "$@" diff --git a/.antidote/antidote.zsh b/.antidote/antidote.zsh new file mode 100644 index 0000000..f7f4a76 --- /dev/null +++ b/.antidote/antidote.zsh @@ -0,0 +1,17 @@ +# shell prereq +if test -z "$ZSH_VERSION"; then + shellname=$(ps -p $$ -oargs= | awk 'NR=1{print $1}') + echo >&2 "antidote: Expecting zsh. Found '$shellname'." + return 1 +else + builtin autoload -Uz is-at-least + if ! is-at-least 5.4.2; then + echo >&2 "antidote: Unsupported Zsh version '$ZSH_VERSION'. Expecting Zsh >5.4.2." + return 1 + fi + + typeset -f __antidote_setup &>/dev/null && unfunction __antidote_setup + 0=${(%):-%N} + builtin autoload -Uz ${0:A:h}/functions/__antidote_setup + __antidote_setup +fi diff --git a/.antidote/functions/__antidote_bulk_clone b/.antidote/functions/__antidote_bulk_clone new file mode 100644 index 0000000..cf86835 --- /dev/null +++ b/.antidote/functions/__antidote_bulk_clone @@ -0,0 +1,38 @@ +#!/bin/zsh + +### Generate background clone commands +#function __antidote_bulk_clone { + emulate -L zsh; setopt local_options $_adote_funcopts + + # Allow the user to define zsh-defer repo in case they want to fork it. + local zsh_defer_bundle + zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \ + || zsh_defer_bundle='romkatv/zsh-defer' + + # get a list of clonable repos from a bundle file + $__adote_awkcmd -v ZSH_DEFER_BUNDLE=$zsh_defer_bundle ' + BEGIN { RS="[\r\n]" } + + # initialize vars + { bundle=""; opts="--kind clone" } + + # skip blank or commented lines + /^ *(#.+)?$/ { next } + + # clone zsh-defer + /kind:defer/ { print "antidote-script --kind clone " ZSH_DEFER_BUNDLE " &" } + + # handle user/repo and URL forms + $1~/^[^\/]+\/[^\/]+$/ { bundle=$1 } + $1~/^(https?:|(ssh|git)@)/ { bundle=$1 } + + # find branch annotation if it exists + match($0, /branch:[^\t ]+/) { opts=opts " --branch " substr($0, RSTART+7, RLENGTH-7) } + + # print result + bundle!=""{ print "antidote-script", opts, bundle, "&" } + + END { print "wait" } + + ' "$@" | sort | uniq +#} diff --git a/.antidote/functions/__antidote_bundle_dir b/.antidote/functions/__antidote_bundle_dir new file mode 100644 index 0000000..5924237 --- /dev/null +++ b/.antidote/functions/__antidote_bundle_dir @@ -0,0 +1,46 @@ +#!/bin/zsh + +### Get the name of the bundle dir. +#function __antidote_bundle_dir { + emulate -L zsh; setopt local_options $_adote_funcopts + + # If the bundle is a repo/URL, then by default we use the legacy antibody format: + # `$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions` + # With `zstyle ':antidote:bundle' use-friendly-names on`, we can simplify to + # `$ANTIDOTE_HOME/zsh-users/zsh-autosuggestions` + # If the bundle is a file, use its parent directory. + # Otherwise, just assume the bundle is a directory. + local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global' + + local bundle="$1" + local bundle_type="$(__antidote_bundle_type $bundle)" + + # handle repo bundle paths + if [[ "$bundle_type" == (repo|url|sshurl) ]] && [[ ! -e "$bundle_path" ]]; then + if zstyle -t ':antidote:bundle' use-friendly-names; then + # user/repo format + # ex: $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions + bundle=${bundle%.git} + bundle=${bundle:gs/\:/\/} + local parts=( ${(ps./.)bundle} ) + if [[ $#parts -gt 1 ]]; then + print $(antidote-home)/${parts[-2]}/${parts[-1]} + else + print $(antidote-home)/$bundle + fi + else + # sanitize URL for safe use as a dir name + # ex: $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions + local url=$(__antidote_tourl $bundle) + url=${url%.git} + url=${url:gs/\@/-AT-} + url=${url:gs/\:/-COLON-} + url=${url:gs/\//-SLASH-} + print $(antidote-home)/$url + fi + elif [[ -f "$bundle" ]]; then + print ${bundle:A:h} + else + print ${bundle} + fi +#} diff --git a/.antidote/functions/__antidote_bundle_name b/.antidote/functions/__antidote_bundle_name new file mode 100644 index 0000000..0a81dfd --- /dev/null +++ b/.antidote/functions/__antidote_bundle_name @@ -0,0 +1,17 @@ +#!/bin/zsh + +### Get the short name of the bundle. +#function __antidote_bundle_name { + emulate -L zsh; setopt local_options $_adote_funcopts + local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global' + local bundle=$1 + local bundle_type="$(__antidote_bundle_type $bundle)" + if [[ "$bundle_type" == (url|sshurl) ]] ; then + bundle=${bundle%.git} + bundle=${bundle:gs/\:/\/} + local parts=(${(ps./.)bundle}) + print ${parts[-2]}/${parts[-1]} + else + print $bundle | sed -e "s|^\~/|$HOME/|" -e "s|^$HOME|\$HOME|" + fi +#} diff --git a/.antidote/functions/__antidote_bundle_type b/.antidote/functions/__antidote_bundle_type new file mode 100644 index 0000000..dcb5334 --- /dev/null +++ b/.antidote/functions/__antidote_bundle_type @@ -0,0 +1,47 @@ +#!/bin/zsh + +### Determine bundle type: +### - ? - unknown +### - empty - empty string +### - file - an existing file +### - dir - an existing directory +### - path - an non-existant path +### - relpath - a relative path +### - repo - a git repo (user/repo format) +### - sshurl - a git repo (SSH format) +### - url - a git repo (URL format) +### - word - a word +#function __antidote_bundle_type { + emulate -L zsh; setopt local_options $_adote_funcopts + local bundle=$1 + + # Try to expand path bundles with '$' and '~' prefixes so that we get a more + # granular result than 'path'. + if [[ $bundle == '~/'* ]]; then + bundle="${HOME}/${bundle#\~/*}" + elif [[ $bundle == '$'* ]] && [[ $bundle != *'('* ]] && [[ $bundle != *';'* ]]; then + bundle=$(eval print $bundle) + fi + + # Determine the bundle type. + local result + if [[ -e "$bundle" ]]; then + [[ -f $bundle ]] && result=file || result=dir + elif [[ -z "${bundle// }" ]]; then + result=empty + else + case "$bundle" in + (/|~|'$')*) result=path ;; + *://*) result=url ;; + *@*:*/*) result=sshurl ;; + *(:|@)*) result='?' ;; + */*/*) result=relpath ;; + */) result=relpath ;; + */*) result=repo ;; + *) result=word ;; + esac + fi + + typeset -g REPLY=$result + print $result +#} diff --git a/.antidote/functions/__antidote_bundle_zcompile b/.antidote/functions/__antidote_bundle_zcompile new file mode 100644 index 0000000..8d27c0e --- /dev/null +++ b/.antidote/functions/__antidote_bundle_zcompile @@ -0,0 +1,27 @@ +#!/bin/zsh + +### Compile bundles +#function __antidote_bundle_zcompile { + emulate -L zsh; setopt local_options $_adote_funcopts + builtin autoload -Uz zrecompile + + local -a bundles + if [[ -z "$1" ]]; then + bundles=($(antidote-list --dirs)) + elif [[ -f "$1" ]]; then + zrecompile -pq "$1" + return + elif [[ -d "$1" ]]; then + bundles=($1) + else + bundles=($(antidote-path "$1")) + fi + + local bundle zfile + for bundle in $bundles; do + for zfile in ${bundle}/**/*.zsh{,-theme}(N); do + [[ $zfile != */test-data/* ]] || continue + zrecompile -pq "$zfile" + done + done +# } diff --git a/.antidote/functions/__antidote_collect_input b/.antidote/functions/__antidote_collect_input new file mode 100644 index 0000000..05359af --- /dev/null +++ b/.antidote/functions/__antidote_collect_input @@ -0,0 +1,15 @@ +#!/bin/zsh + +### Collect 0 )); then + input=("${(s.\n.)${@}}") + elif [[ ! -t 0 ]]; then + local data + while IFS= read -r data || [[ -n "$data" ]]; do + input+=("$data") + done + fi + printf '%s\n' "${input[@]}" +#} diff --git a/.antidote/functions/__antidote_del b/.antidote/functions/__antidote_del new file mode 100644 index 0000000..d139c2e --- /dev/null +++ b/.antidote/functions/__antidote_del @@ -0,0 +1,32 @@ +#!/bin/zsh +# Call me paranoid, but I want to be really certain antidote will never rm something it +# shouldn't. This function wraps rm to double check that any paths being removed are +# valid. If it's not in your $HOME or $TMPDIR, we need to block it. + +#function __antidote_del { + emulate -L zsh; setopt local_options + + local -a rmflags rmpaths + local p + + while (( $# )); do + case "$1" in + --) shift; break ;; + -*) rmflags+=($1) ;; + *) break ;; + esac + shift + done + + (( $# > 0 )) || return 1 + + for p in $@; do + p="${p:a}" + if [[ "$p" != $HOME/* ]] && [[ "$p" != ${TMPDIR:-/tmp}/* ]]; then + print -ru2 -- "antidote: Blocked attempt to rm path: '$p'." + return 1 + fi + done + + command rm ${rmflags[@]} -- "$@" +#} diff --git a/.antidote/functions/__antidote_filter_defers b/.antidote/functions/__antidote_filter_defers new file mode 100644 index 0000000..2b425fa --- /dev/null +++ b/.antidote/functions/__antidote_filter_defers @@ -0,0 +1,13 @@ +#!/bin/zsh + +### Filter all but the first defer block. +#function __antidote_filter_defers { + emulate -L zsh; setopt local_options $_adote_funcopts + $__adote_awkcmd ' + # filter all but the first time we source zsh-defer (a 4 line if statement) + BEGIN { skip=0; found=0 } + skip>0 { skip-- } + /^if.+functions\[zsh\-defer\]/ { if(!found) found=1; else skip=4 } + skip==0 { print } + ' "$@" +#} diff --git a/.antidote/functions/__antidote_get_cachedir b/.antidote/functions/__antidote_get_cachedir new file mode 100644 index 0000000..a3555f0 --- /dev/null +++ b/.antidote/functions/__antidote_get_cachedir @@ -0,0 +1,29 @@ +#!/bin/zsh + +### Get the default cache directory per OS +#function __antidote_get_cachedir { + emulate -L zsh; setopt local_options $_adote_funcopts + + local result + if [[ "${OSTYPE}" == darwin* ]]; then + result=$HOME/Library/Caches + elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then + result=${LOCALAPPDATA:-$LocalAppData} + if type cygpath > /dev/null; then + result=$(cygpath "$result") + fi + elif [[ -n "$XDG_CACHE_HOME" ]]; then + result=$XDG_CACHE_HOME + else + result=$HOME/.cache + fi + + if [[ -n "$1" ]]; then + if [[ $result == *\\* ]] && [[ $result != */* ]]; then + result+="\\$1" + else + result+="/$1" + fi + fi + print -r -- $result +#} diff --git a/.antidote/functions/__antidote_indent b/.antidote/functions/__antidote_indent new file mode 100644 index 0000000..dc831e0 --- /dev/null +++ b/.antidote/functions/__antidote_indent @@ -0,0 +1,8 @@ +#!/bin/zsh + +### Indent strings +#function __antidote_indent { + emulate -L zsh; setopt local_options $_adote_funcopts + local -a lines=("${(@f)$(__antidote_collect_input "$@")}") + printf ' %s\n' $lines +#} diff --git a/.antidote/functions/__antidote_initfiles b/.antidote/functions/__antidote_initfiles new file mode 100644 index 0000000..1953e3e --- /dev/null +++ b/.antidote/functions/__antidote_initfiles @@ -0,0 +1,17 @@ +#!/bin/zsh + +### Get the path to a plugin's init file. +#function __antidote_initfiles { + emulate -L zsh; setopt local_options $_adote_funcopts + typeset -ga reply=() + local dir=${1:A} + local initfiles=($dir/${dir:A:t}.plugin.zsh(N)) + [[ $#initfiles -gt 0 ]] || initfiles=($dir/*.plugin.zsh(N)) + [[ $#initfiles -gt 0 ]] || initfiles=($dir/*.zsh(N)) + [[ $#initfiles -gt 0 ]] || initfiles=($dir/*.sh(N)) + [[ $#initfiles -gt 0 ]] || initfiles=($dir/*.zsh-theme(N)) + + typeset -ga reply=($initfiles) + printf "%s\n" ${(u)initfiles[@]} + (( $#initfiles )) || return 1 +#} diff --git a/.antidote/functions/__antidote_load_prep b/.antidote/functions/__antidote_load_prep new file mode 100644 index 0000000..69405f1 --- /dev/null +++ b/.antidote/functions/__antidote_load_prep @@ -0,0 +1,60 @@ +#!/bin/zsh + +### Prep to load +#function __antidote_load_prep { + emulate -L zsh; setopt local_options $_adote_funcopts + + # pass in bundle file, read from zstyle, or use default .zsh_plugins.txt + local bundlefile="$1" + if [[ -z "$bundlefile" ]]; then + zstyle -s ':antidote:bundle' file 'bundlefile' || + bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt + fi + + # pass in static file, read from zstyle, change extension, or use default .zsh_plugins.zsh + local staticfile="$2" + if [[ -z "$staticfile" ]]; then + zstyle -s ':antidote:static' file 'staticfile' + if [[ -z "$staticfile" ]]; then + if [[ -z "$bundlefile:t:r" ]]; then + staticfile=${bundlefile}.zsh + else + staticfile=${bundlefile:r}.zsh + fi + fi + fi + + if [[ ! -e "$bundlefile" ]]; then + # the files can't have the same name + print -ru2 -- "antidote: bundle file not found '$bundlefile'." + return 1 + elif [[ "$bundlefile" == "$staticfile" ]]; then + # the files can't have the same name + print -ru2 -- "antidote: bundle file and static file are the same '$bundlefile'." + return 1 + fi + + # regenerate the static file based on whether the bundle file is newer and whether + # antidote home exists and is ready to be loaded + local force_bundle=0 + if ! zstyle -t ':antidote:load:checkfile' disabled; then + local loadable_check_path="$(antidote-home)/.antidote.load" + if [[ ! -e $loadable_check_path ]]; then + force_bundle=1 + [[ -d $loadable_check_path:h ]] || mkdir -p $loadable_check_path:h + touch $loadable_check_path + fi + fi + + if [[ ! $staticfile -nt $bundlefile ]] || [[ $force_bundle -eq 1 ]]; then + mkdir -p "${staticfile:A:h}" + antidote bundle <"$bundlefile" >|"$staticfile" + if [[ -r "${staticfile}.zwc" ]] && ! zstyle -t ':antidote:static' zcompile; then + __antidote_del -f -- "${staticfile}.zwc" + fi + fi + + # tell antidote-load what to source + typeset -g REPLY=$staticfile + #print $REPLY +#} diff --git a/.antidote/functions/__antidote_parse_bundles b/.antidote/functions/__antidote_parse_bundles new file mode 100644 index 0000000..684b2a8 --- /dev/null +++ b/.antidote/functions/__antidote_parse_bundles @@ -0,0 +1,41 @@ +#!/bin/zsh + +### Parse antidote's bundle DSL. +#function __antidote_parse_bundles { + emulate -L zsh; setopt local_options $_adote_funcopts + $__adote_awkcmd ' + BEGIN { RS="[\r\n]" } + + # skip comments and empty lines + /^ *$/ || /^ *#/ {next} + + # strip trailing comments + { sub(/[ \t]#.*$/,"",$0) } + + # escape leading $ variables + { sub(/^\$/,"\\$",$0) } + + # handle extension functionality (eg :use ohmyzsh) + $1~/^:/ { + sub(/^:/,"",$1) + printf "antidote-script-" $1 + for (i=2; i<=NF; i++) { + printf " %s",$i + } + printf "\n" + next + } + + # move flags to front and call antidote-script + { + sub(/ #.*$/,"",$0) + printf "antidote-script" + for (i=2; i<=NF; i++) { + sub(/^/,"--",$i) + sub(/:/," ",$i) + printf " %s",$i + } + printf " %s\n",$1 + } + ' "$@" +#} diff --git a/.antidote/functions/__antidote_print_path b/.antidote/functions/__antidote_print_path new file mode 100644 index 0000000..9bce65b --- /dev/null +++ b/.antidote/functions/__antidote_print_path @@ -0,0 +1,8 @@ +#!/bin/zsh +### Pretty print a path + +if zstyle -t ':antidote:compatibility-mode' 'antibody'; then + echo "$1" +else + echo "$1" | sed -e "s|^$HOME/|\$HOME/|" +fi diff --git a/.antidote/functions/__antidote_setup b/.antidote/functions/__antidote_setup new file mode 100644 index 0000000..a2d023c --- /dev/null +++ b/.antidote/functions/__antidote_setup @@ -0,0 +1,39 @@ +#!/bin/zsh + +### Setup antidote. +#function __antidote_setup { + 0=${(%):-%x} + fpath=( "${0:A:h}" $fpath ) + local fn + for fn in ${0:A:h}/*; do + [[ ${fn:t} != '__antidote_setup' ]] || continue + if typeset -f ${fn:t} > /dev/null; then + unfunction -- ${fn:t} + fi + + # autoload extensionless function files + [[ -z "${fn:e}" ]] && autoload -Uz "${fn}" + done + + # man pages + if [[ "$MANPATH" != *"${0:A:h:h}/man"* ]]; then + export MANPATH="${0:A:h:h}/man:$MANPATH" + fi + + builtin autoload -Uz is-at-least + if is-at-least 5.8; then + # the -F option was added in 5.8 + typeset -gHa _adote_zparopt_flags=( -D -M -F ) + else + typeset -gHa _adote_zparopt_flags=( -D -M ) + fi + + typeset -gHa _adote_funcopts=( extended_glob no_monitor pipefail ) + if zstyle -t ':antidote:tests' set-warn-options; then + typeset -gHa _adote_funcopts=( $_adote_funcopts warn_create_global warn_nested_var ) + fi + + gawk --version &>/dev/null && typeset -gH __adote_awkcmd=gawk || typeset -gH __adote_awkcmd=awk + typeset -gHi __adote_ksh_arrays + typeset -gHi __adote_sh_glob +#} diff --git a/.antidote/functions/__antidote_tourl b/.antidote/functions/__antidote_tourl new file mode 100644 index 0000000..aa11d1b --- /dev/null +++ b/.antidote/functions/__antidote_tourl @@ -0,0 +1,13 @@ +#!/bin/zsh + +### Get the url from a repo bundle. +#function __antidote_tourl { + emulate -L zsh; setopt local_options $_adote_funcopts + + local bundle=$1 + local url=$bundle + if [[ $bundle != *://* && $bundle != git@*:*/* ]]; then + url=https://github.com/$bundle + fi + print $url +#} diff --git a/.antidote/functions/__antidote_usage b/.antidote/functions/__antidote_usage new file mode 100644 index 0000000..f792f8c --- /dev/null +++ b/.antidote/functions/__antidote_usage @@ -0,0 +1,27 @@ +#!/bin/zsh + +### Print usage. +#function __antidote_usage { + emulate -L zsh; setopt local_options $_adote_funcopts + cat<] [ ...] + +flags: + -h, --help Show context-sensitive help + -v, --version Show application version + +commands: + help Show documentation + load Statically source all bundles from the plugins file + bundle Clone bundle(s) and generate the static load script + install Clone a new bundle and add it to your plugins file + update Update antidote and its cloned bundles + purge Remove a cloned bundle + home Print where antidote is cloning bundles + list List cloned bundles + path Print the path of a cloned bundle + init Initialize the shell for dynamic bundles +EOS +#} diff --git a/.antidote/functions/__antidote_version b/.antidote/functions/__antidote_version new file mode 100644 index 0000000..c24bfd3 --- /dev/null +++ b/.antidote/functions/__antidote_version @@ -0,0 +1,11 @@ +#!/bin/zsh + +### Get the antidote version. +#function __antidote_version { + emulate -L zsh; setopt local_options $_adote_funcopts + 0=${(%):-%x} + local ver='1.9.7' + local gitsha=$(git -C "${0:A:h:h}" rev-parse --short HEAD 2>/dev/null) + [[ -z "$gitsha" ]] || ver="$ver ($gitsha)" + print "antidote version $ver" +#} diff --git a/.antidote/functions/_antidote b/.antidote/functions/_antidote new file mode 100644 index 0000000..c244594 --- /dev/null +++ b/.antidote/functions/_antidote @@ -0,0 +1,123 @@ +#compdef antidote + +function _antidote_subcommands { + local usage=$( + antidote --help | + ${__adote_awkcmd:-awk} ' + BEGIN{OFS=":"; p=0} + /^commands:$/ {p=1; next} + !p{next} + { for(i=3; i<=NF; i++) { $2=$2" "$i } } + { print $1,$2 } + ' + ) + local -a subcommands=("${(@f)usage}") + _describe -t subcommands 'subcommand' subcommands "$@" +} + +function _antidote_installed_bundles { + local -a bundles=("${(@f)$(antidote list -s)}") + _describe 'installed bundles' bundles +} + +function _antidote_bundle_kinds { + local -a kinds=( + 'autoload' 'clone' 'defer' 'fpath' 'path' 'zsh' + ) + _describe 'bundle kinds' kinds +} + +function _antidote { + typeset -A opt_args + local context state line + local curcontext="$curcontext" + local ret=1 + + _arguments -C \ + '(- *)'{-v,--version}'[Show version]' \ + '(- *)'{-h,--help}'[Show usage information]' \ + '1: :_antidote_subcommands' \ + '*:: :->subcmds' && return 0 + + case "$state" in + (subcmds) + case $words[1] in + (bundle) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (help) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (home) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (init) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (install|script) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + '(-k --kind)'{-k,--kind}'[The kind of bundle]:kinds:_antidote_bundle_kinds' \ + '(-p --path)'{-p,--path}'[A relative subpath within the bundle where the plugin is located]' \ + '(-a --autoload)'{-a,--autoload}'[A relative subpath within the bundle where autoload function files are located]' \ + '(-c --conditional)'{-c,--conditional}'[A conditional function used to check whether to load the bundle]' \ + '(-b --branch)'{-b,--branch}'[The git branch to use]' \ + '(--pre)--pre[A function to be called prior to loading the bundle]' \ + '(--post)--post[A function to be called after loading the bundle]' \ + && ret=0 + ;; + (list) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + '(-s --short)'{-s,--short}'[Show shortened repos where possible]' \ + '(-d --dirs)'{-d,--dirs}'[Show only bundle directories]' \ + '(-u --url)'{-u,--url}'[Show bundle URLs]' \ + && ret=0 + ;; + (load) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (path) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + && ret=0 + ;; + (purge) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + '(-a --all)'{-a,--all}'[Purge all cloned bundles]' \ + "*::antidote bundles:_antidote_installed_bundles" \ + && ret=0 + ;; + (update) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + '(-s --selp)'{-s,--self}'[Update antidote]' \ + '(-b --bundles)'{-b,--bundles}'[Update bundles]' \ + && ret=0 + ;; + (*) + _arguments \ + '(- *)'{-h,--help}'[Show usage information]' \ + '*: :_files' \ + && ret=0 + ;; + esac + ;; + esac + + return ret +} +_antidote "$@" + +# vim: ft=zsh sw=2 ts=2 et diff --git a/.antidote/functions/antidote b/.antidote/functions/antidote new file mode 100644 index 0000000..bf7aa15 --- /dev/null +++ b/.antidote/functions/antidote @@ -0,0 +1,16 @@ +#!/bin/zsh + +### antidote - the cure to slow zsh plugin management +# +# https://antidote.sh +# run `antidote -h` for usage +# +# Note: this gets overridden if using `antidote init`. +# +#function antidote { + 0=${(%):-%x} + if ! typeset -f antidote-main > /dev/null; then + source ${0:A:h:h}/antidote.zsh + fi + antidote-main "$@" +#} diff --git a/.antidote/functions/antidote-bundle b/.antidote/functions/antidote-bundle new file mode 100644 index 0000000..5090251 --- /dev/null +++ b/.antidote/functions/antidote-bundle @@ -0,0 +1,49 @@ +#!/bin/zsh + +### Clone bundle(s) and generate the static load script. +# +# usage: antidote bundle [-h|--help] ... +# + +### Clone bundle(s) and generate the static load script. +#function antidote-bundle { + # Download a bundle and prints its Zsh source line. + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help + zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1 + + if (( $#o_help )); then + antidote-help bundle + return + fi + + # handle bundles as newline delimited arg strings, + # or as 1 )); then + source <(printf '%s\n' $bundles | __antidote_bulk_clone) + fi + + # generate bundle script + source <(printf '%s\n' $bundles | __antidote_parse_bundles) | __antidote_filter_defers +#} diff --git a/.antidote/functions/antidote-help b/.antidote/functions/antidote-help new file mode 100644 index 0000000..f969ed7 --- /dev/null +++ b/.antidote/functions/antidote-help @@ -0,0 +1,32 @@ +#!/bin/zsh + +### Show antidote documentation. +# +# usage: antidote [-h|--help] [] +# antidote help [] +# + +#function antidote-help { + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help + zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1 + + local manpage + + if (( $#o_help )); then + manpage=antidote-help + elif [[ "$1" == antidote ]]; then + manpage=antidote + elif [[ -n "$1" ]]; then + manpage="antidote-${1}" + fi + + if (( $+commands[man] )) && [[ -n "$manpage" ]]; then + man "$manpage" || { + __antidote_usage && return 1 + } + else + __antidote_usage + fi +#} diff --git a/.antidote/functions/antidote-home b/.antidote/functions/antidote-home new file mode 100644 index 0000000..070fcef --- /dev/null +++ b/.antidote/functions/antidote-home @@ -0,0 +1,29 @@ +#!/bin/zsh + +### Print where antidote is cloning bundles. +# +# usage: antidote home [-h|--help] +# +# Can be overridden by setting `$ANTIDOTE_HOME`. +# +#function antidote-home { + emulate -L zsh; setopt local_options $_adote_funcopts + + typeset -g REPLY= + local o_help + zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1 + + if (( $#o_help )); then + antidote-help home + return + fi + + local result + if [[ -n "$ANTIDOTE_HOME" ]]; then + result=$ANTIDOTE_HOME + else + result=$(__antidote_get_cachedir "antidote") + fi + print $result + typeset -g REPLY=$result +#} diff --git a/.antidote/functions/antidote-init b/.antidote/functions/antidote-init new file mode 100644 index 0000000..fd07272 --- /dev/null +++ b/.antidote/functions/antidote-init @@ -0,0 +1,33 @@ +#!/bin/zsh + +### Initialize the shell for dynamic bundles. +# +# usage: antidote init [-h|--help] +# source <(antidote init) +# +# This function changes how the `antidote` command works by sourcing the results of +# `antidote bundle` instead of just generating the Zsh script. +#function antidote-init { + local o_help + zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1 + + if (( $#o_help )); then + antidote-help init + return + fi + + local script=( + '#!/usr/bin/env zsh' + 'function antidote {' + ' case "$1" in' + ' bundle)' + ' source <( antidote-main $@ ) || antidote-main $@' + ' ;;' + ' *)' + ' antidote-main $@' + ' ;;' + ' esac' + '}' + ) + printf "%s\n" "${script[@]}" +#} diff --git a/.antidote/functions/antidote-install b/.antidote/functions/antidote-install new file mode 100644 index 0000000..c493d15 --- /dev/null +++ b/.antidote/functions/antidote-install @@ -0,0 +1,65 @@ +#!/bin/zsh + +### Clone a new bundle and add it to your plugins file. + +# usage: antidote install [-h|--help] [-k|--kind ] [-p|--path ] +# [-c|--conditional ] [-b|--branch ] +# [--pre ] [--post ] +# [-a|--autoload ] [] +#function antidote-install { + emulate -L zsh; setopt local_options $_adote_funcopts + + local -A flag_to_annotation=( + '-a' autoload + '-b' branch + '-c' conditional + '-h' help + '-k' kind + '-p' path + ) + local -a annotations=() + local arg + while (( $# )); do + arg="$1" + case "$arg" in + -h|--help) + antidote-help install + return + ;; + --) shift; break ;; + --*) annotations+=( "${arg#*--}:$2" ); shift ;; + -*) annotations+=( $flag_to_annotation[$arg]:$2 ); shift ;; + *) break ;; + esac + shift + done + + if [[ $# -eq 0 ]]; then + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" + return 1 + fi + + local bundle=$1 + local bundlefile=$2 + if [[ -z "$bundlefile" ]]; then + zstyle -s ':antidote:bundle' file 'bundlefile' || + bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt + fi + + local bundledir=$(__antidote_bundle_dir $bundle) + if [[ -d "$bundledir" ]]; then + print -ru2 "antidote: error: $bundle already installed: $bundledir" + return 1 + fi + + # use antidote bundle to clone our bundle + local bundlestr=$bundle + (( $#annotations )) && bundlestr+=" $annotations" + antidote-bundle "$bundlestr" >/dev/null + if [[ $? -ne 0 ]]; then + print -ru2 "antidote: unable to install bundle '$bundle'." + else + print "Adding bundle to '$bundlefile':" + print $bundlestr | tee -a $bundlefile + fi +#} diff --git a/.antidote/functions/antidote-list b/.antidote/functions/antidote-list new file mode 100644 index 0000000..f54698e --- /dev/null +++ b/.antidote/functions/antidote-list @@ -0,0 +1,48 @@ +#!/bin/zsh + +### List cloned bundles. +# +# usage: antidote list [-h|--help] [-s|--short] [-d|--dirs] [-u|--url] +# +#function antidote-list { + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help o_short o_url o_dirs + zparseopts $_adote_zparopt_flags -- \ + h=o_help -help=h \ + s=o_short -short=s \ + u=o_url -url=u \ + d=o_dirs -dirs=d || + return 1 + + if (( $#o_help )); then + antidote-help list + return + fi + + if [[ $# -ne 0 ]]; then + print -ru2 "antidote: error: unexpected $1, try --help" + return 1 + fi + + local bundledir + local output=() + local bundles=($(antidote-home)/**/.git(/N)) + + for bundledir in $bundles; do + bundledir=${bundledir:h} + local url=$(git -C "$bundledir" config remote.origin.url) + if (( $#o_dirs )); then + output+=($bundledir) + elif (( $#o_url )); then + output+=($url) + elif (( $#o_short )); then + url=${url%.git} + url=${url#https://github.com/} + output+=($url) + else + output+=("$(printf '%-64s %s\n' $url $bundledir)") + fi + done + (( $#output )) && printf '%s\n' ${(o)output} +#} diff --git a/.antidote/functions/antidote-load b/.antidote/functions/antidote-load new file mode 100644 index 0000000..1b9a3f3 --- /dev/null +++ b/.antidote/functions/antidote-load @@ -0,0 +1,26 @@ +#!/bin/zsh + +### Statically source all bundles from the plugins file. +# +# usage: antidote load [-h|--help] [ []] +# +#function antidote-load { + if [[ "$1" == (-h|--help) ]]; then + antidote-help load + return + fi + + # We can't use LOCAL_OPTIONS because sourcing plugins means we'd lose any Zsh options + # set in those plugins, so we delegate all the work to __antidote_load_prep where + # we can safely use LOCAL_OPTIONS. For this function, we should do the bare minimum + # so the user can set whatever crazy Zsh options they want, and antidote doesn't need + # to concern itself with that. + # + # "Is your house on fire, Clark? No, Aunt Bethany, those are the user's Zsh options." + # + typeset -g REPLY= + __antidote_load_prep "$@" || return 1 + [[ -f "$REPLY" ]] || return 2 + source "$REPLY" + unset REPLY +#} diff --git a/.antidote/functions/antidote-main b/.antidote/functions/antidote-main new file mode 100644 index 0000000..13ef90c --- /dev/null +++ b/.antidote/functions/antidote-main @@ -0,0 +1,49 @@ +#!/bin/zsh + +### The main controller for antidote. +# The reason we use `antidote-main` instead putting all of this in `antidote` +# is that this allows the `antidote` function to be overridden via `antidote init`. +# The init command switches antidote from static mode to dynamic mode, but this +# core functionality remains. +#function antidote-main { + 0=${(%):-%x} + + [[ -o KSH_ARRAYS ]] && __adote_ksh_arrays=1 && unsetopt KSH_ARRAYS + [[ -o SH_GLOB ]] && __adote_sh_glob=1 && unsetopt SH_GLOB + + local o_help o_version + zparseopts ${_adote_zparopt_flags} -- \ + h=o_help -help=h \ + v=o_version -version=v || + return 1 + + local ret=0 + + if (( ${#o_version} )); then + __antidote_version + + elif (( ${#o_help} )); then + antidote-help "$@" + + elif [[ ${#} -eq 0 ]]; then + antidote-help + ret=2 + + elif [[ "${1}" = help ]]; then + local manpage=${2:-antidote} + antidote-help $manpage + + elif (( $+functions[antidote-${1}] )); then + local cmd=${1}; shift + antidote-${cmd} "$@" + ret=$? + + else + print -ru2 "antidote: command not found '${1}'" + ret=1 + fi + + (( __adote_ksh_arrays )) && __adote_ksh_arrays=0 && setopt KSH_ARRAYS + (( __adote_sh_glob )) && __adote_sh_glob=0 && setopt SH_GLOB + return $ret +#} diff --git a/.antidote/functions/antidote-path b/.antidote/functions/antidote-path new file mode 100644 index 0000000..20b22a8 --- /dev/null +++ b/.antidote/functions/antidote-path @@ -0,0 +1,39 @@ +#!/bin/zsh + +### Print the path of a cloned bundle. +# +# usage: antidote path [-h|--help] +# +#function antidote-path { + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help + zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1 + + if (( $#o_help )); then + antidote-help path + return + fi + + local -a bundles=("${(@f)$(__antidote_collect_input "$@")}") + if (( $#bundles == 0 )); then + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" + return 1 + fi + + local bundle bundledir + local -a results=() + for bundle in $bundles; do + if [[ $bundle == '$'* ]] && [[ $bundle != *'('* ]] && [[ $bundle != *';'* ]]; then + bundle=$(eval print $bundle) + fi + bundledir=$(__antidote_bundle_dir $bundle) + if [[ ! -d $bundledir ]]; then + print -ru2 "antidote: error: $bundle does not exist in cloned paths" + return 1 + else + results+=("$bundledir") + fi + done + print -l -- $results +#} diff --git a/.antidote/functions/antidote-purge b/.antidote/functions/antidote-purge new file mode 100644 index 0000000..fe6942e --- /dev/null +++ b/.antidote/functions/antidote-purge @@ -0,0 +1,83 @@ +#!/bin/zsh + +### Remove a cloned bundle. +# +# usage: antidote purge [-h|--help] +# antidote purge [-a|--all] +# +#function antidote-purge { + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help o_all + zparseopts $_adote_zparopt_flags -- \ + h=o_help -help=h \ + a=o_all -all=a || + return 1 + + if (( $#o_help )); then + antidote-help purge + return + fi + + if [[ $# -eq 0 ]] && ! (( $#o_all )); then + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" + return 1 + fi + + local bundlefile + zstyle -s ':antidote:bundle' file 'bundlefile' || + bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt + + if (( $#o_all )); then + # last chance to save the user from themselves + local antidote_home="$(antidote-home)" + local REPLY + zstyle -s ':antidote:purge:all' answer 'REPLY' || { + read -q "REPLY?You are about to permanently remove '$antidote_home' and all its contents!"$'\n'"Are you sure [Y/n]? " + print + } + [[ ${REPLY:u} == "Y" ]] || return 1 + # remove antidote home and static cache file + __antidote_del -rf -- "$antidote_home" + + if [[ -e "${bundlefile:r}.zsh" ]]; then + zstyle -s ':antidote:purge:all' answer 'REPLY' || { + read -q "REPLY?You are about to remove '${bundlefile:t:r}.zsh'"$'\n'"Are you sure [Y/n]? " + print + } + if [[ ${REPLY:u} == "Y" ]]; then + local dtstmp=$(date -u '+%Y%m%d_%H%M%S') + command mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak" + print "'"${bundlefile:r}.zsh"' backed up to '${bundlefile:t:r}.${dtstmp}.bak'" + fi + fi + print "Antidote purge complete. Be sure to start a new Zsh session." + + else + local bundle=$1 + # make sure the user isn't trying to do something out-of-bounds + if [[ -e "$bundle" ]]; then + print -ru2 "antidote: error: '$bundle' is not a repo and cannot be removed by antidote." + return 2 + fi + + local bundledir=$(__antidote_bundle_dir $bundle) + if [[ ! -d "$bundledir" ]]; then + print -ru2 "antidote: error: $bundle does not exist at the expected location: $bundledir" + return 1 + fi + + # remove + __antidote_del -rf "$bundledir" + print "Removed '$bundle'." + + # attempt to comment out the bundle from .zsh_plugins.txt + if [[ -e "$bundlefile" ]]; then + local tmpfile="${bundlefile}.antidote.tmp" + $__adote_awkcmd -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile + command cat "$tmpfile" > "$bundlefile" + __antidote_del -f "$tmpfile" + print "Bundle '$bundle' was commented out in '$bundlefile'." + fi + fi +#} diff --git a/.antidote/functions/antidote-script b/.antidote/functions/antidote-script new file mode 100644 index 0000000..a9832c1 --- /dev/null +++ b/.antidote/functions/antidote-script @@ -0,0 +1,213 @@ +#!/bin/zsh + +### Generate the Zsh script to load a plugin. +# +# usage: antidote script [-h|--help] [-k|--kind ] [-p|--path ] +# [-c|--conditional ] [-b|--branch ] +# [--pre ] [--post ] +# [-a|--autoload ] +# : zsh,path,fpath,defer,clone,autoload +# : Relative path from the bundle root +# : The git branch +# : A bundle can be a directory, a zsh script, or a git repo +# + +### Generate the Zsh script to load a plugin. +#function antidote-script { + emulate -L zsh; setopt local_options $_adote_funcopts + local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global' + local REPLY= + + local o_help o_kind o_path o_branch o_cond o_autoload o_pre o_post o_fpath_rule + zparseopts $_adote_zparopt_flags -- \ + h=o_help -help=h \ + a:=o_autoload -autoload:=a \ + b:=o_branch -branch:=b \ + k:=o_kind -kind:=k \ + p:=o_path -path:=p \ + -pre:=o_pre \ + -post:=o_post \ + -fpath-rule:=o_fpath_rule \ + c:=o_cond -conditional:=c || + return 1 + + # set defaults + (( $#o_kind )) || o_kind=(--kind zsh) + if ! (( $#o_fpath_rule )); then + zstyle -a ':antidote:fpath' rule 'o_fpath_rule' || o_fpath_rule=(append) + fi + + # strip '=' or ':' from beginning of arg values + local re='^[=:]?(.+)$' + [[ $o_kind[-1] =~ $re ]] && o_kind[-1]=$match + [[ $o_autoload[-1] =~ $re ]] && o_autoload[-1]=$match + [[ $o_path[-1] =~ $re ]] && o_path[-1]=$match + [[ $o_cond[-1] =~ $re ]] && o_cond[-1]=$match + [[ $o_branch[-1] =~ $re ]] && o_branch[-1]=$match + [[ $o_pre[-1] =~ $re ]] && o_pre[-1]=$match + [[ $o_post[-1] =~ $re ]] && o_post[-1]=$match + [[ $o_fpath_rule[-1] =~ $re ]] && o_fpath_rule[-1]=$match + + local supported_kind_vals=(autoload clone defer fpath path zsh) + if (( $#o_kind )) && ! (( $supported_kind_vals[(Ie)$o_kind[-1]] )); then + print -ru2 "antidote: error: unexpected kind value: '$o_kind[-1]'" && return 1 + fi + + # If no fpath_rule is set, use the zstyle + if ! (( $#o_fpath_rule )); then + local zstyle_fpath_rule + zstyle -s ':antidote:fpath' rule 'zstyle_fpath_rule' + [[ -z "$zstyle_fpath_rule" ]] || o_fpath_rule=($zstyle_fpath_rule) + fi + + local supported_fpath_rules=(append prepend) + if ! (( $supported_fpath_rules[(Ie)$o_fpath_rule[-1]] )); then + print -ru2 "antidote: error: unexpected fpath rule: '$o_fpath_rule[-1]'" && return 1 + fi + + local bundle=$1 + if [[ -z "$bundle" ]]; then + print -ru2 "antidote: error: bundle argument expected" && return 1 + fi + local bundle_name=$(__antidote_bundle_name $bundle) + + # replace ~/ with $HOME/ + if [[ "$bundle" == '~/'* ]]; then + bundle=$HOME/${bundle#'~/'*} + fi + + # set the path to the bundle (repo or local) + local bundle_path + [[ -e "$bundle" ]] && bundle_path=$bundle || bundle_path=$(__antidote_bundle_dir $bundle) + + # handle cloning repo bundles + local bundle_type + bundle_type="$(__antidote_bundle_type $bundle)" + if [[ "$bundle_type" == (repo|url|sshurl) ]] && [[ ! -e "$bundle_path" ]]; then + local giturl=$(__antidote_tourl $bundle) + print -ru2 "# antidote cloning $bundle_name..." + git clone --quiet --depth 1 --recurse-submodules --shallow-submodules $o_branch $giturl $bundle_path + [[ $? -eq 0 ]] || return 1 + fi + + # if we only needed to clone the bundle, compile and we're done + if [[ "$o_kind[-1]" == "clone" ]]; then + if zstyle -t ":antidote:bundle:$bundle" zcompile; then + __antidote_bundle_zcompile $bundle_path + fi + return + fi + + # add path to bundle + [[ -n "$o_path[-1]" ]] && bundle_path+="/$o_path[-1]" + + # handle defer pre-reqs first + local dopts zsh_defer='zsh-defer' + zstyle -s ":antidote:bundle:${bundle}" defer-options 'dopts' + [[ -n "$dopts" ]] && zsh_defer="zsh-defer $dopts" + + # generate the script + local -a script=() + + # add pre-load function + (( $#o_pre )) && script+=("$o_pre[-1]") + + # handle defers + local source_cmd="source" + local zsh_defer_bundle + zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \ + || zsh_defer_bundle='romkatv/zsh-defer' + if [[ "$o_kind[-1]" == "defer" ]]; then + source_cmd="${zsh_defer} source" + script+=( + 'if ! (( $+functions[zsh-defer] )); then' + "$(antidote-script $zsh_defer_bundle | __antidote_indent)" + 'fi' + ) + fi + + # Let's make the path a little nicer to deal with + local print_bundle_path="$(__antidote_print_path "$bundle_path")" + + # handle autoloading before sourcing + if (( $#o_autoload )); then + if [[ "$o_fpath_rule[-1]" == prepend ]]; then + script+=("fpath=( ${print_bundle_path}/${o_autoload[-1]} \$fpath )") + script+=("builtin autoload -Uz \$fpath[1]/*(N.:t)") + else + script+=("fpath+=( ${print_bundle_path}/${o_autoload[-1]} )") + script+=("builtin autoload -Uz \$fpath[-1]/*(N.:t)") + fi + fi + + # generate load script + bundle_type="$(__antidote_bundle_type $bundle_path)" + local fpath_script + if [[ "$o_fpath_rule[-1]" == prepend ]]; then + fpath_script="fpath=( $print_bundle_path \$fpath )" + else + fpath_script="fpath+=( $print_bundle_path )" + fi + + if [[ "$o_kind[-1]" == fpath ]]; then + # fpath + script+="$fpath_script" + elif [[ "$o_kind[-1]" == path ]]; then + # path + script+="export PATH=\"$print_bundle_path:\$PATH\"" + elif [[ "$o_kind[-1]" == autoload ]]; then + # autoload + script+=("$fpath_script") + if [[ "$o_fpath_rule[-1]" == prepend ]]; then + script+=("builtin autoload -Uz \$fpath[1]/*(N.:t)") + else + script+=("builtin autoload -Uz \$fpath[-1]/*(N.:t)") + fi + else + if zstyle -t ":antidote:bundle:$bundle" zcompile; then + __antidote_bundle_zcompile $bundle_path + fi + if [[ $bundle_type == file ]]; then + script+="$source_cmd $print_bundle_path" + else + # directory/default + local initfile initfiles + initfiles=(${(@f)$(__antidote_initfiles $bundle_path)}) + # if no init file was found, assume the default + if [[ $#initfiles -eq 0 ]]; then + if (( $#o_path )); then + initfiles=($bundle_path/${bundle_path:t}.plugin.zsh) + else + initfiles=($bundle_path/${bundle_name:t}.plugin.zsh) + fi + fi + script+="$fpath_script" + local print_initfile + for initfile in $initfiles; do + print_initfile="$(__antidote_print_path "$initfile")" + script+="$source_cmd $print_initfile" + done + fi + fi + + # add post-load function + if (( $#o_post )); then + if [[ "$o_kind[-1]" == "defer" ]]; then + script+=("${zsh_defer} $o_post[-1]") + else + script+=("$o_post[-1]") + fi + fi + + # mark bundle as loaded + # script+="zstyle ':antidote:bundle:${bundle_name}' loaded yes" + + # wrap conditional + if [[ -n "$o_cond[-1]" ]]; then + print "if $o_cond[-1]; then" + printf " %s\n" $script + print "fi" + else + printf "%s\n" $script + fi +#} diff --git a/.antidote/functions/antidote-update b/.antidote/functions/antidote-update new file mode 100644 index 0000000..1de6c3f --- /dev/null +++ b/.antidote/functions/antidote-update @@ -0,0 +1,94 @@ +#!/bin/zsh + +### Update antidote and its cloned bundles. +# +# usage: antidote update [-h|--help] +# +#function antidote-update { + 0=${(%):-%x} + emulate -L zsh; setopt local_options $_adote_funcopts + + local o_help o_self o_bundles + zparseopts $_adote_zparopt_flags -- \ + h=o_help -help=h \ + s=o_self -self=s \ + b=o_bundles -bundles=b || + return 1 + + if (( $#o_help )); then + antidote-help update + return + fi + + # colors + local green normal + if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then + if (( $+commands[tput] )); then + green=$(tput setaf 2) + normal=$(tput sgr0) + else + green=$'\E[32m' + normal=$'\E[0m' + fi + fi + + if (( $#o_bundles )) || ! (( $#o_self )); then + print "Updating bundles..." + local bundledir url repo + + # remove zcompiled files + __antidote_del -rf -- $(antidote-home)/**/*.zwc(N) + + # remove check file + local loadable_check_path="$(antidote-home)/.antidote.load" + [[ -r "$loadable_check_path" ]] && __antidote_del -- "$loadable_check_path" + + # update all bundles + for bundledir in $(antidote-list --dirs); do + url=$(git -C "$bundledir" config remote.origin.url) + repo="${url:h:t}/${${url:t}%.git}" + print "antidote: checking for updates: $url" + () { + local oldsha=$(git -C "$1" rev-parse --short HEAD) + git -C "$1" pull --quiet --ff --rebase --autostash + git -C "$1" submodule --quiet sync --recursive + git -C "$1" submodule --quiet update --init --recursive --depth 1 + local newsha=$(git -C "$1" rev-parse --short HEAD) + if [[ $oldsha != $newsha ]]; then + print "${green}antidote: updated: $2 ${oldsha} -> ${newsha}${normal}" + git -C "$1" --no-pager log --oneline --ancestry-path ${oldsha}..${newsha} 2>/dev/null + fi + + # recompile bundles + if zstyle -t ":antidote:bundle:$repo" zcompile; then + __antidote_bundle_zcompile $bundledir + fi + } "$bundledir" "$url" & + done + print "Waiting for bundle updates to complete..." + print "" + wait + print "${green}Bundle updates complete.${normal}" + print "" + fi + + # update antidote + if (( $#o_self )) || ! (( $#o_bundles )); then + print "Updating antidote..." + if [[ -d "${0:A:h:h}/.git" ]]; then + git -C "${0:A:h:h}" pull --quiet --ff --rebase --autostash + print "antidote self-update complete.\n" + + # setup antidote again + (( $+functions[__antidote_setup] )) && unfunction __antidote_setup + builtin autoload -Uz ${0:A:h}/__antidote_setup + __antidote_setup + + # show antidote version + antidote -v + else + print "Self updating is disabled in this build." + print "Use your OS package manager to update antidote itself." + fi + fi +#} diff --git a/.antidote/makefile b/.antidote/makefile new file mode 100644 index 0000000..3a6dc6e --- /dev/null +++ b/.antidote/makefile @@ -0,0 +1,48 @@ +# Do not remove ##? comments. They are used by 'help' to construct the help docs. +##? antidote - the cure to slow zsh plugin management +##? +##? Usage: make " +##? +##? Commands: + +.DEFAULT_GOAL := help +all : build buildman test unittest bump-maj bump-min bump-rev help +.PHONY : all + +##? help display this makefile's help information +help: + @grep "^##?" makefile | cut -c 5- + +##? build run build tasks like generating man pages +build: + ./tools/buildman + ./tools/run-clitests + ./tools/bumpver revision + +##? buildman rebuild man pages +buildman: + ./tools/buildman + +##? test run tests +test: + ./tools/run-clitests + +##? unittest run only unittests +unittest: + ./tools/run-clitests --unit + +##? bump-maj bump the major version (X.0.0) +bump-maj: + ./tools/bumpver major + +##? bump-min bump the minor version (0.X.0) +bump-min: + ./tools/bumpver minor + +##? bump-rev bump the revision version (0.0.X) +bump-rev: + ./tools/bumpver revision + +##? bumpver bump the revision version (0.0.X) +bumpver: + ./tools/bumpver revision diff --git a/.antidote/man/antidote-bundle.md b/.antidote/man/antidote-bundle.md new file mode 100644 index 0000000..2e27fa5 --- /dev/null +++ b/.antidote/man/antidote-bundle.md @@ -0,0 +1,102 @@ +--- +title: antidote-bundle +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote bundle** - download a bundle and print its source line + +# SYNOPSIS + +| antidote bundle [\...] + +# DESCRIPTION + +**antidote-bundle** assembles your Zsh plugins. Bundles can be git repos, or local files or directories. If a plugin is a repo, it will be cloned if necessary. The zsh code necessary to load (source) the plugin is then printed. + +| antidote bundle gituser/gitrepo +| antidote bundle $ZSH_CUSTOM/plugins/myplugin +| antidote bundle ${ZDOTDIR:-\$HOME}/.zlibs/myfile.zsh + +Bundles also support annotations. Annotations allow you have finer grained control over your plugins. Annotations are used in the form \'keyword:value\'. + +`kind` +: - **zsh**: A zsh plugin. This is the default kind of bundle. +: - **fpath**: Only add the plugin to your _\$fpath_. +: - **path**: Add the plugin to your _\$PATH_. +: - **clone**: Only clone a plugin, but don't do anything else with it. +: - **defer**: Defers loading of a plugin using \'romkatv/zsh-defer\'. +: - **autoload**: Autoload all the files in the plugin directory as zsh functions. + +`branch` +: The branch annotation allows you to change the default branch of a plugin's repo from **main** to a branch of your choosing. + +`path` +: The path annotation allows you to use a subdirectory or file within a plugin's structure instead of the root plugin (eg: \'path:plugins/subplugin\'). + +`conditional` +: The conditonal annotation allows you to wrap an **if** statement around a plugin's load script. Supply the name of a zero argument zsh function to conditional to perform the test (eg: \'conditional:is-macos\'). + +`pre` / `post` +: The pre and post annotations allow you to call a function before or after a plugin's load script. This is helpful when configuring plugins, since the configuration functions will only run for active plugins. Supply the name of a zero argument zsh function to pre or post. + +`autoload` +: The autoload annotation allows you to autoload a zsh functions directory in addition to however the plugin was loaded as specified by \'kind\'. Supply a relative path to autoload (eg: \'autoload:functions\'). + +Cloned repo directory names can be overridden with the following **zstyle**: + +| zstyle \':antidote:bundle\' use-friendly-names \'yes\' + +# OPTIONS + +-h, \--help +: Show the help documentation. + +[*\...*] +: Zsh plugin bundles + +# EXAMPLES + +Using the **kind:** annotation... + +| # a regular plugin (kind:zsh is implied, so it's unnecessary) +| antidote bundle zsh-users/zsh-history-substring-search kind:zsh + +| # add prompt plugins to $fpath +| antidote bundle sindresorhus/pure kind:fpath + +| # add utility plugins to $PATH +| antidote bundle romkatv/zsh-bench kind:path + +| # clone a repo for use in other ways +| antidote bundle mbadolato/iTerm2-Color-Schemes kind:clone + +| # autoload a functions directory +| antidote bundle sorin-ionescu/prezto path:modules/utility/functions kind:autoload + +| # defer a plugin to speed up load times +| antidote bundle olets/zsh-abbr kind:defer + +Using the **branch:** annotation... + +| # don't use the main branch, use develop instead +| antidote bundle zsh-users/zsh-autosuggestions branch:develop + +Using the **path:** annotation... + +| # load oh-my-zsh +| antidote bundle ohmyzsh/ohmyzsh path:lib +| antidote bundle ohmyzsh/ohmyzsh path:plugins/git + +Using the **conditional:** annotation... + +| # define a conditional function prior to loading antidote +| function is_macos { +| [[ $OSTYPE == darwin* ]] || return 1 +| } +| +| # conditionally load a plugin using the function you made +| antidote bundle ohmyzsh/ohmyzsh path:plugins/macos conditional:is_macos + diff --git a/.antidote/man/antidote-help.md b/.antidote/man/antidote-help.md new file mode 100644 index 0000000..750428a --- /dev/null +++ b/.antidote/man/antidote-help.md @@ -0,0 +1,25 @@ +--- +title: antidote-help +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote help** - show antidote documentation + +# SYNOPSIS + +| antidote help [\] + +# DESCRIPTION + +**antidote-help** is used to show context-sensitive help for antidote and its commands. + +# OPTIONS + +-h, \--help +: Inception-style meta-help recursively. + +[*\*] +: Show help for a specific command. diff --git a/.antidote/man/antidote-home.md b/.antidote/man/antidote-home.md new file mode 100644 index 0000000..a24d9a8 --- /dev/null +++ b/.antidote/man/antidote-home.md @@ -0,0 +1,32 @@ +--- +title: antidote-home +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote home** - print where antidote is cloning bundles + +# SYNOPSIS + +| antidote home + +# DESCRIPTION + +**antidote-home** shows you where antidote stores its cloned repos. It is not the home of the antidote utility itself. + +| antidote home + +You can override antidote's default home directory by setting the _\$ANTIDOTE_HOME_ variable in your **.zshrc**. + +# OPTIONS + +-h, \--help +: Show the help documentation. + +# EXAMPLES + +You can clear out all your cloned repos like so: + +| rm -rfi $(antidote home) diff --git a/.antidote/man/antidote-init.md b/.antidote/man/antidote-init.md new file mode 100644 index 0000000..a018612 --- /dev/null +++ b/.antidote/man/antidote-init.md @@ -0,0 +1,28 @@ +--- +title: antidote-init +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote init** - initialize the shell for dynamic bundles + +# SYNOPSIS + +| source <(antidote init) + +# DESCRIPTION + +**antidote-init** changes how the **antidote** command works by causing **antidote bundle** to automatically source its own output instead of just generating the Zsh script for a static file. + +This behavior exists mainly to support legacy antigen/antibody usage. Static bundling is highly recommended for the best performance. However, dynamic bundling may be preferable for some scenarios, so you can rely on this functionality remaining a key feature in **antidote** to support users preferring dynamic bundles. + +Typical usage involves adding this snippet to your **.zshrc** before using **antidote bundle** commands: + +| source <(antidote init) + +# OPTIONS + +-h, \--help +: Show the help documentation. diff --git a/.antidote/man/antidote-install.md b/.antidote/man/antidote-install.md new file mode 100644 index 0000000..381a1cb --- /dev/null +++ b/.antidote/man/antidote-install.md @@ -0,0 +1,60 @@ +--- +title: antidote-install +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote install** - install a bundle + +# SYNOPSIS + +| antidote install [-h|\--help] [-k|\--kind \] [-p|\--path \] +| [-a|\--autoload \] [-c|\--conditional \] +| [\--pre \] [\--post \] +| [-b|\--branch \] \ [\] + +# DESCRIPTION + +**antidote-install** clones a new bundle and adds it to your plugins file. + +The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**: + +| zstyle \':antidote:bundle\' file /path/to/my/bundle_file.txt + +# OPTIONS + +-h, \--help +: Show the help documentation. + +-k, \--kind +: The kind of bundle. Valid values: autoload, fpath, path, clone, defer, zsh. + +-p, \--path +: A relative subpath within the bundle where the plugin is located. + +-b, \--branch +: The git branch to use. + +-a, \--autoload +: A relative subpath within the bundle where autoload function files are located. + +-c, \--conditional +: A conditional function used to check whether to load the bundle. + +\--pre +: A function to be called prior to loading the bundle. + +\--post +: A function to be called after loading the bundle. + +\ +: Bundle to be installed. + +[\] +: Bundle file to write to if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting. + +# EXAMPLES + +| antidote install zsh-users/zsh-history-substring-search diff --git a/.antidote/man/antidote-list.md b/.antidote/man/antidote-list.md new file mode 100644 index 0000000..cbacad4 --- /dev/null +++ b/.antidote/man/antidote-list.md @@ -0,0 +1,31 @@ +--- +title: antidote-list +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote list** - list cloned bundles + +# SYNOPSIS + +| antidote list [-h|\--help] [-s|\--short] [-d|\--dirs] [-u|\--url] + +# DESCRIPTION + +**antidote-list** lists the cloned bundles in **antidote home**. + +# OPTIONS + +-h, \--help +: Show the help documentation. + +-s, \--short +: Show shortened repos where possible. + +-d, \--dirs +: Show only bundle directories. + +-u, \--url +: Show bundle URLs. diff --git a/.antidote/man/antidote-load.md b/.antidote/man/antidote-load.md new file mode 100644 index 0000000..8f53ade --- /dev/null +++ b/.antidote/man/antidote-load.md @@ -0,0 +1,36 @@ +--- +title: antidote-load +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote load** - statically source bundles + +# SYNOPSIS + +| antidote load [\ [\]] + +# DESCRIPTION + +**antidote-load** will turn the bundle file into a static load file and then source it. + +The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**: + +| zstyle \':antidote:bundle\' file /path/to/my/bundle_file.txt + +The default static file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh**. This can be overridden with the following **zstyle**: + +| zstyle \':antidote:static\' file /path/to/my/static_file.zsh + +# OPTIONS + +-h, \--help +: Show the help documentation. + +[\] +: The plugins file to source if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting. + +[\] +: The static plugins file to generate if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh** or zstyle setting. diff --git a/.antidote/man/antidote-path.md b/.antidote/man/antidote-path.md new file mode 100644 index 0000000..5dfad67 --- /dev/null +++ b/.antidote/man/antidote-path.md @@ -0,0 +1,25 @@ +--- +title: antidote-path +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote path** - print the path of a cloned bundle + +# SYNOPSIS + +| antidote path \ + +# DESCRIPTION + +**antidote-path** prints the path of a cloned bundle. + +# OPTIONS + +-h, \--help +: Show the help documentation. + +[\] +: The bundle whose cloned path will be printed. diff --git a/.antidote/man/antidote-purge.md b/.antidote/man/antidote-purge.md new file mode 100644 index 0000000..384bdea --- /dev/null +++ b/.antidote/man/antidote-purge.md @@ -0,0 +1,32 @@ +--- +title: antidote-purge +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote purge** - remove a bundle + +# SYNOPSIS + +| antidote purge \ + +# DESCRIPTION + +**antidote-purge** removes a cloned bundle. + +# OPTIONS + +-h, \--help +: Show the help documentation. + +-a, \--all +: Purge all cloned bundles. + +\ +: Bundle to be purged. + +# EXAMPLES + +| antidote purge zsh-users/zsh-history-substring-search diff --git a/.antidote/man/antidote-update.md b/.antidote/man/antidote-update.md new file mode 100644 index 0000000..90ebc00 --- /dev/null +++ b/.antidote/man/antidote-update.md @@ -0,0 +1,32 @@ +--- +title: antidote-update +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote update** - update bundles + +# SYNOPSIS + +| antidote update [-h|\--help] [-s|\--self] [-b|\--bundles] + +# DESCRIPTION + +**antidote-update** updates antidote and its cloned bundles. + +# OPTIONS + +-h, \--help +: Show the help documentation. + +-s, \--self +: Update antidote. + +-b, \--bundles +: Update bundles. + +# EXAMPLES + +| antidote update diff --git a/.antidote/man/antidote.md b/.antidote/man/antidote.md new file mode 100644 index 0000000..af547df --- /dev/null +++ b/.antidote/man/antidote.md @@ -0,0 +1,174 @@ +--- +title: antidote +section: 1 +header: Antidote Manual +--- + +# NAME + +**antidote** - the cure to slow zsh plugin management + +# SYNOPSIS + +| antidote [-v | --version] [-h | --help] \ [\ ...] + +# DESCRIPTION + +**antidote** is a Zsh plugin manager made from the ground up thinking about performance. + +It is fast because it can do things concurrently, and generates an ultra-fast static plugin file that you can easily load from your Zsh config. + +It is written natively in Zsh, is well tested, and picks up where Antigen and Antibody left off. + +# OPTIONS + +-h, \--help +: Show context-sensitive help for antidote. + +-v, \--version +: Show currently installed antidote version. + +# COMMANDS + +`help` +: Show documentation + +`load` +: Statically source all bundles from the plugins file + +`bundle` +: Clone bundle(s) and generate the static load script + +`install` +: Clone a new bundle and add it to your plugins file + +`update` +: Update antidote and its cloned bundles + +`purge` +: Remove a cloned bundle + +`home` +: Print where antidote is cloning bundles + +`list` +: List cloned bundles + +`path` +: Print the path of a cloned bundle + +`init` +: Initialize the shell for dynamic bundles + +# EXAMPLES + +## A Simple Config + +Create a _.zsh_plugins.txt_ file with a list of the plugins you want: + +| # ${ZDOTDIR:-\$HOME}/.zsh_plugins.txt +| zsh-users/zsh-syntax-highlighting +| zsh-users/zsh-history-substring-search +| zsh-users/zsh-autosuggestions + +Now, simply load your newly created static plugins file in your _.zshrc_. + +| # ${ZDOTDIR:-\$HOME}/.zshrc +| source /path/to/antidote/antidote.zsh +| antidote load + +## A More Advanced Config + +Your _.zsh_plugins.txt_ file supports annotations. Annotations tell antidote how to do things like load plugins from alternate paths. This lets you use plugins from popular frameworks like Oh-My-Zsh: + +| # ${ZDOTDIR:-\$HOME}/.zsh_plugins.txt +| ohmyzsh/ohmyzsh path:lib +| ohmyzsh/ohmyzsh path:plugins/git +| ohmyzsh/ohmyzsh path:plugins/magic-enter +| etc... + +## Dynamic Bundling + +Users familiar with legacy plugin managers like Antigen might prefer to use dynamic bundling. With dynamic bundling you sacrifice some performance to avoid having separate plugin files. To use dynamic bundling, we need to change how **antidote bundle** handles your plugins. We do this by sourcing the output from **antidote init**. + +An example config might look like this: + +| source /path/to/antidote/antidote.zsh +| source <(antidote init) +| antidote bundle zsh-users/zsh-autosuggestions +| antidote bundle ohmyzsh/ohmyzsh path:lib +| antidote bundle ohmyzsh/ohmyzsh path:plugins/git + +Instead of calling **antidote bundle** over and over, you might prefer to load bundles with a HEREDOC. + +| source /path/to/antidote/antidote.zsh +| source <(antidote init) +| antidote bundle <\&...] +.SH DESCRIPTION +\f[B]antidote\-bundle\f[R] assembles your Zsh plugins. +Bundles can be git repos, or local files or directories. +If a plugin is a repo, it will be cloned if necessary. +The zsh code necessary to load (source) the plugin is then printed. +.PP +\ \ antidote bundle gituser/gitrepo +.PD 0 +.P +.PD +\ \ antidote bundle $ZSH_CUSTOM/plugins/myplugin +.PD 0 +.P +.PD +\ \ antidote bundle ${ZDOTDIR:\-$HOME}/.zlibs/myfile.zsh +.PP +Bundles also support annotations. +Annotations allow you have finer grained control over your plugins. +Annotations are used in the form \[aq]keyword:value\[aq]. +.TP +\f[CR]kind\f[R] +.IP \[bu] 2 +\f[B]zsh\f[R]: A zsh plugin. +This is the default kind of bundle. +.IP \[bu] 2 +\f[B]fpath\f[R]: Only add the plugin to your \f[I]$fpath\f[R]. +.IP \[bu] 2 +\f[B]path\f[R]: Add the plugin to your \f[I]$PATH\f[R]. +.IP \[bu] 2 +\f[B]clone\f[R]: Only clone a plugin, but don\[cq]t do anything else +with it. +.IP \[bu] 2 +\f[B]defer\f[R]: Defers loading of a plugin using +\[aq]romkatv/zsh\-defer\[aq]. +.IP \[bu] 2 +\f[B]autoload\f[R]: Autoload all the files in the plugin directory as +zsh functions. +.TP +\f[CR]branch\f[R] +The branch annotation allows you to change the default branch of a +plugin\[cq]s repo from \f[B]main\f[R] to a branch of your choosing. +.TP +\f[CR]path\f[R] +The path annotation allows you to use a subdirectory or file within a +plugin\[cq]s structure instead of the root plugin (eg: +\[aq]path:plugins/subplugin\[aq]). +.TP +\f[CR]conditional\f[R] +The conditonal annotation allows you to wrap an \f[B]if\f[R] statement +around a plugin\[cq]s load script. +Supply the name of a zero argument zsh function to conditional to +perform the test (eg: \[aq]conditional:is\-macos\[aq]). +.TP +\f[CR]pre\f[R] / \f[CR]post\f[R] +The pre and post annotations allow you to call a function before or +after a plugin\[cq]s load script. +This is helpful when configuring plugins, since the configuration +functions will only run for active plugins. +Supply the name of a zero argument zsh function to pre or post. +.TP +\f[CR]autoload\f[R] +The autoload annotation allows you to autoload a zsh functions directory +in addition to however the plugin was loaded as specified by +\[aq]kind\[aq]. +Supply a relative path to autoload (eg: \[aq]autoload:functions\[aq]). +.PP +Cloned repo directory names can be overridden with the following +\f[B]zstyle\f[R]: +.PP +\ \ zstyle \[aq]:antidote:bundle\[aq] use\-friendly\-names \[aq]yes\[aq] +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +[\f[I]\&...\f[R]] +Zsh plugin bundles +.SH EXAMPLES +Using the \f[B]kind:\f[R] annotation\&... +.PP +\ \ # a regular plugin (kind:zsh is implied, so it\[cq]s unnecessary) +.PD 0 +.P +.PD +\ \ antidote bundle zsh\-users/zsh\-history\-substring\-search kind:zsh +.PP +\ \ # add prompt plugins to $fpath +.PD 0 +.P +.PD +\ \ antidote bundle sindresorhus/pure kind:fpath +.PP +\ \ # add utility plugins to $PATH +.PD 0 +.P +.PD +\ \ antidote bundle romkatv/zsh\-bench kind:path +.PP +\ \ # clone a repo for use in other ways +.PD 0 +.P +.PD +\ \ antidote bundle mbadolato/iTerm2\-Color\-Schemes kind:clone +.PP +\ \ # autoload a functions directory +.PD 0 +.P +.PD +\ \ antidote bundle sorin\-ionescu/prezto path:modules/utility/functions +kind:autoload +.PP +\ \ # defer a plugin to speed up load times +.PD 0 +.P +.PD +\ \ antidote bundle olets/zsh\-abbr kind:defer +.PP +Using the \f[B]branch:\f[R] annotation\&... +.PP +\ \ # don\[cq]t use the main branch, use develop instead +.PD 0 +.P +.PD +\ \ antidote bundle zsh\-users/zsh\-autosuggestions branch:develop +.PP +Using the \f[B]path:\f[R] annotation\&... +.PP +\ \ # load oh\-my\-zsh +.PD 0 +.P +.PD +\ \ antidote bundle ohmyzsh/ohmyzsh path:lib +.PD 0 +.P +.PD +\ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/git +.PP +Using the \f[B]conditional:\f[R] annotation\&... +.PP +\ \ # define a conditional function prior to loading antidote +.PD 0 +.P +.PD +\ \ function is_macos { +.PD 0 +.P +.PD +\ \ \ \ [[ $OSTYPE == darwin* ]] || return 1 +.PD 0 +.P +.PD +\ \ } +.PD 0 +.P +.PD +.PD 0 +.P +.PD +\ \ # conditionally load a plugin using the function you made +.PD 0 +.P +.PD +\ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/macos +conditional:is_macos +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-help.1 b/.antidote/man/man1/antidote-help.1 new file mode 100644 index 0000000..e384564 --- /dev/null +++ b/.antidote/man/man1/antidote-help.1 @@ -0,0 +1,31 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-help" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote help\f[R] \- show antidote documentation +.SH SYNOPSIS +.PP +antidote help [] +.SH DESCRIPTION +\f[B]antidote\-help\f[R] is used to show context\-sensitive help for +antidote and its commands. +.SH OPTIONS +.TP +\-h, \-\-help +Inception\-style meta\-help recursively. +.TP +[\f[I]\f[R]] +Show help for a specific command. +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-home.1 b/.antidote/man/man1/antidote-home.1 new file mode 100644 index 0000000..a43d8cc --- /dev/null +++ b/.antidote/man/man1/antidote-home.1 @@ -0,0 +1,38 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-home" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote home\f[R] \- print where antidote is cloning bundles +.SH SYNOPSIS +.PP +antidote home +.SH DESCRIPTION +\f[B]antidote\-home\f[R] shows you where antidote stores its cloned +repos. +It is not the home of the antidote utility itself. +.PP +\ \ antidote home +.PP +You can override antidote\[cq]s default home directory by setting the +\f[I]$ANTIDOTE_HOME\f[R] variable in your \f[B].zshrc\f[R]. +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.SH EXAMPLES +You can clear out all your cloned repos like so: +.PP +\ \ rm \-rfi $(antidote home) +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-init.1 b/.antidote/man/man1/antidote-init.1 new file mode 100644 index 0000000..496a0c0 --- /dev/null +++ b/.antidote/man/man1/antidote-init.1 @@ -0,0 +1,40 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-init" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote init\f[R] \- initialize the shell for dynamic bundles +.SH SYNOPSIS +.PP +source <(antidote init) +.SH DESCRIPTION +\f[B]antidote\-init\f[R] changes how the \f[B]antidote\f[R] command +works by causing \f[B]antidote bundle\f[R] to automatically source its +own output instead of just generating the Zsh script for a static file. +.PP +This behavior exists mainly to support legacy antigen/antibody usage. +Static bundling is highly recommended for the best performance. +However, dynamic bundling may be preferable for some scenarios, so you +can rely on this functionality remaining a key feature in +\f[B]antidote\f[R] to support users preferring dynamic bundles. +.PP +Typical usage involves adding this snippet to your \f[B].zshrc\f[R] +before using \f[B]antidote bundle\f[R] commands: +.PP +\ source <(antidote init) +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-install.1 b/.antidote/man/man1/antidote-install.1 new file mode 100644 index 0000000..c6fc8b9 --- /dev/null +++ b/.antidote/man/man1/antidote-install.1 @@ -0,0 +1,83 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-install" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote install\f[R] \- install a bundle +.SH SYNOPSIS +.PP +antidote install [\-h|\-\-help] [\-k|\-\-kind ] [\-p|\-\-path +] +.PD 0 +.P +.PD +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-a|\-\-autoload ] +[\-c|\-\-conditional ] +.PD 0 +.P +.PD +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-\-pre ] [\-\-post ] +.PD 0 +.P +.PD +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-b|\-\-branch ] +[] +.SH DESCRIPTION +\f[B]antidote\-install\f[R] clones a new bundle and adds it to your +plugins file. +.PP +The default bundle file is +\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R]. +This can be overridden with the following \f[B]zstyle\f[R]: +.PP +\ \ zstyle \[aq]:antidote:bundle\[aq] file /path/to/my/bundle_file.txt +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +\-k, \-\-kind +The kind of bundle. +Valid values: autoload, fpath, path, clone, defer, zsh. +.TP +\-p, \-\-path +A relative subpath within the bundle where the plugin is located. +.TP +\-b, \-\-branch +The git branch to use. +.TP +\-a, \-\-autoload +A relative subpath within the bundle where autoload function files are +located. +.TP +\-c, \-\-conditional +A conditional function used to check whether to load the bundle. +.TP +\-\-pre +A function to be called prior to loading the bundle. +.TP +\-\-post +A function to be called after loading the bundle. +.TP + +Bundle to be installed. +.TP +[] +Bundle file to write to if not using the default. +Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R] or zstyle +setting. +.SH EXAMPLES +.PP +\ \ antidote install zsh\-users/zsh\-history\-substring\-search +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-list.1 b/.antidote/man/man1/antidote-list.1 new file mode 100644 index 0000000..eba1ea9 --- /dev/null +++ b/.antidote/man/man1/antidote-list.1 @@ -0,0 +1,38 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-list" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote list\f[R] \- list cloned bundles +.SH SYNOPSIS +.PP +antidote list [\-h|\-\-help] [\-s|\-\-short] [\-d|\-\-dirs] +[\-u|\-\-url] +.SH DESCRIPTION +\f[B]antidote\-list\f[R] lists the cloned bundles in \f[B]antidote +home\f[R]. +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +\-s, \-\-short +Show shortened repos where possible. +.TP +\-d, \-\-dirs +Show only bundle directories. +.TP +\-u, \-\-url +Show bundle URLs. +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-load.1 b/.antidote/man/man1/antidote-load.1 new file mode 100644 index 0000000..b2bc9ae --- /dev/null +++ b/.antidote/man/man1/antidote-load.1 @@ -0,0 +1,50 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-load" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote load\f[R] \- statically source bundles +.SH SYNOPSIS +.PP +antidote load [ []] +.SH DESCRIPTION +\f[B]antidote\-load\f[R] will turn the bundle file into a static load +file and then source it. +.PP +The default bundle file is +\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R]. +This can be overridden with the following \f[B]zstyle\f[R]: +.PP +\ \ zstyle \[aq]:antidote:bundle\[aq] file /path/to/my/bundle_file.txt +.PP +The default static file is +\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.zsh\f[R]. +This can be overridden with the following \f[B]zstyle\f[R]: +.PP +\ \ zstyle \[aq]:antidote:static\[aq] file /path/to/my/static_file.zsh +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +[] +The plugins file to source if not using the default. +Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R] or zstyle +setting. +.TP +[] +The static plugins file to generate if not using the default. +Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.zsh\f[R] or zstyle +setting. +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-path.1 b/.antidote/man/man1/antidote-path.1 new file mode 100644 index 0000000..fa9b812 --- /dev/null +++ b/.antidote/man/man1/antidote-path.1 @@ -0,0 +1,30 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-path" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote path\f[R] \- print the path of a cloned bundle +.SH SYNOPSIS +.PP +antidote path +.SH DESCRIPTION +\f[B]antidote\-path\f[R] prints the path of a cloned bundle. +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +[] +The bundle whose cloned path will be printed. +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-purge.1 b/.antidote/man/man1/antidote-purge.1 new file mode 100644 index 0000000..b3c9d04 --- /dev/null +++ b/.antidote/man/man1/antidote-purge.1 @@ -0,0 +1,36 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-purge" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote purge\f[R] \- remove a bundle +.SH SYNOPSIS +.PP +antidote purge +.SH DESCRIPTION +\f[B]antidote\-purge\f[R] removes a cloned bundle. +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +\-a, \-\-all +Purge all cloned bundles. +.TP + +Bundle to be purged. +.SH EXAMPLES +.PP +\ \ antidote purge zsh\-users/zsh\-history\-substring\-search +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote-update.1 b/.antidote/man/man1/antidote-update.1 new file mode 100644 index 0000000..03f14ed --- /dev/null +++ b/.antidote/man/man1/antidote-update.1 @@ -0,0 +1,36 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote\-update" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote update\f[R] \- update bundles +.SH SYNOPSIS +.PP +antidote update [\-h|\-\-help] [\-s|\-\-self] [\-b|\-\-bundles] +.SH DESCRIPTION +\f[B]antidote\-update\f[R] updates antidote and its cloned bundles. +.SH OPTIONS +.TP +\-h, \-\-help +Show the help documentation. +.TP +\-s, \-\-self +Update antidote. +.TP +\-b, \-\-bundles +Update bundles. +.SH EXAMPLES +.PP +antidote update +.SH BUGS +See GitHub Issues: \c +.UR https://github.com/mattmc3/antidote/issues +.UE \c +.SH AUTHORS +.IP \[bu] 2 +Copyright (c) 2021\-2024 Matt McElheny +.IP \[bu] 2 +antidote contributors: \c +.UR https://github.com/mattmc3/antidote/graphs/contributors +.UE \c +.SH LICENSE +MIT diff --git a/.antidote/man/man1/antidote.1 b/.antidote/man/man1/antidote.1 new file mode 100644 index 0000000..df9179d --- /dev/null +++ b/.antidote/man/man1/antidote.1 @@ -0,0 +1,265 @@ +.\" Automatically generated by Pandoc +.\" +.TH "antidote" "1" "" "" "Antidote Manual" +.SH NAME +\f[B]antidote\f[R] \- the cure to slow zsh plugin management +.SH SYNOPSIS +.PP +antidote [\-v | \[en]version] [\-h | \[en]help] [ \&...] +.SH DESCRIPTION +\f[B]antidote\f[R] is a Zsh plugin manager made from the ground up +thinking about performance. +.PP +It is fast because it can do things concurrently, and generates an +ultra\-fast static plugin file that you can easily load from your Zsh +config. +.PP +It is written natively in Zsh, is well tested, and picks up where +Antigen and Antibody left off. +.SH OPTIONS +.TP +\-h, \-\-help +Show context\-sensitive help for antidote. +.TP +\-v, \-\-version +Show currently installed antidote version. +.SH COMMANDS +.TP +\f[CR]help\f[R] +Show documentation +.TP +\f[CR]load\f[R] +Statically source all bundles from the plugins file +.TP +\f[CR]bundle\f[R] +Clone bundle(s) and generate the static load script +.TP +\f[CR]install\f[R] +Clone a new bundle and add it to your plugins file +.TP +\f[CR]update\f[R] +Update antidote and its cloned bundles +.TP +\f[CR]purge\f[R] +Remove a cloned bundle +.TP +\f[CR]home\f[R] +Print where antidote is cloning bundles +.TP +\f[CR]list\f[R] +List cloned bundles +.TP +\f[CR]path\f[R] +Print the path of a cloned bundle +.TP +\f[CR]init\f[R] +Initialize the shell for dynamic bundles +.SH EXAMPLES +.SS A Simple Config +Create a \f[I].zsh_plugins.txt\f[R] file with a list of the plugins you +want: +.PP +\ \ \ # ${ZDOTDIR:\-$HOME}/.zsh_plugins.txt +.PD 0 +.P +.PD +\ \ \ zsh\-users/zsh\-syntax\-highlighting +.PD 0 +.P +.PD +\ \ \ zsh\-users/zsh\-history\-substring\-search +.PD 0 +.P +.PD +\ \ \ zsh\-users/zsh\-autosuggestions +.PP +Now, simply load your newly created static plugins file in your +\f[I].zshrc\f[R]. +.PP +\ \ \ # ${ZDOTDIR:\-$HOME}/.zshrc +.PD 0 +.P +.PD +\ \ \ source /path/to/antidote/antidote.zsh +.PD 0 +.P +.PD +\ \ \ antidote load +.SS A More Advanced Config +Your \f[I].zsh_plugins.txt\f[R] file supports annotations. +Annotations tell antidote how to do things like load plugins from +alternate paths. +This lets you use plugins from popular frameworks like Oh\-My\-Zsh: +.PP +\ \ \ # ${ZDOTDIR:\-$HOME}/.zsh_plugins.txt +.PD 0 +.P +.PD +\ \ \ ohmyzsh/ohmyzsh path:lib +.PD 0 +.P +.PD +\ \ \ ohmyzsh/ohmyzsh path:plugins/git +.PD 0 +.P +.PD +\ \ \ ohmyzsh/ohmyzsh path:plugins/magic\-enter +.PD 0 +.P +.PD +\ \ \ etc\&... +.SS Dynamic Bundling +Users familiar with legacy plugin managers like Antigen might prefer to +use dynamic bundling. +With dynamic bundling you sacrifice some performance to avoid having +separate plugin files. +To use dynamic bundling, we need to change how \f[B]antidote bundle\f[R] +handles your plugins. +We do this by sourcing the output from \f[B]antidote init\f[R]. +.PP +An example config might look like this: +.PP +\ \ \ source /path/to/antidote/antidote.zsh +.PD 0 +.P +.PD +\ \ \ source <(antidote init) +.PD 0 +.P +.PD +\ \ \ antidote bundle zsh\-users/zsh\-autosuggestions +.PD 0 +.P +.PD +\ \ \ antidote bundle ohmyzsh/ohmyzsh path:lib +.PD 0 +.P +.PD +\ \ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/git +.PP +Instead of calling \f[B]antidote bundle\f[R] over and over, you might +prefer to load bundles with a HEREDOC. +.PP +\ \ \ source /path/to/antidote/antidote.zsh +.PD 0 +.P +.PD +\ \ \ source <(antidote init) +.PD 0 +.P +.PD +\ \ \ antidote bundle <] [ ...] + +flags: + -h, --help Show context-sensitive help + -v, --version Show application version + +commands: + help Show documentation + load Statically source all bundles from the plugins file + bundle Clone bundle(s) and generate the static load script + install Clone a new bundle and add it to your plugins file + update Update antidote and its cloned bundles + purge Remove a cloned bundle + home Print where antidote is cloning bundles + list List cloned bundles + path Print the path of a cloned bundle + init Initialize the shell for dynamic bundles +% +``` + +## Version + +The `-v/--version` flag displays the current version: + +```zsh +% antidote --version +antidote version 1.9.7 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/_setup.zsh b/.antidote/tests/_setup.zsh new file mode 100644 index 0000000..fc0bed7 --- /dev/null +++ b/.antidote/tests/_setup.zsh @@ -0,0 +1,4 @@ +# autoload test functions +0=${(%):-%N} +autoload -U ${0:A:h}/functions/t_setup +t_setup diff --git a/.antidote/tests/functions/mockgit b/.antidote/tests/functions/mockgit new file mode 100644 index 0000000..b880388 --- /dev/null +++ b/.antidote/tests/functions/mockgit @@ -0,0 +1,70 @@ +#!/bin/zsh +#function mockgit { + # handle these commands: + # - `git -C "$dir" config remote.origin.url` + # - `git -C "$dir" pull --quiet --ff --rebase --autostash` + # - `git -C "$dir" rev-parse --short HEAD` + # - `git clone --quiet --depth 1 --recurse-submodules --shallow-submodules --branch branch $url $dir` + # - `git --version` + emulate -L zsh; setopt local_options extended_glob + local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global' + 0=${(%):-%x} + + local args=("$@[@]") + local o_path o_quiet o_ff o_rebase o_autostash o_short + local o_depth o_recurse_submodules o_shallow_submodules o_branch + local o_init o_recursive + zparseopts -D -E -- \ + C:=o_path \ + -short=o_short \ + -quiet=o_quiet \ + -ff=o_ff \ + -rebase=o_rebase \ + -autostash=o_autostash \ + -recurse-submodules=o_recurse_submodules \ + -shallow-submodules=o_shallow_submodules \ + -depth:=o_depth \ + -branch:=o_branch \ + -init=o_init \ + -recursive=o_recursive || + return 1 + + if [[ "$@" = "--version" ]]; then + echo "0.0.0" + elif [[ "$1" = "clone" ]]; then + local giturl="$2" + local bundledir="$3" + local src="$ANTIDOTE_HOME/${bundledir:t}" + if [[ -d $src ]]; then + cp -r $src ${bundledir:h} + elif ! (( $#o_quiet )); then + echo "MOCKGIT: Cloning into '${url:t}'..." + echo "MOCKGIT: Repository not found." + echo "MOCKGIT: repository '$url' not found" + fi + elif [[ "$@" = "config remote.origin.url" ]]; then + if [[ -e $bundledir/.git/config/remote.origin.url ]]; then + cat $bundledir/.git/config/remote.origin.url + else + # un-sanitize dir into URL + local url=$o_path[-1] + url=${url:t} + url=${url:gs/-AT-/\@} + url=${url:gs/-COLON-/\:} + url=${url:gs/-SLASH-/\/} + echo "$url" + fi + elif [[ "$@" = "pull" ]]; then + (( $#o_quiet )) || echo "MOCKGIT: Already up to date." + elif [[ "$@" = "rev-parse HEAD" ]]; then + #echo "a123456" + echo "" + elif [[ "$@" = "submodule sync" ]]; then + # nothing to do + elif [[ "$@" = "submodule update" ]]; then + # nothing to do + else + echo >&2 "mocking not implemented for git command: git $@" + return 1 + fi +#} diff --git a/.antidote/tests/functions/subenv b/.antidote/tests/functions/subenv new file mode 100644 index 0000000..09ec078 --- /dev/null +++ b/.antidote/tests/functions/subenv @@ -0,0 +1,17 @@ +#!/bin/zsh +#function subenv { + emulate -L zsh; setopt local_options + + if (( $# == 0 )); then + set -- HOME + fi + + local -a sedargs=(-e "s|\$HOME|$HOME|g") + while (( $# )); do + if [[ -v "$1" ]]; then + sedargs+=(-e "s|${(P)1}|\$$1|g") + fi + shift + done + sed "$sedargs[@]" +#} diff --git a/.antidote/tests/functions/t_reset b/.antidote/tests/functions/t_reset new file mode 100644 index 0000000..4b21d7a --- /dev/null +++ b/.antidote/tests/functions/t_reset @@ -0,0 +1,7 @@ +#!/bin/zsh +#function t_reset { + 0=${(%):-%x} + t_teardown + t_setup + source ${0:A:h:h:h}/antidote.zsh +#} diff --git a/.antidote/tests/functions/t_setup b/.antidote/tests/functions/t_setup new file mode 100644 index 0000000..47f5c85 --- /dev/null +++ b/.antidote/tests/functions/t_setup @@ -0,0 +1,54 @@ +#!/bin/zsh +#function t_setup { + emulate -L zsh + setopt local_options extended_glob glob_dots + + 0=${(%):-%x} + local prjdir="${0:A:h:h:h}" + local testdir="${0:A:h:h}" + + # save path/fpath + typeset -ga T_PREV_PATH=( $path ) + typeset -ga T_PREV_FPATH=( $fpath ) + + # save zstyles, and clear them all for the test session + typeset -ga T_PREV_ZSTYLES=( ${(@f)"$(zstyle -L ':antidote:*')"} ) + source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}') + + # setup test functions + fpath+=( $testdir/functions ) + autoload -Uz $testdir/functions/* + + # mock git + function git { mockgit "$@" } + + # works with BSD and GNU gmktemp + T_TEMPDIR=${$(mktemp -d -t t_antidote.XXXXXXXX):A} + typeset -g T_PREV_HOME=$HOME + typeset -g T_PREV_ZDOTDIR=$ZDOTDIR + + export HOME=$T_TEMPDIR + export ZDOTDIR=$HOME/.zsh + typeset -g ANTIDOTE_HOME=$HOME/.cache/antidote + + # put tmp_home into position + for p in $testdir/tmp_home/*; do + cp -rf $p $T_TEMPDIR + done + + # rename .mockgit to .git + local mockdir + for mockdir in $T_TEMPDIR/**/.mock*; do + mv $mockdir ${mockdir:s/.mock/.} + done + + # our mock plugins use this + typeset -ga plugins=() + typeset -ga libs=() + + # setup antidote + zstyle ':antidote:tests' set-warn-options 'on' + zstyle ':antidote:tests' cloning 'off' + zstyle ':antidote:bundle' use-friendly-names on + zstyle ':antidote:defer' bundle 'getantidote/zsh-defer' +#} diff --git a/.antidote/tests/functions/t_setup_real b/.antidote/tests/functions/t_setup_real new file mode 100644 index 0000000..1bfc0e7 --- /dev/null +++ b/.antidote/tests/functions/t_setup_real @@ -0,0 +1,30 @@ +#!/bin/zsh +#function t_setup_real { + 0=${(%):-%x} + local testdir="${0:A:h:h}" + local prjdir="${0:A:h:h:h}" + + # undo setup so we clone for real + zstyle ':antidote:tests' cloning 'on' + (( $+functions[git] )) && unfunction git + + # unset other testing zstyles + zstyle -d ':antidote:defer' bundle + + # unset rupa/z + (( $+aliases[z] )) && unalias z + + # replace .zsh_plugins.txt with real versions + local file + for file in .zsh_plugins.txt .zsh_plugins.zsh; do + [[ -f $ZDOTDIR/$file ]] && command rm -f -- "$ZDOTDIR/$file" + [[ -f $testdir/real/$file ]] && command rm -f -- "$testdir/real/$file" + done + + # clean out antidote home + [[ -d $ANTIDOTE_HOME ]] && command rm -rf -- "$ANTIDOTE_HOME" + mkdir -p "$ANTIDOTE_HOME" + + # source antidote + source $prjdir/antidote.zsh +#} diff --git a/.antidote/tests/functions/t_teardown b/.antidote/tests/functions/t_teardown new file mode 100644 index 0000000..24eae4f --- /dev/null +++ b/.antidote/tests/functions/t_teardown @@ -0,0 +1,44 @@ +#!/bin/zsh + +#function t_teardown { + emulate -L zsh + setopt local_options + + # reset current session + HOME=$T_PREV_HOME + ZDOTDIR=$T_PREV_ZDOTDIR + + # unfunction all antidote + for fn in ${(k)functions}; do + [[ $fn == *antidote* ]] && unfunction -- $fn + done + (( $+functions[git] )) && unfunction git + + # unfunction zsh-defer + (( $+functions[zsh-defer] )) && unfunction zsh-defer + + # restore original path/fpath + path=( $T_PREV_PATH ) + fpath=( $T_PREV_FPATH ) + + # restore original zstyles + source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}') + source <(printf '%s\n' $T_PREV_ZSTYLES) + + # remove tempdir + [[ -d "$T_TEMPDIR" ]] && command rm -rf -- "$T_TEMPDIR" + + # remove vars + for var in \ + ANTIDOTE_HOME \ + T_TEMPDIR \ + T_PREV_HOME \ + T_PREV_ZDOTDIR \ + T_PREV_PATH \ + T_PREV_FPATH \ + plugins \ + libs + do + [[ -v $var ]] && unset $var + done +#} diff --git a/.antidote/tests/functions/t_unload_antidote b/.antidote/tests/functions/t_unload_antidote new file mode 100644 index 0000000..25a48a4 --- /dev/null +++ b/.antidote/tests/functions/t_unload_antidote @@ -0,0 +1,13 @@ +#!/bin/zsh + +emulate -L zsh +setopt local_options + +# unfunction all antidote +for fn in ${(k)functions}; do + [[ $fn == *antidote* ]] && [[ $fn != t_* ]] && unfunction -- $fn +done +(( $+functions[git] )) && unfunction git + +# unfunction zsh-defer +(( $+functions[zsh-defer] )) && unfunction zsh-defer diff --git a/.antidote/tests/test_alt_zsh_defer_bundle.md b/.antidote/tests/test_alt_zsh_defer_bundle.md new file mode 100644 index 0000000..1590bdc --- /dev/null +++ b/.antidote/tests/test_alt_zsh_defer_bundle.md @@ -0,0 +1,35 @@ +# antidote test alternative zsh-defer repo + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Customize zsh-defer + +If the user forks zsh-defer, support setting a zstyle for an alternative repo location. + +### General + +```zsh +% zstyle ':antidote:bundle' use-friendly-names on +% zstyle ':antidote:defer' bundle 'custom/zsh-defer' +% antidote bundle 'zsh-users/zsh-autosuggestions kind:defer' 2>/dev/null +if ! (( $+functions[zsh-defer] )); then + fpath+=( $HOME/.cache/antidote/custom/zsh-defer ) + source $HOME/.cache/antidote/custom/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $HOME/.cache/antidote/zsh-users/zsh-autosuggestions ) +zsh-defer source $HOME/.cache/antidote/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_antidote.md b/.antidote/tests/test_antidote.md new file mode 100644 index 0000000..24770a0 --- /dev/null +++ b/.antidote/tests/test_antidote.md @@ -0,0 +1,302 @@ +# antidote bundle tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Version + +Show antidote's version: + +```zsh +% antidote --version +antidote version 1.9.7 +% +``` + +## Help + +Show antidote's functionality: + +```zsh +% antidote --help +antidote - the cure to slow zsh plugin management + +usage: antidote [] [ ...] + +flags: + -h, --help Show context-sensitive help + -v, --version Show application version + +commands: + help Show documentation + load Statically source all bundles from the plugins file + bundle Clone bundle(s) and generate the static load script + install Clone a new bundle and add it to your plugins file + update Update antidote and its cloned bundles + purge Remove a cloned bundle + home Print where antidote is cloning bundles + list List cloned bundles + path Print the path of a cloned bundle + init Initialize the shell for dynamic bundles +% +``` + +## Bundling + +Bundle the foo/bar repo using old antibody style directories: + +```zsh +% zstyle ':antidote:bundle' use-friendly-names off +% antidote bundle foo/bar +# antidote cloning foo/bar... +fpath+=( $HOME/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar ) +source $HOME/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh +% +``` + +Use new-style directory naming: + +```zsh +% zstyle ':antidote:bundle' use-friendly-names on +% +``` + +Bundle a repo at https://github.com/foo/bar + +```zsh +% antidote bundle foo/bar +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% +``` + +Bundle a repo at git@bitbucket.org:foo/bar + +```zsh +% antidote bundle git@bitbucket.org:foo/bar +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% +``` + +Bundle a specific branch of a repo with `branch:`. + +```zsh +% antidote bundle foo/bar branch:dev +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% +``` + +### Annotations: kind + +Bundles support a `kind:` annotation. The default is `kind:zsh`. + +```zsh +% antidote bundle foo/bar kind:zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% +``` + +Bundle foo/bar with `kind:path` to add it to your `$PATH`. + +```zsh +% antidote bundle foo/bar kind:path +export PATH="$HOME/.cache/antidote/foo/bar:$PATH" +% +``` + +Bundle foo/bar with `kind:fpath` to add it to your `$fpath`. + +```zsh +% antidote bundle foo/bar kind:fpath +fpath+=( $HOME/.cache/antidote/foo/bar ) +% +``` + +Bundle foo/bar with `kind:clone` to just clone the repo, but do nothing to load it. + +```zsh +% antidote bundle foo/bar kind:clone +% +``` + +Autoload a path within foo/bar with the `kind:autoload` annotation. + +```zsh +% antidote bundle foo/baz kind:autoload path:functions +fpath+=( $HOME/.cache/antidote/foo/baz/functions ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +% +``` + +Defer loading the foo/bar bundle with the `kind:defer` annotation. + +```zsh +% antidote bundle foo/baz kind:defer +if ! (( $+functions[zsh-defer] )); then + fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer ) + source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $HOME/.cache/antidote/foo/baz ) +zsh-defer source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh +% +``` + +### Annotations: path + +Use the `path:` annotation to load subplugins. + +```zsh +% antidote bundle ohmy/ohmy path:plugins/docker +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh +% +``` + +Use `path:` to load a whole directory full of files. + +```zsh +% antidote bundle ohmy/ohmy path:lib +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib ) +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh +% +``` + +Use `path:` to load a specific file. + +```zsh +% antidote bundle ohmy/ohmy path:custom/themes/pretty.zsh-theme +source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme +% +``` + +### Annotations: conditional + +Use a existing boolean function to wrap a bundle in `if` logic: + +```zsh +% is-macos() { [[ "$OSTYPE" == "darwin"* ]]; } +% antidote bundle foo/bar conditional:is-macos +if is-macos; then + fpath+=( $HOME/.cache/antidote/foo/bar ) + source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fi +% +``` + +## Dynamic bundling + +If you run `source <(antidote init)`, antidote will emit a wrapper so that you can +dynamically bundle. + +```zsh +% antidote init +#!/usr/bin/env zsh +function antidote { + case "$1" in + bundle) + source <( antidote-main $@ ) || antidote-main $@ + ;; + *) + antidote-main $@ + ;; + esac +} +% +``` + +## Home + +Show where antidote stores its bundles: + +```zsh +% antidote home | subenv HOME +$HOME/.cache/antidote +% +``` + +## List bundles + +List directories: + +```zsh +% antidote list --dirs | subenv HOME +$HOME/.cache/antidote/foo/bar +$HOME/.cache/antidote/foo/baz +$HOME/.cache/antidote/foo/qux +$HOME/.cache/antidote/getantidote/zsh-defer +$HOME/.cache/antidote/ohmy/ohmy +% +``` + +List repo URLs: + +```zsh +% antidote list --url +git@github.com:foo/qux +https://github.com/foo/bar +https://github.com/foo/baz +https://github.com/getantidote/zsh-defer +https://github.com/ohmy/ohmy +% +``` + +List short repos: + +```zsh +% antidote list --short +foo/bar +foo/baz +getantidote/zsh-defer +git@github.com:foo/qux +ohmy/ohmy +% +``` + +## Bundle paths + +Show the path to a bundle: + +```zsh +% ZSH=$(antidote path ohmy/ohmy) +% echo $ZSH | subenv HOME +$HOME/.cache/antidote/ohmy/ohmy +% +``` + +## Update bundles + +```zsh +% antidote update +Updating bundles... +antidote: checking for updates: https://github.com/foo/bar +antidote: checking for updates: https://github.com/foo/baz +antidote: checking for updates: git@github.com:foo/qux +antidote: checking for updates: https://github.com/getantidote/zsh-defer +antidote: checking for updates: https://github.com/ohmy/ohmy +Waiting for bundle updates to complete... + +Bundle updates complete. + +Updating antidote... +antidote self-update complete. + +antidote version 1.9.7 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_antidote_core.md b/.antidote/tests/test_antidote_core.md new file mode 100644 index 0000000..decd967 --- /dev/null +++ b/.antidote/tests/test_antidote_core.md @@ -0,0 +1,135 @@ +# antidote core tests + +fails gracefully when someone tries bash + +```zsh +% bash -c "source $PWD/antidote.zsh" +antidote: Expecting zsh. Found 'bash'. +% +``` + +## Setup + +```zsh +% echo $+functions[antidote] +0 +% source ./tests/_setup.zsh +% source ./antidote.zsh +% echo $+functions[antidote] +1 +% git --version +0.0.0 +% +``` + +## General + +No args displays help: + +```zsh +% antidote +antidote - the cure to slow zsh plugin management + +usage: antidote [] [ ...] + +flags: + -h, --help Show context-sensitive help + -v, --version Show application version + +commands: + help Show documentation + load Statically source all bundles from the plugins file + bundle Clone bundle(s) and generate the static load script + install Clone a new bundle and add it to your plugins file + update Update antidote and its cloned bundles + purge Remove a cloned bundle + home Print where antidote is cloning bundles + list List cloned bundles + path Print the path of a cloned bundle + init Initialize the shell for dynamic bundles +% +``` + +No arg exit status is 2: + +```zsh +% antidote >/dev/null; err=$? +% echo $err +2 +% +``` + +## Help + +`-h` and `--help` work: + +```zsh +% antidote -h >/dev/null; err=$? +% echo $err +0 +% antidote --help >/dev/null; err=$? +% echo $err +0 +% +``` + +## Version + +`-v` and `--version` work: + +```zsh +% antidote --version +antidote version 1.9.7 +% antidote -v >/dev/null; echo $? +0 +% antidote --version >/dev/null; echo $? +0 +% +``` + +## Unrecognized options + +```zsh +% antidote --foo >/dev/null; err=$? #=> --regex (bad option|command not found) +% echo $err +1 +% +``` + +## Unrecognized commands + +```zsh +% antidote foo; err=$? +antidote: command not found 'foo' +% echo $err +1 +% +``` + +## All commands + +```zsh +% cmds=( bundle help home init install list load path purge update script main null ) +% for cmd in $cmds; echo $+functions[antidote-$cmd] +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +0 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_bundle_helpers.md b/.antidote/tests/test_bundle_helpers.md new file mode 100644 index 0000000..6ffdc51 --- /dev/null +++ b/.antidote/tests/test_bundle_helpers.md @@ -0,0 +1,135 @@ +# antidote bundle helper tests + +## Setup + +```zsh +% TESTDATA=$PWD/tests/testdata +% source ./tests/_setup.zsh +% source ./antidote.zsh +% antidote-bundle -h &>/dev/null +% +``` + +## Awk filter repos + +The repo parser pulls a list of all git URLs in a bundle file so that we can clone missing ones in parallel. + +```zsh +% __antidote_bulk_clone $TESTDATA/.zsh_plugins_repos.txt +antidote-script --kind clone --branch baz foobar/foobar & +antidote-script --kind clone bar/baz & +antidote-script --kind clone getantidote/zsh-defer & +antidote-script --kind clone git@github.com:user/repo & +antidote-script --kind clone http://github.com/user/repo.git & +antidote-script --kind clone https://github.com/foo/baz & +antidote-script --kind clone https://github.com/foo/qux & +antidote-script --kind clone https://github.com/user/repo & +antidote-script --kind clone user/repo & +wait +% +``` + +Test empty + +```zsh +% __antidote_bulk_clone $TESTDATA/.zsh_plugins_empty.txt +wait +% +``` + +## Awk Filter defers + +Test that only the first defer block is kept... + +```zsh +% __antidote_filter_defers $PWD/tests/testdata/.zsh_plugins_multi_defer.zsh | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +if is-macos; then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh +% +``` + +Test that with no defers, nothing is altered... + +```zsh +% __antidote_filter_defers $PWD/tests/testdata/.zsh_plugins_no_defer.zsh #=> --file testdata/.zsh_plugins_no_defer.zsh +% +``` + +## Awk Bundle parser + +Parse a simple repo: + +```zsh +% echo foo/bar | __antidote_parse_bundles +antidote-script foo/bar +% +``` + +```zsh +% echo 'https://github.com/foo/bar path:lib branch:dev' | __antidote_parse_bundles +antidote-script --path lib --branch dev https://github.com/foo/bar +% echo 'git@github.com:foo/bar.git kind:clone branch:main' | __antidote_parse_bundles +antidote-script --kind clone --branch main git@github.com:foo/bar.git +% echo 'foo/bar kind:fpath abc:xyz' | __antidote_parse_bundles +antidote-script --kind fpath --abc xyz foo/bar +% echo 'foo/bar path:plugins/myplugin kind:path # trailing comment' | __antidote_parse_bundles +antidote-script --path plugins/myplugin --kind path foo/bar +% +``` + +Handle funky whitespace + +```zsh +% cr=$'\r'; lf=$'\n'; tab=$'\t' +% echo "foo/bar${tab}kind:path${cr}${lf}" | __antidote_parse_bundles +antidote-script --kind path foo/bar +% +``` + +The bundle parser is an awk script that turns the bundle DSL into antidote-script statements. + +```zsh +% __antidote_parse_bundles $ZDOTDIR/.zsh_plugins.txt +antidote-script ~/foo/bar +antidote-script --path plugins/myplugin \$ZSH_CUSTOM +antidote-script foo/bar +antidote-script git@github.com:foo/qux.git +antidote-script --kind clone getantidote/zsh-defer +antidote-script --kind zsh foo/bar +antidote-script --kind fpath foo/bar +antidote-script --kind path foo/bar +antidote-script --path lib ohmy/ohmy +antidote-script --path plugins/extract ohmy/ohmy +antidote-script --path plugins/magic-enter --kind defer ohmy/ohmy +antidote-script --path custom/themes/pretty.zsh-theme ohmy/ohmy +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_bundle.md b/.antidote/tests/test_cmd_bundle.md new file mode 100644 index 0000000..7322de5 --- /dev/null +++ b/.antidote/tests/test_cmd_bundle.md @@ -0,0 +1,62 @@ +# antidote bundle helper tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Test bundle command + +Many 'bundle' tests could just as well just be 'script' tests, so we rely on +'test_script.md' to find scripting issues and use this to test actual bundling, +or things not handled by 'antidote script'. You can think of 'antidote script' as +handling a single bundle, and 'antidote bundle' handling them in bulk. + +### General + +```zsh +% # antidote bundle +% +``` + +```zsh +% antidote bundle <$ZDOTDIR/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv #=> --file testdata/.zsh_plugins.zsh +% +``` + +### Multiple ways to call bundle + +Test \|piping, \ --file testdata/script-foobar.zsh +% echo 'foo/bar' | antidote bundle | subenv ANTIDOTE_HOME #=> --file testdata/script-foobar.zsh +% echo 'foo/bar' >$ZDOTDIR/.zsh_plugins_simple.txt +% antidote bundle <$ZDOTDIR/.zsh_plugins_simple.txt | subenv ANTIDOTE_HOME #=> --file testdata/script-foobar.zsh +% zstyle ':antidote:bundle' use-friendly-names on +% ANTIDOTE_HOME=$HOME/.cache/antidote +% +``` + +## Fails + +```zsh +% echo "foo/bar\nfoo/baz kind:whoops" | antidote bundle 2>&1 | subenv ANTIDOTE_HOME +antidote: error: unexpected kind value: 'whoops' +fpath+=( $ANTIDOTE_HOME/foo/bar ) +source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_help.md b/.antidote/tests/test_cmd_help.md new file mode 100644 index 0000000..3b5baf9 --- /dev/null +++ b/.antidote/tests/test_cmd_help.md @@ -0,0 +1,185 @@ +# antidote help tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## General + +`antidote help` command exists + +```zsh +% antidote help &>/dev/null; echo $? +0 +% +``` + +`antidote --h/--help` works + +```zsh +% antidote -h &>/dev/null; echo $? +0 +% antidote --help &>/dev/null; echo $? +0 +% +``` + +`antidote` man pages work + +```zsh +% PAGER=cat man antidote | head -n 1 | sed 's/ */ /g' +antidote(1) Antidote Manual antidote(1) +% +``` + +`antidote` man pages are in `$MANPATH` +```zsh +% [[ "$MANPATH" == *"$PWD/man:"* ]] || echo 'MANPATH not set properly' +% +``` + +## antidote-bundle + +```zsh +% antidote help bundle | head -n 1 | sed 's/ */ /g' +antidote-bundle(1) Antidote Manual antidote-bundle(1) +% antidote bundle --help | head -n 1 | sed 's/ */ /g' +antidote-bundle(1) Antidote Manual antidote-bundle(1) +% antidote bundle -h | head -n 1 | sed 's/ */ /g' +antidote-bundle(1) Antidote Manual antidote-bundle(1) +% +``` + +## antidote-help + +```zsh +% antidote help help | head -n 1 | sed 's/ */ /g' +antidote-help(1) Antidote Manual antidote-help(1) +% antidote help --help | head -n 1 | sed 's/ */ /g' +antidote-help(1) Antidote Manual antidote-help(1) +% antidote help -h | head -n 1 | sed 's/ */ /g' +antidote-help(1) Antidote Manual antidote-help(1) +% +``` + +## antidote-home + +```zsh +% antidote help home | head -n 1 | sed 's/ */ /g' +antidote-home(1) Antidote Manual antidote-home(1) +% antidote home --help | head -n 1 | sed 's/ */ /g' +antidote-home(1) Antidote Manual antidote-home(1) +% antidote home -h | head -n 1 | sed 's/ */ /g' +antidote-home(1) Antidote Manual antidote-home(1) +% +``` + +## antidote-init + +```zsh +% antidote help init | head -n 1 | sed 's/ */ /g' +antidote-init(1) Antidote Manual antidote-init(1) +% antidote init --help | head -n 1 | sed 's/ */ /g' +antidote-init(1) Antidote Manual antidote-init(1) +% antidote init -h | head -n 1 | sed 's/ */ /g' +antidote-init(1) Antidote Manual antidote-init(1) +% +``` + +## antidote-install + +```zsh +% antidote help install | head -n 1 | sed 's/ */ /g' +antidote-install(1) Antidote Manual antidote-install(1) +% antidote install --help | head -n 1 | sed 's/ */ /g' +antidote-install(1) Antidote Manual antidote-install(1) +% antidote install -h | head -n 1 | sed 's/ */ /g' +antidote-install(1) Antidote Manual antidote-install(1) +% +``` + +## antidote-list + +```zsh +% antidote help list | head -n 1 | sed 's/ */ /g' +antidote-list(1) Antidote Manual antidote-list(1) +% antidote list --help | head -n 1 | sed 's/ */ /g' +antidote-list(1) Antidote Manual antidote-list(1) +% antidote list -h | head -n 1 | sed 's/ */ /g' +antidote-list(1) Antidote Manual antidote-list(1) +% +``` + +## antidote-load + +```zsh +% antidote help load | head -n 1 | sed 's/ */ /g' +antidote-load(1) Antidote Manual antidote-load(1) +% antidote load --help | head -n 1 | sed 's/ */ /g' +antidote-load(1) Antidote Manual antidote-load(1) +% antidote load -h | head -n 1 | sed 's/ */ /g' +antidote-load(1) Antidote Manual antidote-load(1) +% +``` + +## antidote-path + +```zsh +% antidote help path | head -n 1 | sed 's/ */ /g' +antidote-path(1) Antidote Manual antidote-path(1) +% antidote path --help | head -n 1 | sed 's/ */ /g' +antidote-path(1) Antidote Manual antidote-path(1) +% antidote path -h | head -n 1 | sed 's/ */ /g' +antidote-path(1) Antidote Manual antidote-path(1) +% +``` + +## antidote-update + +```zsh +% antidote help update | head -n 1 | sed 's/ */ /g' +antidote-update(1) Antidote Manual antidote-update(1) +% antidote update --help | head -n 1 | sed 's/ */ /g' +antidote-update(1) Antidote Manual antidote-update(1) +% antidote update -h | head -n 1 | sed 's/ */ /g' +antidote-update(1) Antidote Manual antidote-update(1) +% +``` + +## antidote-script + +```zsh +% antidote help script +No manual entry for antidote-script +antidote - the cure to slow zsh plugin management + +usage: antidote [] [ ...] + +flags: + -h, --help Show context-sensitive help + -v, --version Show application version + +commands: + help Show documentation + load Statically source all bundles from the plugins file + bundle Clone bundle(s) and generate the static load script + install Clone a new bundle and add it to your plugins file + update Update antidote and its cloned bundles + purge Remove a cloned bundle + home Print where antidote is cloning bundles + list List cloned bundles + path Print the path of a cloned bundle + init Initialize the shell for dynamic bundles +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_home.md b/.antidote/tests/test_cmd_home.md new file mode 100644 index 0000000..ce1298e --- /dev/null +++ b/.antidote/tests/test_cmd_home.md @@ -0,0 +1,95 @@ +# antidote home tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## General + +`antidote home` command exists + +```zsh +% antidote home &>/dev/null; echo $? +0 +% +``` + +`antidote home --h/--help` works + +```zsh +% antidote home -h &>/dev/null; echo $? +0 +% antidote home --help &>/dev/null; echo $? +0 +% +``` + +`$ANTIDOTE_HOME` is used if set... + +```zsh +% ANTIDOTE_HOME=$HOME/.cache/antidote +% antidote home | subenv HOME +$HOME/.cache/antidote +% unset ANTIDOTE_HOME +% +``` + +`antidote home` is `~/Library/Caches/antidote` on macOS + +```zsh +% OLD_OSTYPE=$OSTYPE; OSTYPE=darwin21.3.0 +% antidote home | subenv HOME +$HOME/Library/Caches/antidote +% OSTYPE=$OLD_OSTYPE +% +``` + +`antidote home` is `$LOCALAPPDATA/antidote` on msys + +```zsh +% OLD_OSTYPE=$OSTYPE; OSTYPE=msys +% LOCALAPPDATA=$HOME/AppData +% antidote home | subenv HOME +$HOME/AppData/antidote +% OSTYPE=$OLD_OSTYPE +% +``` + +`antidote home` uses `$XDG_CACHE_HOME` on an OS that defines it. + +```zsh +% # Setup +% OLD_OSTYPE=$OSTYPE; OSTYPE=foobar +% OLD_XDG_CACHE_HOME=$XDG_CACHE_HOME; XDG_CACHE_HOME=$HOME/.xdg-cache +% # Run test +% antidote home | subenv XDG_CACHE_HOME +$XDG_CACHE_HOME/antidote +% # Teardown +% OSTYPE=$OLD_OSTYPE; XDG_CACHE_HOME=$OLD_XDG_CACHE_HOME +% +``` + +`antidote home` uses `$HOME/.cache` otherwise. + +```zsh +% # Setup +% OLD_OSTYPE=$OSTYPE; OSTYPE=foobar +% OLD_XDG_CACHE_HOME=$XDG_CACHE_HOME; XDG_CACHE_HOME= +% # Run test +% antidote home | subenv HOME +$HOME/.cache/antidote +% # Teardown +% OSTYPE=$OLD_OSTYPE; XDG_CACHE_HOME=$OLD_XDG_CACHE_HOME +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_init.md b/.antidote/tests/test_cmd_init.md new file mode 100644 index 0000000..6cf7879 --- /dev/null +++ b/.antidote/tests/test_cmd_init.md @@ -0,0 +1,54 @@ +# antidote init tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Init + +```zsh +% antidote init +#!/usr/bin/env zsh +function antidote { + case "$1" in + bundle) + source <( antidote-main $@ ) || antidote-main $@ + ;; + *) + antidote-main $@ + ;; + esac +} +% +``` + +Load plugins dynamically + +```zsh +% source <(antidote init) +% antidote bundle foo/bar +sourcing foo/bar... +% antidote bundle foo/baz autoload:functions +sourcing foo/baz... +% antidote bundle $ZDOTDIR/custom/lib +sourcing custom lib1.zsh... +sourcing custom lib2.zsh... +% echo $#plugins +2 +% echo $#libs +2 +% echo $+functions[baz] +1 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_install.md b/.antidote/tests/test_cmd_install.md new file mode 100644 index 0000000..efb6ecc --- /dev/null +++ b/.antidote/tests/test_cmd_install.md @@ -0,0 +1,59 @@ +# antidote installs tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Install Command + +`antidote install` requires a `` argument. + +```zsh +% antidote install #=> --exit 1 +antidote: error: required argument 'bundle' not provided, try --help +% +``` + +Trying to install an existing bundle fails. + +```zsh +% antidote install foo/bar &>/dev/null #=> --exit 1 +% antidote install foo/bar 2>&1 | subenv ANTIDOTE_HOME >&2 +antidote: error: foo/bar already installed: $ANTIDOTE_HOME/foo/bar +% +``` + +Install a bundle + +```zsh +% antidote install rupa/z | subenv ZDOTDIR +# antidote cloning rupa/z... +Adding bundle to '$ZDOTDIR/.zsh_plugins.txt': +rupa/z +% tail -n 1 $ZDOTDIR/.zsh_plugins.txt +rupa/z +% +``` + +Install a complicated bundle + +```zsh +% antidote install --path plugins/macos --conditional is-macos ohmyzsh/ohmyzsh | subenv ZDOTDIR +# antidote cloning ohmyzsh/ohmyzsh... +Adding bundle to '$ZDOTDIR/.zsh_plugins.txt': +ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos +% tail -n 1 $ZDOTDIR/.zsh_plugins.txt +ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_list.md b/.antidote/tests/test_cmd_list.md new file mode 100644 index 0000000..01bb057 --- /dev/null +++ b/.antidote/tests/test_cmd_list.md @@ -0,0 +1,74 @@ +# antidote list tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## List Command + +### Short + +`antidote list --short` + +```zsh +% antidote list --short | subenv ANTIDOTE_HOME +foo/bar +foo/baz +getantidote/zsh-defer +git@github.com:foo/qux +ohmy/ohmy +% +``` + +### Directories + +`antidote list --dirs` + +```zsh +% antidote list --dirs | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/foo/bar +$ANTIDOTE_HOME/foo/baz +$ANTIDOTE_HOME/foo/qux +$ANTIDOTE_HOME/getantidote/zsh-defer +$ANTIDOTE_HOME/ohmy/ohmy +% +``` + +### URLs + +`antidote list --url` + +```zsh +% antidote list --url +git@github.com:foo/qux +https://github.com/foo/bar +https://github.com/foo/baz +https://github.com/getantidote/zsh-defer +https://github.com/ohmy/ohmy +% +``` + +### Full + +`antidote list` + +```zsh +% antidote list | subenv ANTIDOTE_HOME +git@github.com:foo/qux $ANTIDOTE_HOME/foo/qux +https://github.com/foo/bar $ANTIDOTE_HOME/foo/bar +https://github.com/foo/baz $ANTIDOTE_HOME/foo/baz +https://github.com/getantidote/zsh-defer $ANTIDOTE_HOME/getantidote/zsh-defer +https://github.com/ohmy/ohmy $ANTIDOTE_HOME/ohmy/ohmy +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_load.md b/.antidote/tests/test_cmd_load.md new file mode 100644 index 0000000..64e0ccf --- /dev/null +++ b/.antidote/tests/test_cmd_load.md @@ -0,0 +1,67 @@ +# antidote load tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +### General + +```zsh +% antidote load $ZDOTDIR/.zplugins_fake_load +sourcing foo/bar... +sourcing foo/qux... +sourcing foo/bar... +sourcing ohmy/lib/lib1.zsh... +sourcing ohmy/lib/lib2.zsh... +sourcing ohmy/lib/lib3.zsh... +sourcing extract.plugin.zsh... +sourcing docker.plugin.zsh... +sourcing docker.plugin.zsh... +sourcing getantidote/zsh-defer... +sourcing magic-enter.plugin.zsh... +sourcing pretty.zsh-theme... +% cat $ZDOTDIR/.zplugins_fake_load.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh +% # cleanup +% t_reset +% +``` + +### zstyles + +```zsh +% cp $ZDOTDIR/.zplugins_fake_load $ZDOTDIR/.zplugins.txt +% zstyle ':antidote:bundle' file $ZDOTDIR/.zplugins.txt +% zstyle ':antidote:static' file $ZDOTDIR/.zplugins.txt +% # the static file should be different +% antidote load 2>&1 | subenv ZDOTDIR +antidote: bundle file and static file are the same '$ZDOTDIR/.zplugins.txt'. +% # fixed... +% zstyle ':antidote:static' file $ZDOTDIR/.zplugins.static.zsh +% # the static file should be different +% antidote load +sourcing foo/bar... +sourcing foo/qux... +sourcing foo/bar... +sourcing ohmy/lib/lib1.zsh... +sourcing ohmy/lib/lib2.zsh... +sourcing ohmy/lib/lib3.zsh... +sourcing extract.plugin.zsh... +sourcing docker.plugin.zsh... +sourcing docker.plugin.zsh... +sourcing getantidote/zsh-defer... +sourcing magic-enter.plugin.zsh... +sourcing pretty.zsh-theme... +% cat $ZDOTDIR/.zplugins.static.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_main.md b/.antidote/tests/test_cmd_main.md new file mode 100644 index 0000000..f75c62a --- /dev/null +++ b/.antidote/tests/test_cmd_main.md @@ -0,0 +1,57 @@ +# antidote main tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Test main + +Main is core to everything, so we don't need to test much here. + +```zsh +% antidote-main --version &>/dev/null #=> --exit 0 +% +``` + +## Lazy config + +Tests for lazy-loading antidote. + +- Fix [#54](https://github.com/mattmc3/antidote/issues/54) + +```zsh +% # Unload antidote +% echo $+functions[antidote-main] +1 +% t_unload_antidote +% echo $+functions[antidote-main] +0 +% # Now, lazy load it and make sure it works +% autoload -Uz $PWD/antidote +% antidote -v &>/dev/null; echo $? +0 +% # Now, tear down again +% echo $+functions[antidote-main] +1 +% t_unload_antidote +% echo $+functions[antidote-main] +0 +% # Now, lazy load from the functions dir +% autoload -Uz $PWD/functions/antidote +% antidote -v &>/dev/null; echo $? +0 +% echo $+functions[antidote-main] +1 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_path.md b/.antidote/tests/test_cmd_path.md new file mode 100644 index 0000000..dcf82d1 --- /dev/null +++ b/.antidote/tests/test_cmd_path.md @@ -0,0 +1,59 @@ +# antidote path tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Path Command + +`antidote-path` prints path to bundle. + +```zsh +% antidote path foo/bar &>/dev/null #=> --exit 0 +% antidote path foo/bar | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/foo/bar +% +``` + +`antidote-path` fails on missing bundles + +```zsh +% antidote path bar/foo &>/dev/null #=> --exit 1 +% antidote path bar/foo; err=$? +antidote: error: bar/foo does not exist in cloned paths +% echo $err +1 +% +``` + +`antidote-path` accepts piped input + +```zsh +% antidote list -s | antidote path | sort | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/foo/bar +$ANTIDOTE_HOME/foo/baz +$ANTIDOTE_HOME/foo/qux +$ANTIDOTE_HOME/getantidote/zsh-defer +$ANTIDOTE_HOME/ohmy/ohmy +% +``` + +`antidote-path` expands vars + +```zsh +% ZSH_CUSTOM=$ZDOTDIR/custom +% antidote path '$ZSH_CUSTOM/plugins/myplugin' | subenv +$HOME/.zsh/custom/plugins/myplugin +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_purge.md b/.antidote/tests/test_cmd_purge.md new file mode 100644 index 0000000..495e6ba --- /dev/null +++ b/.antidote/tests/test_cmd_purge.md @@ -0,0 +1,78 @@ +# antidote purge tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Purge Command + +`antidote purge` requires a `` argument. + +```zsh +% antidote purge &>/dev/null #=> --exit 1 +% antidote purge +antidote: error: required argument 'bundle' not provided, try --help +% +``` + +Trying to purge a missing bundle fails. + +```zsh +% antidote purge bar/foo &>/dev/null #=> --exit 1 +% antidote purge bar/foo 2>&1 | subenv ANTIDOTE_HOME >&2 +antidote: error: bar/foo does not exist at the expected location: $ANTIDOTE_HOME/bar/foo +% +``` + +Purging a bundle deletes the directory and comments out instances of the bundle in `.zsh_plugins.txt`. + +```zsh +% # bundle dir exists +% bundledir=$ANTIDOTE_HOME/foo/bar +% test -d $bundledir #=> --exit 0 +% # purge works +% antidote purge foo/bar | subenv ZDOTDIR +Removed 'foo/bar'. +Bundle 'foo/bar' was commented out in '$ZDOTDIR/.zsh_plugins.txt'. +% # bundle dir was removed +% test -d $bundledir #=> --exit 1 +% cat $ZDOTDIR/.zsh_plugins.txt #=> --file ./testdata/.zsh_plugins_purged.txt +% +``` + +Test that `antidote purge --all` aborts when told "no". + +```zsh +% function test_exists { [[ -e "$1" ]] } +% zstyle ':antidote:purge:all' answer 'n' +% antidote purge --all #=> --exit 1 +% antidote list | subenv ANTIDOTE_HOME +git@github.com:foo/qux $ANTIDOTE_HOME/foo/qux +https://github.com/foo/baz $ANTIDOTE_HOME/foo/baz +https://github.com/getantidote/zsh-defer $ANTIDOTE_HOME/getantidote/zsh-defer +https://github.com/ohmy/ohmy $ANTIDOTE_HOME/ohmy/ohmy +% +``` + +Test that `antidote purge --all` does the work when told "yes". + +```zsh +% function test_exists { [[ -e "$1" ]] } +% zstyle ':antidote:purge:all' answer 'y' +% antidote purge --all | tail -n 1 +Antidote purge complete. Be sure to start a new Zsh session. +% antidote list | wc -l | awk '{print $1}' +0 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_script.md b/.antidote/tests/test_cmd_script.md new file mode 100644 index 0000000..d7dd017 --- /dev/null +++ b/.antidote/tests/test_cmd_script.md @@ -0,0 +1,377 @@ +# antidote-script tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Script Command + +### Fails + +```zsh +% antidote-script #=> --exit 1 +antidote: error: bundle argument expected +% +``` + +### Arg style + +`antidote-script` accepts '--arg val', '--arg:val', '--arg=val' syntax + +```zsh +% antidote-script --kind zsh foo/bar #=> --exit 0 +% antidote-script --kind:zsh foo/bar #=> --exit 0 +% antidote-script --kind=zsh foo/bar #=> --exit 0 +% antidote-script --kind+zsh foo/bar #=> --exit 1 +% +``` + +### Scripting types + +`antidote-script` works with local files and directories, as well as remote repos. + +Script a file: + +```zsh +% antidote-script $ZDOTDIR/aliases.zsh | subenv ZDOTDIR +source $ZDOTDIR/aliases.zsh +% +``` + +Script a lib directory: + +```zsh +% antidote-script $ZDOTDIR/custom/lib | subenv ZDOTDIR +fpath+=( $ZDOTDIR/custom/lib ) +source $ZDOTDIR/custom/lib/lib1.zsh +source $ZDOTDIR/custom/lib/lib2.zsh +% +``` + +Script a plugin directory: + +```zsh +% antidote-script $ZDOTDIR/custom/plugins/myplugin | subenv ZDOTDIR +fpath+=( $ZDOTDIR/custom/plugins/myplugin ) +source $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh +% +``` + +Script repos in antibody style: + +```zsh +% zstyle ':antidote:bundle' use-friendly-names off +% ANTIDOTE_HOME=$HOME/.cache/antibody +% antidote-script foo/bar | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh +% antidote-script https://github.com/foo/bar | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh +% antidote-script https://github.com/foo/bar.git | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh +% antidote-script git@github.com:foo/qux.git | subenv ANTIDOTE_HOME #=> --file ./testdata/script-fooqux.zsh +% zstyle ':antidote:bundle' use-friendly-names on +% ANTIDOTE_HOME=$HOME/.cache/antidote +% +``` + +## Annotations + +### kind:clone + +Nothing happens when the plugin already exists. + +```zsh +% antidote-script --kind clone foo/bar +% +``` + +Clone a missing plugin. + +```zsh +% antidote-script --kind clone bar/foo +# antidote cloning bar/foo... +% +``` + +### kind:zsh + +```zsh +% antidote-script --kind zsh foo/bar | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/foo/bar ) +source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +% +``` + +### kind:path + +```zsh +% antidote-script --kind path foo/bar | subenv ANTIDOTE_HOME +export PATH="$ANTIDOTE_HOME/foo/bar:$PATH" +% +``` + +### kind:fpath + +```zsh +% antidote-script --kind fpath foo/bar | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/foo/bar ) +% +``` + +### kind:autoload + +```zsh +% antidote-script --kind autoload $ZDOTDIR/functions | subenv ZDOTDIR +fpath+=( $ZDOTDIR/functions ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +% +``` + +### kind:defer + +```zsh +% antidote-script --kind defer foo/bar | subenv ANTIDOTE_HOME +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer ) + source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/foo/bar ) +zsh-defer source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +% +``` + +Test defer zstyle settings + +```zsh +% zstyle ':antidote:bundle:*' defer-options '-a' +% zstyle ':antidote:bundle:foo/bar' defer-options '-p' +% antidote-script --kind defer foo/bar | subenv ANTIDOTE_HOME +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer ) + source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/foo/bar ) +zsh-defer -p source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +% +% # Uses different defer options due to zstyle matching +% antidote-script --kind defer bar/baz | subenv ANTIDOTE_HOME +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer ) + source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/bar/baz ) +zsh-defer -a source $ANTIDOTE_HOME/bar/baz/baz.plugin.zsh +% # cleanup +% t_reset +% +``` + +### path:plugin-dir + +```zsh +% antidote-script --path plugins/extract ohmy/ohmy | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/extract ) +source $ANTIDOTE_HOME/ohmy/ohmy/plugins/extract/extract.plugin.zsh +% +``` + +### path:file + +```zsh +% antidote-script --path lib/lib1.zsh ohmy/ohmy | subenv ANTIDOTE_HOME +source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib1.zsh +% +``` + +### path:lib-dir + +```zsh +% antidote-script --path lib ohmy/ohmy | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/lib ) +source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib1.zsh +source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib2.zsh +source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib3.zsh +% +``` + +### path:theme + +```zsh +% antidote-script --path themes/pretty.zsh-theme ohmy/ohmy | subenv ANTIDOTE_HOME +source $ANTIDOTE_HOME/ohmy/ohmy/themes/pretty.zsh-theme +% +``` + +### conditional:testfunc + +```zsh +% antidote-script --conditional is-macos --path plugins/macos ohmy/ohmy | subenv ANTIDOTE_HOME +if is-macos; then + fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos ) + source $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/macos.plugin.zsh +fi +% +``` + +### autoload:funcdir + +```zsh +% antidote-script --path plugins/macos --autoload functions ohmy/ohmy | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/functions ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos ) +source $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/macos.plugin.zsh +% +``` + +### fpath-rule:append/prepend + +```zsh +% # append +% antidote-script --fpath-rule append --path plugins/docker ohmy/ohmy | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker ) +source $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker/docker.plugin.zsh +% # prepend +% antidote-script --fpath-rule prepend --path plugins/docker ohmy/ohmy | subenv ANTIDOTE_HOME +fpath=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker $fpath ) +source $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker/docker.plugin.zsh +% # whoops +% antidote-script --fpath-rule foobar --path plugins/docker ohmy/ohmy 2>&1 +antidote: error: unexpected fpath rule: 'foobar' +% +``` + +### pre/post functions + +```zsh +% # pre +% antidote-script --pre run_before foo/bar | subenv ANTIDOTE_HOME +run_before +fpath+=( $ANTIDOTE_HOME/foo/bar ) +source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +% # post +% antidote-script --post run_after foo/bar | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/foo/bar ) +source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +run_after +% +``` + +If a plugin is deferred, so is its post event +```zsh +% antidote-script --pre pre-event --post post-event --kind defer foo/bar | subenv ANTIDOTE_HOME +pre-event +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer ) + source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/foo/bar ) +zsh-defer source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh +zsh-defer post-event +% +``` + +## Private functions + +### __antidote_initfiles + +setup + +```zsh +% # load __antidote_initfiles from private funcs in antidote-script +% antidote-script -h &>/dev/null +% PLUGINDIR=$T_TEMPDIR/initfiles/myplugin +% mkdir -p $PLUGINDIR +% touch $PLUGINDIR/myplugin.plugin.zsh +% touch $PLUGINDIR/whatever.plugin.zsh +% touch $PLUGINDIR/file.zsh +% touch $PLUGINDIR/file.sh +% touch $PLUGINDIR/file.bash +% touch $PLUGINDIR/mytheme.zsh-theme +% touch $PLUGINDIR/README.md +% touch $PLUGINDIR/file +% mkdir -p $PLUGINDIR/lib +% touch $PLUGINDIR/lib/lib1.zsh +% touch $PLUGINDIR/lib/lib2.zsh +% touch $PLUGINDIR/lib/lib3.zsh +% +``` + +myplugin.plugin.zsh + +```zsh +% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR +$PLUGINDIR/myplugin.plugin.zsh +% rm $PLUGINDIR/myplugin.plugin.zsh +% +``` + +whatever.plugin.zsh + +```zsh +% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR +$PLUGINDIR/whatever.plugin.zsh +% rm $PLUGINDIR/whatever.plugin.zsh +% +``` + +file.zsh + +```zsh +% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR +$PLUGINDIR/file.zsh +% rm $PLUGINDIR/file.zsh +% +``` + +file.sh + +```zsh +% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR +$PLUGINDIR/file.sh +% rm $PLUGINDIR/file.sh +% +``` + +mytheme.zsh-theme + +```zsh +% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR +$PLUGINDIR/mytheme.zsh-theme +% rm $PLUGINDIR/mytheme.zsh-theme +% +``` + +lib + +```zsh +% __antidote_initfiles $PLUGINDIR/lib | subenv PLUGINDIR +$PLUGINDIR/lib/lib1.zsh +$PLUGINDIR/lib/lib2.zsh +$PLUGINDIR/lib/lib3.zsh +% +``` + +FAIL: no files left that match + +```zsh +% __antidote_initfiles $PLUGINDIR #=> --exit 1 +% +``` + +FAIL: Empty + +```zsh +% PLUGINDIR=$T_TEMPDIR/initfiles/foo +% mkdir -p $PLUGINDIR +% __antidote_initfiles $PLUGINDIR #=> --exit 1 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_cmd_update.md b/.antidote/tests/test_cmd_update.md new file mode 100644 index 0000000..be16a09 --- /dev/null +++ b/.antidote/tests/test_cmd_update.md @@ -0,0 +1,37 @@ +# antidote update tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Update + +```zsh +% antidote update +Updating bundles... +antidote: checking for updates: https://github.com/foo/bar +antidote: checking for updates: https://github.com/foo/baz +antidote: checking for updates: git@github.com:foo/qux +antidote: checking for updates: https://github.com/getantidote/zsh-defer +antidote: checking for updates: https://github.com/ohmy/ohmy +Waiting for bundle updates to complete... + +Bundle updates complete. + +Updating antidote... +antidote self-update complete. + +antidote version 1.9.7 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_fpath_rules.md b/.antidote/tests/test_fpath_rules.md new file mode 100644 index 0000000..93b17d5 --- /dev/null +++ b/.antidote/tests/test_fpath_rules.md @@ -0,0 +1,111 @@ +# antidote bundle fpath-rule: + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +By default, fpath is appended to: + +```zsh +% antidote bundle foo/bar kind:fpath +fpath+=( $HOME/.cache/antidote/foo/bar ) +% +``` + +fpath can be told to explicitly append, but it's unnecessary + +```zsh +% antidote bundle foo/bar kind:zsh fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% + +fpath can be prepended with fpath-rule:prepend + +```zsh +% antidote bundle foo/bar kind:fpath fpath-rule:prepend +fpath=( $HOME/.cache/antidote/foo/bar $fpath ) +% + +fpath rules can only be append/prepend + +```zsh +% antidote bundle foo/bar kind:fpath fpath-rule:append #=> --exit 0 +% antidote bundle foo/bar kind:fpath fpath-rule:prepend #=> --exit 0 +% antidote bundle foo/bar kind:fpath fpath-rule:foo 2>&1 +antidote: error: unexpected fpath rule: 'foo' +% + +fpath rules are also used for `kind:autoload` + +```zsh +% antidote bundle foo/baz path:baz kind:autoload fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/baz/baz ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +% antidote bundle foo/baz path:baz kind:autoload fpath-rule:prepend +fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath ) +builtin autoload -Uz $fpath[1]/*(N.:t) +% +``` + +fpath rules are also used for `autoload:funcdir` + +```zsh +% # Append +% antidote bundle foo/baz autoload:baz fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/baz/baz ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +fpath+=( $HOME/.cache/antidote/foo/baz ) +source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh +% # Prepend +% antidote bundle foo/baz autoload:baz fpath-rule:prepend +fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath ) +builtin autoload -Uz $fpath[1]/*(N.:t) +fpath=( $HOME/.cache/antidote/foo/baz $fpath ) +source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh +% +``` + +fpath rules can be set globally with a zstyle: + +`zstyle ':antidote:fpath' rule 'prepend'` + +```zsh +% zstyle ':antidote:fpath' rule 'prepend' +% antidote bundle foo/bar +fpath=( $HOME/.cache/antidote/foo/bar $fpath ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% antidote bundle foo/bar kind:fpath +fpath=( $HOME/.cache/antidote/foo/bar $fpath ) +% antidote bundle foo/baz path:baz kind:autoload +fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath ) +builtin autoload -Uz $fpath[1]/*(N.:t) +% +``` + +It is NOT recommended to do this, but if you choose to then explicit fpath-rules are +still respected: + +```zsh +% zstyle ':antidote:fpath' rule 'prepend' +% antidote bundle foo/bar fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +% antidote bundle foo/bar kind:fpath fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/bar ) +% antidote bundle foo/baz path:baz kind:autoload fpath-rule:append +fpath+=( $HOME/.cache/antidote/foo/baz/baz ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_helpers.md b/.antidote/tests/test_helpers.md new file mode 100644 index 0000000..6234cbb --- /dev/null +++ b/.antidote/tests/test_helpers.md @@ -0,0 +1,235 @@ +# antidote helper tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +## Safe removal + +Appease my paranoia and ensure that you can't remove a path you shouldn't be able to: + +```zsh +% __antidote_del -rf -- /foo/bar +antidote: Blocked attempt to rm path: '/foo/bar'. +% +``` + +## Pretty print path + +```zsh +% __antidote_print_path /foo/bar +/foo/bar +% __antidote_print_path $HOME/foo/bar +$HOME/foo/bar +% zstyle ':antidote:compatibility-mode' 'antibody' 'on' +% __antidote_print_path $HOME/foo/bar | subenv T_TEMPDIR +$T_TEMPDIR/foo/bar +% zstyle -d ':antidote:compatibility-mode' 'antibody' +% +``` + +## Bundle type + +```zsh +% __antidote_bundle_type $PWD/antidote.zsh +file +% __antidote_bundle_type $PWD/functions +dir +% __antidote_bundle_type '$PWD/antidote.zsh' +file +% __antidote_bundle_type \$PWD/functions +dir +% __antidote_bundle_type 'git@github.com:foo/bar.git' +sshurl +% __antidote_bundle_type 'https://github.com/foo/bar' +url +% __antidote_bundle_type 'https:/bad.com/foo/bar.git' +? +% __antidote_bundle_type '' +empty +% __antidote_bundle_type ' ' +empty +% __antidote_bundle_type /foo/bar +path +% __antidote_bundle_type /foobar +path +% __antidote_bundle_type foobar/ +relpath +% __antidote_bundle_type '~/foo/bar' +path +% __antidote_bundle_type '$foo/bar' +path +% __antidote_bundle_type \$ZDOTDIR/foo +path +% __antidote_bundle_type \$ZDOTDIR/.zsh_plugins.txt +file +% touch ~/.zshenv +% __antidote_bundle_type '~/.zshenv' +file +% __antidote_bundle_type '~/null' +path +% __antidote_bundle_type foo/bar +repo +% __antidote_bundle_type bar/baz.git +repo +% __antidote_bundle_type foo/bar/baz +relpath +% __antidote_bundle_type foobar +word +% __antidote_bundle_type foo bar baz +word +% __antidote_bundle_type 'foo bar baz' +word +% +``` + +## Bundle name + +```zsh +% __antidote_bundle_name $HOME/.zsh/custom/lib/lib1.zsh +$HOME/.zsh/custom/lib/lib1.zsh +% __antidote_bundle_name $HOME/.zsh/plugins/myplugin +$HOME/.zsh/plugins/myplugin +% __antidote_bundle_name 'git@github.com:foo/bar.git' +foo/bar +% __antidote_bundle_name 'https://github.com/foo/bar' +foo/bar +% __antidote_bundle_name 'https:/bad.com/foo/bar.git' +https:/bad.com/foo/bar.git +% __antidote_bundle_name '' + +% __antidote_bundle_name /foo/bar +/foo/bar +% __antidote_bundle_name /foobar +/foobar +% __antidote_bundle_name foobar/ +foobar/ +% __antidote_bundle_name '~/foo/bar' +$HOME/foo/bar +% __antidote_bundle_name '$foo/bar' +$foo/bar +% __antidote_bundle_name foo/bar +foo/bar +% __antidote_bundle_name bar/baz.git +bar/baz.git +% __antidote_bundle_name foo/bar/baz +foo/bar/baz +% __antidote_bundle_name foobar +foobar +% __antidote_bundle_name foo bar baz +foo +% __antidote_bundle_name 'foo bar baz' +foo bar baz +% +``` + +## Bundle dir + +```zsh +% zstyle ':antidote:bundle' use-friendly-names off +% # short repo +% __antidote_bundle_dir foo/bar | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar +% # repo url +% __antidote_bundle_dir https://github.com/foo/bar | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar +% # repo url.git +% __antidote_bundle_dir https://github.com/foo/bar.git | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar +% # repo ssh +% __antidote_bundle_dir git@github.com:foo/bar.git | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-bar +% # local dir +% __antidote_bundle_dir ~/foo/bar | subenv HOME +$HOME/foo/bar +% # another local dir +% __antidote_bundle_dir $ZDOTDIR/bar/baz | subenv ZDOTDIR +$ZDOTDIR/bar/baz +% +``` + +Use friendly names + +```zsh +% # short repo - friendly name +% zstyle ':antidote:bundle' use-friendly-names on +% __antidote_bundle_dir foo/bar | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/foo/bar +% # repo url - friendly name +% __antidote_bundle_dir https://github.com/bar/baz | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/bar/baz +% # ssh repo - friendly name +% __antidote_bundle_dir git@github.com:foo/qux.git | subenv ANTIDOTE_HOME +$ANTIDOTE_HOME/foo/qux +% +``` + +### To URL + +Short repos: + +```zsh +% __antidote_tourl ohmyzsh/ohmyzsh +https://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl sindresorhus/pure +https://github.com/sindresorhus/pure +% __antidote_tourl foo/bar +https://github.com/foo/bar +% +``` + +Proper URLs don't change: + +```zsh +% __antidote_tourl https://github.com/ohmyzsh/ohmyzsh +https://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl http://github.com/ohmyzsh/ohmyzsh +http://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl ssh://github.com/ohmyzsh/ohmyzsh +ssh://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl git://github.com/ohmyzsh/ohmyzsh +git://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl ftp://github.com/ohmyzsh/ohmyzsh +ftp://github.com/ohmyzsh/ohmyzsh +% __antidote_tourl git@github.com:sindresorhus/pure.git +git@github.com:sindresorhus/pure.git +% +``` + +## Collect input + +If we \ --file tmp_home/.zsh/.zsh_plugins.txt +% +``` + +If we \|pipe input it should output that. + +```zsh +% cat $ZDOTDIR/.zsh_plugins.txt | __antidote_collect_input #=> --file tmp_home/.zsh/.zsh_plugins.txt +% +``` + +If we pass argument it should output that. + +```zsh +% __antidote_collect_input 'a\nb\nc\n' +a +b +c + +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_real.md b/.antidote/tests/test_real.md new file mode 100644 index 0000000..f826b10 --- /dev/null +++ b/.antidote/tests/test_real.md @@ -0,0 +1,229 @@ +# antidote tests for real + +## antidote bundle + +### Setup + +```zsh +% TESTDATA=$PWD/tests/testdata/real +% source ./tests/_setup.zsh +% # do it for real! +% t_setup_real +% +``` + +### Config + +```zsh +% zstyle ':antidote:bundle:*' zcompile 'yes' +% +``` + +### Bundle + +Clone and generate bundle script + +```zsh +% antidote bundle <$TESTDATA/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh 2>/dev/null +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME #=> --file testdata/real/.zsh_plugins.zsh +% +``` + +Check to see that everything cloned + +```zsh +% antidote list | subenv ANTIDOTE_HOME #=> --file testdata/real/repo-list.txt +% +``` + +Test that everything compiled + +```zsh +% zwcfiles=($(ls $(antidote home)/**/*.zwc(N) | wc -l)) +% test $zwcfiles -gt 100 #=> --exit 0 +% +``` + +Test that everything updated + +```zsh +% rm -rf -- $(antidote home)/**/*.zwc(N) +% antidote update &>/dev/null +% zwcfiles=($(ls $(antidote home)/**/*.zwc(N) | wc -l)) +% test $zwcfiles -gt 100 #=> --exit 0 +% +``` + +Check to see that branch:br annotations properly changed the cloned branch + +```zsh +% branched_plugin="$ANTIDOTE_HOME/mattmc3/antidote" +% git -C $branched_plugin branch --show-current 2>/dev/null +pz +% +``` + +Test that `antidote purge --all` aborts when told "no". + +```zsh +% function test_exists { [[ -e "$1" ]] } +% zstyle ':antidote:purge:all' answer 'n' +% antidote purge --all #=> --exit 1 +% antidote list | subenv ANTIDOTE_HOME #=> --file testdata/real/repo-list.txt +% antidote list | wc -l | awk '{print $1}' +15 +% test_exists $ZDOTDIR/.zsh_plugins.zsh(.N) #=> --exit 0 +% test_exists $ZDOTDIR/.zsh_plugins*.bak(.N) #=> --exit 1 +% +``` + +Test that `antidote purge --all` does the work when told "yes". + +```zsh +% function test_exists { [[ -e "$1" ]] } +% zstyle ':antidote:purge:all' answer 'y' +% antidote purge --all | tail -n 1 #=> --exit 0 +Antidote purge complete. Be sure to start a new Zsh session. +% antidote list | wc -l | awk '{print $1}' +0 +% test_exists $ZDOTDIR/.zsh_plugins.zsh(.N) #=> --exit 1 +% test_exists $ZDOTDIR/.zsh_plugins*.bak(.N) #=> --exit 0 +% +``` + +### Teardown + +```zsh +% zstyle -d ':antidote:purge:all' answer +% t_teardown +% +``` + +## CRLF testing + +### Redo setup + +```zsh +% TESTDATA=$PWD/tests/testdata/real +% source ./tests/_setup.zsh +% t_setup_real +% +``` + +Clone and generate bundle script + +```zsh +% antidote bundle <$TESTDATA/.zsh_plugins.crlf.txt >$ZDOTDIR/.zsh_plugins.zsh 2>/dev/null +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/rupa/z ) +source $ANTIDOTE_HOME/rupa/z/z.sh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting ) +source $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-completions ) +source $ANTIDOTE_HOME/zsh-users/zsh-completions/zsh-completions.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions ) +source $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search ) +source $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +% +``` + +Check to see that everything cloned + +```zsh +% antidote list | subenv ANTIDOTE_HOME +https://github.com/rupa/z $ANTIDOTE_HOME/rupa/z +https://github.com/zsh-users/zsh-autosuggestions $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions +https://github.com/zsh-users/zsh-completions $ANTIDOTE_HOME/zsh-users/zsh-completions +https://github.com/zsh-users/zsh-history-substring-search $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search +https://github.com/zsh-users/zsh-syntax-highlighting $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting +% +``` + +### Teardown + +```zsh +% t_teardown +% +``` + +## antidote load + +### Redo setup + +```zsh +% TESTDATA=$PWD/tests/testdata/real +% source ./tests/_setup.zsh +% t_setup_real +% +``` + +### Load + +Load rupa/z + +```zsh +% zstyle ':antidote:bundle' use-friendly-names on +% echo "rupa/z" > $ZDOTDIR/.zsh_plugins.txt +% antidote load 2>&1 +# antidote cloning rupa/z... +% echo $+aliases[z] +1 +% wc -l <$ZDOTDIR/.zsh_plugins.zsh | sed 's/ //g' +2 +% (( ! $+aliases[z] )) || unalias z +% +``` + +Load re-generates .zsh_plugins.zsh when .zsh_plugins.txt changes + +```zsh +% compdir=$ANTIDOTE_HOME/zsh-users/zsh-completions/src +% (( $fpath[(Ie)$compdir] )) || echo "completions are not in fpath" +completions are not in fpath +% echo $+aliases[z] +0 +% +``` + +...add a new plugin + +```zsh +% wc -l <$ZDOTDIR/.zsh_plugins.txt | sed 's/ //g' +1 +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/rupa/z ) +source $ANTIDOTE_HOME/rupa/z/z.sh +% echo "zsh-users/zsh-completions path:src kind:fpath" >> $ZDOTDIR/.zsh_plugins.txt +% # static cache file hasn't changed yet +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/rupa/z ) +source $ANTIDOTE_HOME/rupa/z/z.sh +% +``` + +...now do `antidote load` and show that it actually loaded all plugins + +```zsh +% antidote load 2>&1 +# antidote cloning zsh-users/zsh-completions... +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME +fpath+=( $ANTIDOTE_HOME/rupa/z ) +source $ANTIDOTE_HOME/rupa/z/z.sh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-completions/src ) +% echo $+aliases[z] +1 +% (( $fpath[(Ie)$compdir] )) && echo "completions are in fpath" +completions are in fpath +% +% wc -l <$ZDOTDIR/.zsh_plugins.zsh | sed 's/ //g' +3 +% +``` + +### Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_setopts_special.md b/.antidote/tests/test_setopts_special.md new file mode 100644 index 0000000..a6f1899 --- /dev/null +++ b/.antidote/tests/test_setopts_special.md @@ -0,0 +1,41 @@ +# antidote handles special Zsh options + +## Setup + +Tests to handle special Zsh options. [#154](https://github.com/mattmc3/antidote/issues/154). + +```zsh +% source ./tests/_setup.zsh +% setopt KSH_ARRAYS SH_GLOB +% source ./antidote.zsh +% +``` + +# Ensure bundle works + +```zsh +% antidote bundle <$ZDOTDIR/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh +% cat $ZDOTDIR/.zsh_plugins.zsh | subenv #=> --file testdata/.zsh_plugins.zsh +% +``` + +# Ensure options remained + +```zsh +% [[ -o KSH_ARRAYS ]] && echo KSH_ARRAYS +KSH_ARRAYS +% [[ -o SH_GLOB ]] && echo SH_GLOB +SH_GLOB +% # unset +% unsetopt KSH_ARRAYS SH_GLOB +% [[ -o KSH_ARRAYS ]] && echo KSH_ARRAYS +% [[ -o SH_GLOB ]] && echo SH_GLOB +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_zcompile_bundle.md b/.antidote/tests/test_zcompile_bundle.md new file mode 100644 index 0000000..94cdbab --- /dev/null +++ b/.antidote/tests/test_zcompile_bundle.md @@ -0,0 +1,54 @@ +# antidote load tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +### General + +Ensure a compiled file does not exist: + +```zsh +% zstyle ':antidote:bundle:*' zcompile 'no' +% ! test -e $ZDOTDIR/custom/lib/lib1.zsh.zwc #=> --exit 0 +% antidote bundle $ZDOTDIR/custom/lib/lib1.zsh | subenv ZDOTDIR +source $ZDOTDIR/custom/lib/lib1.zsh +% ! test -e $ZDOTDIR/custom/lib/lib1.zsh.zwc #=> --exit 0 +% antidote bundle $ZDOTDIR/custom/plugins/mytheme | subenv ZDOTDIR +fpath+=( $ZDOTDIR/custom/plugins/mytheme ) +source $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme +% ! test -e $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme.zwc #=> --exit 0 +% +``` + +Ensure a compiled file exists: + +```zsh +% zstyle ':antidote:bundle:*' zcompile 'yes' +% ! test -e $ZDOTDIR/custom/lib/lib2.zsh.zwc #=> --exit 0 +% antidote bundle $ZDOTDIR/custom/lib/lib2.zsh | subenv ZDOTDIR +source $ZDOTDIR/custom/lib/lib2.zsh +% test -e $ZDOTDIR/custom/lib/lib2.zsh.zwc #=> --exit 0 +% # plugin +% antidote bundle $ZDOTDIR/custom/plugins/myplugin | subenv ZDOTDIR +fpath+=( $ZDOTDIR/custom/plugins/myplugin ) +source $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh +% test -e $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh.zwc #=> --exit 0 +% # zsh-theme +% antidote bundle $ZDOTDIR/custom/plugins/mytheme | subenv ZDOTDIR +fpath+=( $ZDOTDIR/custom/plugins/mytheme ) +source $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme +% test -e $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme.zwc #=> --exit 0 +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_zcompile_static.md b/.antidote/tests/test_zcompile_static.md new file mode 100644 index 0000000..7cbe36d --- /dev/null +++ b/.antidote/tests/test_zcompile_static.md @@ -0,0 +1,44 @@ +# antidote load tests + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +### General + +Ensure a compiled file exists: + +```zsh +% zstyle ':antidote:static' zcompile 'yes' +% zstyle ':antidote:static' file $ZDOTDIR/.zplugins_fake_zcompile_static.zsh +% ! test -e $ZDOTDIR/.zplugins_fake_zcompile_static.zsh.zwc #=> --exit 0 +% antidote load $ZDOTDIR/.zplugins_fake_load >/dev/null +% cat $ZDOTDIR/.zplugins_fake_zcompile_static.zsh | subenv #=> --file testdata/.zplugins_fake_zcompile_static.zsh +% test -e $ZDOTDIR/.zplugins_fake_zcompile_static.zsh.zwc #=> --exit 0 +% t_reset +% +``` + +Ensure a compiled file does not exist: + +```zsh +% zstyle ':antidote:static' zcompile 'no' +% zstyle ':antidote:static' file $ZDOTDIR/.zplugins_fake_load.zsh +% ! test -e $ZDOTDIR/.zplugins_fake_load.zsh.zwc #=> --exit 0 +% antidote load $ZDOTDIR/.zplugins_fake_load >/dev/null +% cat $ZDOTDIR/.zplugins_fake_load.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh +% ! test -e $ZDOTDIR/.zplugins_fake_load.zsh.zwc #=> --exit 0 +% t_reset +% +``` + +## Teardown + +```zsh +% t_teardown +% +``` diff --git a/.antidote/tests/test_zsetopts.md b/.antidote/tests/test_zsetopts.md new file mode 100644 index 0000000..89a384c --- /dev/null +++ b/.antidote/tests/test_zsetopts.md @@ -0,0 +1,84 @@ +# antidote respects setopts + +## Setup + +```zsh +% source ./tests/_setup.zsh +% source ./antidote.zsh +% +``` + +Set up a plugin that changes Zsh options +```zsh +% plugin_file=$ANTIDOTE_HOME/lampoon/xmas/xmas.plugin.zsh +% mkdir -p $plugin_file:h && touch $plugin_file +% echo "unsetopt noaliases" >>$plugin_file +% echo "setopt autocd" >>$plugin_file +% echo "lampoon/xmas" >$ZDOTDIR/.zsh_plugins.txt +% +``` + +## Test that plugins that run setopts work + +Verify initial state +```zsh +% setopt noaliases +% set -o | grep noaliases +noaliases on +% set -o | grep autocd +autocd off +% +``` + +Load the plugins and see if the option took +```zsh +% antidote load &>/dev/null #=> --exit 0 +% set -o | grep noaliases +noaliases off +% set -o | grep autocd +autocd on +% # cleanup +% setopt noaliases no_autocd +% +``` + +Tests to ensure [#86](https://github.com/mattmc3/antidote/issues/86) stays fixed. +Check that stderr is empty. +```zsh +% setopt posix_identifiers +% antidote -v 3>&1 2>&3 >/dev/null #=> --exit 0 + +% antidote -h 3>&1 2>&3 >/dev/null #=> --exit 0 + +% antidote help 3>&1 2>&3 >/dev/null #=> --exit 0 + +% # cleanup +% unsetopt posix_identifiers +% +``` + +## Clark Grizwold lighting ceremony! + +

via GIPHY

+ +```zsh +% optcnt=$(setopt | wc -l | tr -d ' ') +% echo $optcnt #=> --regex ^\d+$ +% test $optcnt -lt 10 && echo "less than 10 enabled zsh opts" +less than 10 enabled zsh opts +% # now lets turn on all the lights +% echo '$ZDOTDIR/custom/plugins/grizwold' >$ZDOTDIR/.zsh_plugins.txt +% antidote load +% optcnt=$(setopt | wc -l | tr -d ' ') +% test $optcnt -gt 150 && echo "zillions of enabled zsh options (>150)" +zillions of enabled zsh options (>150) +% +``` + +## Teardown + +```zsh +% unsetopt $grizwold_zopts +% t_teardown +% +``` diff --git a/.antidote/tests/testdata/.zplugins_fake_load.zsh b/.antidote/tests/testdata/.zplugins_fake_load.zsh new file mode 100644 index 0000000..cca0386 --- /dev/null +++ b/.antidote/tests/testdata/.zplugins_fake_load.zsh @@ -0,0 +1,25 @@ +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/qux ) +source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +export PATH="$HOME/.cache/antidote/foo/bar:$PATH" +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib ) +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh +fpath=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker $fpath ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer ) + source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter ) +zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh +source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/testdata/.zplugins_fake_zcompile_static.zsh b/.antidote/tests/testdata/.zplugins_fake_zcompile_static.zsh new file mode 100644 index 0000000..922326a --- /dev/null +++ b/.antidote/tests/testdata/.zplugins_fake_zcompile_static.zsh @@ -0,0 +1,34 @@ +function { + 0=${(%):-%x} + local staticfile=${0:A} + [[ -e ${staticfile} ]] || return 1 + if [[ ! -s ${staticfile}.zwc || ${staticfile} -nt ${staticfile}.zwc ]]; then + builtin autoload -Uz zrecompile + zrecompile -pq ${staticfile} + fi +} +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/qux ) +source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +export PATH="$HOME/.cache/antidote/foo/bar:$PATH" +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib ) +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh +fpath=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker $fpath ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer ) + source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter ) +zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh +source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/testdata/.zsh_plugins.zsh b/.antidote/tests/testdata/.zsh_plugins.zsh new file mode 100644 index 0000000..75188da --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins.zsh @@ -0,0 +1,25 @@ +fpath+=( $HOME/foo/bar ) +source $HOME/foo/bar/bar.plugin.zsh +fpath+=( $ZSH_CUSTOM/plugins/myplugin ) +source $ZSH_CUSTOM/plugins/myplugin/myplugin.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/qux ) +source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh +fpath+=( $HOME/.cache/antidote/foo/bar ) +export PATH="$HOME/.cache/antidote/foo/bar:$PATH" +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib ) +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh +source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract ) +source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer ) + source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter ) +zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh +source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/testdata/.zsh_plugins_empty.txt b/.antidote/tests/testdata/.zsh_plugins_empty.txt new file mode 100644 index 0000000..10e1f03 --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins_empty.txt @@ -0,0 +1,2 @@ +# comments +# nothing here diff --git a/.antidote/tests/testdata/.zsh_plugins_multi_defer.zsh b/.antidote/tests/testdata/.zsh_plugins_multi_defer.zsh new file mode 100644 index 0000000..f333e7b --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins_multi_defer.zsh @@ -0,0 +1,32 @@ +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +if is-macos; then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh +fi +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting ) +zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh diff --git a/.antidote/tests/testdata/.zsh_plugins_no_defer.zsh b/.antidote/tests/testdata/.zsh_plugins_no_defer.zsh new file mode 100644 index 0000000..5a86032 --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins_no_defer.zsh @@ -0,0 +1,20 @@ +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +if is-macos; then + fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos ) + source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh diff --git a/.antidote/tests/testdata/.zsh_plugins_purged.txt b/.antidote/tests/testdata/.zsh_plugins_purged.txt new file mode 100644 index 0000000..355d80f --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins_purged.txt @@ -0,0 +1,29 @@ +# local plugins +~/foo/bar +$ZSH_CUSTOM path:plugins/myplugin + +# repo plugins +# foo/bar +git@github.com:foo/qux.git # trailing comments + +# kind:clone +getantidote/zsh-defer kind:clone # more trailing comments + +# kind:zsh +# foo/bar kind:zsh + +# kind:fpath +# foo/bar kind:fpath + +# kind:path +# foo/bar kind:path + +# subpath plugins +ohmy/ohmy path:lib +ohmy/ohmy path:plugins/extract + +# deferred +ohmy/ohmy path:plugins/magic-enter kind:defer + +# theme +ohmy/ohmy path:custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/testdata/.zsh_plugins_repos.txt b/.antidote/tests/testdata/.zsh_plugins_repos.txt new file mode 100644 index 0000000..c23a74d --- /dev/null +++ b/.antidote/tests/testdata/.zsh_plugins_repos.txt @@ -0,0 +1,30 @@ +# comments +user/repo + +# blank lines + +# regular repos +https://github.com/user/repo +http://github.com/user/repo.git +https://github.com/user/repo +git@github.com:user/repo + +# annotations +bar/baz path:plugins/qux +bar/baz path:themes/qux.zsh-theme + +# branch +foobar/foobar branch:baz + +# defer +https://github.com/foo/qux kind:defer +https://github.com/foo/baz kind:defer + +# non repos +foo +~/.zplugins/bar +$ZDOTDIR/plugins/bar + +# dupes +user/repo +https://github.com/user/repo diff --git a/.antidote/tests/testdata/real/.zsh_plugins.crlf.txt b/.antidote/tests/testdata/real/.zsh_plugins.crlf.txt new file mode 100644 index 0000000..c51c2a3 --- /dev/null +++ b/.antidote/tests/testdata/real/.zsh_plugins.crlf.txt @@ -0,0 +1,6 @@ +# CRLF file +rupa/z +zsh-users/zsh-syntax-highlighting +zsh-users/zsh-completions +zsh-users/zsh-autosuggestions +zsh-users/zsh-history-substring-search diff --git a/.antidote/tests/testdata/real/.zsh_plugins.txt b/.antidote/tests/testdata/real/.zsh_plugins.txt new file mode 100644 index 0000000..aabfee0 --- /dev/null +++ b/.antidote/tests/testdata/real/.zsh_plugins.txt @@ -0,0 +1,52 @@ +# paths +#$ZDOTDIR/aliases.zsh +$ZSH_CUSTOM/plugins/myplugin + +# plugins +zsh-users/zsh-history-substring-search +https://github.com/zsh-users/zsh-autosuggestions + +# git@ repo URLs aren't good for CI... revisit +# git@github.com:zsh-users/zsh-completions.git + +# kind:zsh +zsh-users/zsh-syntax-highlighting kind:zsh + +# kind:clone +zsh-users/antigen kind:clone + +# kind:fpath +sindresorhus/pure kind:fpath + +# kind:path +romkatv/zsh-bench kind:path + +# kind:autoload +mattmc3/zman path:functions kind:autoload + +# fpath-rule +ohmyzsh/ohmyzsh path:plugins/gradle fpath-rule:prepend +ohmyzsh/ohmyzsh path:plugins/docker fpath-rule:append + +# conditional +ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos + +# branches +mattmc3/antidote branch:pz + +# subpath plugins +ohmyzsh/ohmyzsh path:lib/clipboard.zsh +ohmyzsh/ohmyzsh path:plugins/extract +ohmyzsh/ohmyzsh path:plugins/magic-enter +ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z + +# deferred +zdharma-continuum/fast-syntax-highlighting kind:defer + +# theme +dracula/zsh + +# non-conforming plugins +peterhurford/up.zsh +rummik/zsh-tailf +rupa/z diff --git a/.antidote/tests/testdata/real/.zsh_plugins.zsh b/.antidote/tests/testdata/real/.zsh_plugins.zsh new file mode 100644 index 0000000..17b16bb --- /dev/null +++ b/.antidote/tests/testdata/real/.zsh_plugins.zsh @@ -0,0 +1,43 @@ +fpath+=( $ZSH_CUSTOM/plugins/myplugin ) +source $ZSH_CUSTOM/plugins/myplugin/myplugin.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search ) +source $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions ) +source $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting ) +source $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/sindresorhus/pure ) +export PATH="$ANTIDOTE_HOME/romkatv/zsh-bench:$PATH" +fpath+=( $ANTIDOTE_HOME/mattmc3/zman/functions ) +builtin autoload -Uz $fpath[-1]/*(N.:t) +fpath=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/gradle $fpath ) +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/gradle/gradle.plugin.zsh +fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/docker ) +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/docker/docker.plugin.zsh +if is-macos; then + fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/macos ) + source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/macos/macos.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/mattmc3/antidote ) +source $ANTIDOTE_HOME/mattmc3/antidote/pz.plugin.zsh +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/lib/clipboard.zsh +fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/extract ) +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/extract/extract.plugin.zsh +fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/magic-enter ) +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/magic-enter/magic-enter.plugin.zsh +fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z ) +source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh +if ! (( $+functions[zsh-defer] )); then + fpath+=( $ANTIDOTE_HOME/romkatv/zsh-defer ) + source $ANTIDOTE_HOME/romkatv/zsh-defer/zsh-defer.plugin.zsh +fi +fpath+=( $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting ) +zsh-defer source $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh +fpath+=( $ANTIDOTE_HOME/dracula/zsh ) +source $ANTIDOTE_HOME/dracula/zsh/dracula.zsh-theme +fpath+=( $ANTIDOTE_HOME/peterhurford/up.zsh ) +source $ANTIDOTE_HOME/peterhurford/up.zsh/up.plugin.zsh +fpath+=( $ANTIDOTE_HOME/rummik/zsh-tailf ) +source $ANTIDOTE_HOME/rummik/zsh-tailf/tailf.plugin.zsh +fpath+=( $ANTIDOTE_HOME/rupa/z ) +source $ANTIDOTE_HOME/rupa/z/z.sh diff --git a/.antidote/tests/testdata/real/repo-list.txt b/.antidote/tests/testdata/real/repo-list.txt new file mode 100644 index 0000000..1bac45f --- /dev/null +++ b/.antidote/tests/testdata/real/repo-list.txt @@ -0,0 +1,15 @@ +https://github.com/dracula/zsh $ANTIDOTE_HOME/dracula/zsh +https://github.com/mattmc3/antidote $ANTIDOTE_HOME/mattmc3/antidote +https://github.com/mattmc3/zman $ANTIDOTE_HOME/mattmc3/zman +https://github.com/ohmyzsh/ohmyzsh $ANTIDOTE_HOME/ohmyzsh/ohmyzsh +https://github.com/peterhurford/up.zsh $ANTIDOTE_HOME/peterhurford/up.zsh +https://github.com/romkatv/zsh-bench $ANTIDOTE_HOME/romkatv/zsh-bench +https://github.com/romkatv/zsh-defer $ANTIDOTE_HOME/romkatv/zsh-defer +https://github.com/rummik/zsh-tailf $ANTIDOTE_HOME/rummik/zsh-tailf +https://github.com/rupa/z $ANTIDOTE_HOME/rupa/z +https://github.com/sindresorhus/pure $ANTIDOTE_HOME/sindresorhus/pure +https://github.com/zdharma-continuum/fast-syntax-highlighting $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting +https://github.com/zsh-users/antigen $ANTIDOTE_HOME/zsh-users/antigen +https://github.com/zsh-users/zsh-autosuggestions $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions +https://github.com/zsh-users/zsh-history-substring-search $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search +https://github.com/zsh-users/zsh-syntax-highlighting $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting diff --git a/.antidote/tests/testdata/script-foobar.zsh b/.antidote/tests/testdata/script-foobar.zsh new file mode 100644 index 0000000..2617997 --- /dev/null +++ b/.antidote/tests/testdata/script-foobar.zsh @@ -0,0 +1,2 @@ +fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar ) +source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh diff --git a/.antidote/tests/testdata/script-fooqux.zsh b/.antidote/tests/testdata/script-fooqux.zsh new file mode 100644 index 0000000..019484f --- /dev/null +++ b/.antidote/tests/testdata/script-fooqux.zsh @@ -0,0 +1,2 @@ +fpath+=( $ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-qux ) +source $ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-qux/qux.plugin.zsh diff --git a/.antidote/tests/tmp_home/.cache/antibody/git-AT-github.com-COLON-foo-SLASH-qux/.mockgit/.gitkeep b/.antidote/tests/tmp_home/.cache/antibody/git-AT-github.com-COLON-foo-SLASH-qux/.mockgit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.antidote/tests/tmp_home/.cache/antibody/git-AT-github.com-COLON-foo-SLASH-qux/qux.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/git-AT-github.com-COLON-foo-SLASH-qux/qux.plugin.zsh new file mode 100644 index 0000000..ef59ec0 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/git-AT-github.com-COLON-foo-SLASH-qux/qux.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/qux..." +plugins=($plugins foo/qux) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/.mockgit/.gitkeep b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/.mockgit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh new file mode 100644 index 0000000..b391747 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/bar..." +plugins=($plugins foo/bar) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/.mockgit/.gitkeep b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/.mockgit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/baz.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/baz.plugin.zsh new file mode 100644 index 0000000..7de75c6 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/baz.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/baz..." +plugins=($plugins foo/baz) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/_baz b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/_baz new file mode 100644 index 0000000..d61a639 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/_baz @@ -0,0 +1,2 @@ +#!/bin/zsh +echo _baz completion diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/baz b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/baz new file mode 100644 index 0000000..40e9f40 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-baz/functions/baz @@ -0,0 +1,5 @@ +#!/bin/zsh +function baz { + echo baz function +} +baz "$@" diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/.mockgit/.gitkeep b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/.mockgit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh new file mode 100644 index 0000000..20a8508 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh @@ -0,0 +1,6 @@ +# fake foo/bar +echo "sourcing getantidote/zsh-defer..." +plugins=($plugins getantidote/zsh-defer) +function zsh-defer { + $@ +} diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/.mockgit/.gitkeep b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/.mockgit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/pretty.zsh-theme b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/pretty.zsh-theme new file mode 100644 index 0000000..96e3a46 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/pretty.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing pretty.zsh-theme..." +themes=($themes ohmy:pretty) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/ugly.zsh-theme b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/ugly.zsh-theme new file mode 100644 index 0000000..4ecef6e --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/custom/themes/ugly.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing ugly.zsh-theme..." +themes=($themes ohmy:ugly) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib1.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib1.zsh new file mode 100644 index 0000000..fdbbf9f --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib1.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib1.zsh..." +libs=($libs ohmy:lib1) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib2.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib2.zsh new file mode 100644 index 0000000..790dee9 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib2.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib2.zsh..." +libs=($libs ohmy:lib2) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib3.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib3.zsh new file mode 100644 index 0000000..698757d --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/lib/lib3.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib3.zsh..." +libs=($libs ohmy:lib2) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/oh-my.sh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/oh-my.sh new file mode 100644 index 0000000..9f4ff77 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/oh-my.sh @@ -0,0 +1,2 @@ +echo "sourcing oh-my.sh..." +plugins=($plugins ohmy/ohmy) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/_docker b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/_docker new file mode 100644 index 0000000..8d50524 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/_docker @@ -0,0 +1 @@ +#compdef diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/docker.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/docker.plugin.zsh new file mode 100644 index 0000000..6ffd179 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/docker/docker.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing docker.plugin.zsh..." +plugins+=(ohmy:docker) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/extract/extract.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/extract/extract.plugin.zsh new file mode 100644 index 0000000..0631391 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/extract/extract.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing extract.plugin.zsh..." +plugins+=(ohmy:extract) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/functions/macos_func b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/functions/macos_func new file mode 100644 index 0000000..2d31f90 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/functions/macos_func @@ -0,0 +1,5 @@ +#!/bin/zsh +function macos_func { + echo macos_func "$@" +} +macos_func "$@" diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh new file mode 100644 index 0000000..443aa58 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing macos.plugin.zsh..." +plugins+=(ohmy:macos) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/magic-enter/magic-enter.plugin.zsh b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/magic-enter/magic-enter.plugin.zsh new file mode 100644 index 0000000..47d800e --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/magic-enter/magic-enter.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing magic-enter.plugin.zsh..." +plugins+=(ohmy:magic-enter) diff --git a/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/themes/pretty.zsh-theme b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/themes/pretty.zsh-theme new file mode 100644 index 0000000..96e3a46 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/themes/pretty.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing pretty.zsh-theme..." +themes=($themes ohmy:pretty) diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/bar/.mockgit/config/remote.origin.url b/.antidote/tests/tmp_home/.cache/antidote/foo/bar/.mockgit/config/remote.origin.url new file mode 100644 index 0000000..d39cfca --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/bar/.mockgit/config/remote.origin.url @@ -0,0 +1 @@ +https://github.com/foo/bar diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/bar/bar.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/foo/bar/bar.plugin.zsh new file mode 100644 index 0000000..b391747 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/bar/bar.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/bar..." +plugins=($plugins foo/bar) diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/baz/.mockgit/config/remote.origin.url b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/.mockgit/config/remote.origin.url new file mode 100644 index 0000000..75798f2 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/.mockgit/config/remote.origin.url @@ -0,0 +1 @@ +https://github.com/foo/baz diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/baz/baz.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/baz.plugin.zsh new file mode 100644 index 0000000..7de75c6 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/baz.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/baz..." +plugins=($plugins foo/baz) diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/_baz b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/_baz new file mode 100644 index 0000000..d61a639 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/_baz @@ -0,0 +1,2 @@ +#!/bin/zsh +echo _baz completion diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/baz b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/baz new file mode 100644 index 0000000..40e9f40 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/baz/functions/baz @@ -0,0 +1,5 @@ +#!/bin/zsh +function baz { + echo baz function +} +baz "$@" diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/qux/.mockgit/config/remote.origin.url b/.antidote/tests/tmp_home/.cache/antidote/foo/qux/.mockgit/config/remote.origin.url new file mode 100644 index 0000000..8d13ef7 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/qux/.mockgit/config/remote.origin.url @@ -0,0 +1 @@ +git@github.com:foo/qux diff --git a/.antidote/tests/tmp_home/.cache/antidote/foo/qux/qux.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/foo/qux/qux.plugin.zsh new file mode 100644 index 0000000..ef59ec0 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/foo/qux/qux.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing foo/qux..." +plugins=($plugins foo/qux) diff --git a/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/.mockgit/config/remote.origin.url b/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/.mockgit/config/remote.origin.url new file mode 100644 index 0000000..83ac51c --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/.mockgit/config/remote.origin.url @@ -0,0 +1 @@ +https://github.com/getantidote/zsh-defer diff --git a/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh new file mode 100644 index 0000000..20a8508 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh @@ -0,0 +1,6 @@ +# fake foo/bar +echo "sourcing getantidote/zsh-defer..." +plugins=($plugins getantidote/zsh-defer) +function zsh-defer { + $@ +} diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/.mockgit/config/remote.origin.url b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/.mockgit/config/remote.origin.url new file mode 100644 index 0000000..bdfaa9f --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/.mockgit/config/remote.origin.url @@ -0,0 +1 @@ +https://github.com/ohmy/ohmy diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme new file mode 100644 index 0000000..96e3a46 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing pretty.zsh-theme..." +themes=($themes ohmy:pretty) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/ugly.zsh-theme b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/ugly.zsh-theme new file mode 100644 index 0000000..4ecef6e --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/custom/themes/ugly.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing ugly.zsh-theme..." +themes=($themes ohmy:ugly) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib1.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib1.zsh new file mode 100644 index 0000000..fdbbf9f --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib1.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib1.zsh..." +libs=($libs ohmy:lib1) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib2.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib2.zsh new file mode 100644 index 0000000..790dee9 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib2.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib2.zsh..." +libs=($libs ohmy:lib2) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib3.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib3.zsh new file mode 100644 index 0000000..698757d --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/lib/lib3.zsh @@ -0,0 +1,2 @@ +echo "sourcing ohmy/lib/lib3.zsh..." +libs=($libs ohmy:lib2) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/oh-my.sh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/oh-my.sh new file mode 100644 index 0000000..9f4ff77 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/oh-my.sh @@ -0,0 +1,2 @@ +echo "sourcing oh-my.sh..." +plugins=($plugins ohmy/ohmy) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/_docker b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/_docker new file mode 100644 index 0000000..8d50524 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/_docker @@ -0,0 +1 @@ +#compdef diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh new file mode 100644 index 0000000..6ffd179 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing docker.plugin.zsh..." +plugins+=(ohmy:docker) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh new file mode 100644 index 0000000..0631391 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing extract.plugin.zsh..." +plugins+=(ohmy:extract) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/functions/macos_func b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/functions/macos_func new file mode 100644 index 0000000..2d31f90 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/functions/macos_func @@ -0,0 +1,5 @@ +#!/bin/zsh +function macos_func { + echo macos_func "$@" +} +macos_func "$@" diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/macos.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/macos.plugin.zsh new file mode 100644 index 0000000..443aa58 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/macos/macos.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing macos.plugin.zsh..." +plugins+=(ohmy:macos) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh new file mode 100644 index 0000000..47d800e --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh @@ -0,0 +1,2 @@ +echo "sourcing magic-enter.plugin.zsh..." +plugins+=(ohmy:magic-enter) diff --git a/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/themes/pretty.zsh-theme b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/themes/pretty.zsh-theme new file mode 100644 index 0000000..96e3a46 --- /dev/null +++ b/.antidote/tests/tmp_home/.cache/antidote/ohmy/ohmy/themes/pretty.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing pretty.zsh-theme..." +themes=($themes ohmy:pretty) diff --git a/.antidote/tests/tmp_home/.zsh/.zplugins_fake_load b/.antidote/tests/tmp_home/.zsh/.zplugins_fake_load new file mode 100644 index 0000000..8ed19d0 --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/.zplugins_fake_load @@ -0,0 +1,29 @@ +# repo plugins +foo/bar +git@github.com:foo/qux.git # trailing comments + +# kind:clone +getantidote/zsh-defer kind:clone # more trailing comments + +# kind:zsh +foo/bar kind:zsh + +# kind:fpath +foo/bar kind:fpath + +# kind:path +foo/bar kind:path + +# subpath plugins +ohmy/ohmy path:lib +ohmy/ohmy path:plugins/extract + +# fpath-rule +ohmy/ohmy path:plugins/docker fpath-rule:prepend +ohmy/ohmy path:plugins/docker fpath-rule:append + +# deferred +ohmy/ohmy path:plugins/magic-enter kind:defer + +# theme +ohmy/ohmy path:custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/tmp_home/.zsh/.zsh_plugins.txt b/.antidote/tests/tmp_home/.zsh/.zsh_plugins.txt new file mode 100644 index 0000000..1ebc6db --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/.zsh_plugins.txt @@ -0,0 +1,29 @@ +# local plugins +~/foo/bar +$ZSH_CUSTOM path:plugins/myplugin + +# repo plugins +foo/bar +git@github.com:foo/qux.git # trailing comments + +# kind:clone +getantidote/zsh-defer kind:clone # more trailing comments + +# kind:zsh +foo/bar kind:zsh + +# kind:fpath +foo/bar kind:fpath + +# kind:path +foo/bar kind:path + +# subpath plugins +ohmy/ohmy path:lib +ohmy/ohmy path:plugins/extract + +# deferred +ohmy/ohmy path:plugins/magic-enter kind:defer + +# theme +ohmy/ohmy path:custom/themes/pretty.zsh-theme diff --git a/.antidote/tests/tmp_home/.zsh/aliases.zsh b/.antidote/tests/tmp_home/.zsh/aliases.zsh new file mode 100644 index 0000000..df95e4a --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/aliases.zsh @@ -0,0 +1 @@ +echo "sourcing aliases.zsh..." diff --git a/.antidote/tests/tmp_home/.zsh/custom/lib/lib1.zsh b/.antidote/tests/tmp_home/.zsh/custom/lib/lib1.zsh new file mode 100644 index 0000000..1cf38dd --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/custom/lib/lib1.zsh @@ -0,0 +1,2 @@ +echo "sourcing custom lib1.zsh..." +libs=($libs custom:lib1) diff --git a/.antidote/tests/tmp_home/.zsh/custom/lib/lib2.zsh b/.antidote/tests/tmp_home/.zsh/custom/lib/lib2.zsh new file mode 100644 index 0000000..c858eed --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/custom/lib/lib2.zsh @@ -0,0 +1,2 @@ +echo "sourcing custom lib2.zsh..." +libs=($libs custom:lib2) diff --git a/.antidote/tests/tmp_home/.zsh/custom/plugins/grizwold/grizwold.plugin.zsh b/.antidote/tests/tmp_home/.zsh/custom/plugins/grizwold/grizwold.plugin.zsh new file mode 100644 index 0000000..6f076cb --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/custom/plugins/grizwold/grizwold.plugin.zsh @@ -0,0 +1,187 @@ +() { + setopt interactivecomments + typeset -ga grizwold_zopts=( + noaliases + aliasfuncdef + allexport + noalwayslastprompt + alwaystoend + appendcreate + noappendhistory + autocd + autocontinue + noautolist + noautomenu + autonamedirs + noautoparamkeys + noautoparamslash + autopushd + noautoremoveslash + autoresume + nobadpattern + nobanghist + nobareglobqual + bashautolist + bashrematch + nobeep + nobgnice + braceccl + bsdecho + nocaseglob + nocasematch + cbases + cdablevars + cdsilent + chasedots + chaselinks + nocheckjobs + nocheckrunningjobs + # noclobber + combiningchars + completealiases + completeinword + continueonerror + correct + correctall + cprecedences + cshjunkiehistory + cshjunkieloops + cshjunkiequotes + cshnullcmd + cshnullglob + nodebugbeforecmd + dvorak + emacs + noequals + # errexit + # errreturn + noevallineno + # noexec + extendedglob + extendedhistory + noflowcontrol + # forcefloat + nofunctionargzero + noglob + noglobalexport + # noglobalrcs + globassign + globcomplete + globdots + globstarshort + globsubst + nohashcmds + nohashdirs + hashexecutablesonly + nohashlistall + histallowclobber + nohistbeep + histexpiredupsfirst + histfcntllock + histfindnodups + histignorealldups + histignoredups + histignorespace + histlexwords + histnofunctions + histnostore + histreduceblanks + nohistsavebycopy + histsavenodups + histsubstpattern + histverify + nohup + ignorebraces + ignoreclosebraces + ignoreeof + incappendhistory + incappendhistorytime + # interactive + interactivecomments + # ksharrays + kshautoload + kshglob + # kshoptionprint + kshtypeset + kshzerosubscript + nolistambiguous + nolistbeep + listpacked + listrowsfirst + nolisttypes + localloops + # localoptions + localpatterns + localtraps + # login + longlistjobs + magicequalsubst + mailwarning + markdirs + menucomplete + # monitor + nomultibyte + nomultifuncdef + nomultios + nonomatch + nonotify + nullglob + numericglobsort + octalzeroes + overstrike + pathdirs + pathscript + pipefail + posixaliases + posixargzero + posixbuiltins + posixcd + posixidentifiers + posixjobs + # posixstrings + posixtraps + printeightbit + printexitvalue + # privileged + promptbang + nopromptcr + # nopromptpercent + nopromptsp + promptsubst + pushdignoredups + pushdminus + pushdsilent + pushdtohome + rcexpandparam + rcquotes + # norcs + recexact + rematchpcre + # restricted + rmstarsilent + rmstarwait + sharehistory + shfileexpansion + shglob + # shinstdin + shnullcmd + shoptionletters + noshortloops + shwordsplit + # singlecommand + singlelinezle + # sourcetrace + sunkeyboardhack + transientrprompt + trapsasync + typesetsilent + nounset + # verbose + # vi + warncreateglobal + warnnestedvar + # xtrace + # zle + ) + setopt $grizwold_zopts +} diff --git a/.antidote/tests/tmp_home/.zsh/custom/plugins/myplugin/myplugin.plugin.zsh b/.antidote/tests/tmp_home/.zsh/custom/plugins/myplugin/myplugin.plugin.zsh new file mode 100644 index 0000000..871e1c5 --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/custom/plugins/myplugin/myplugin.plugin.zsh @@ -0,0 +1,3 @@ +# fake foo/bar +echo "sourcing myplugin..." +plugins+=(custom:myplugin) diff --git a/.antidote/tests/tmp_home/.zsh/custom/plugins/mytheme/mytheme.zsh-theme b/.antidote/tests/tmp_home/.zsh/custom/plugins/mytheme/mytheme.zsh-theme new file mode 100644 index 0000000..51d3a8b --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/custom/plugins/mytheme/mytheme.zsh-theme @@ -0,0 +1,2 @@ +echo "sourcing mytheme..." +plugins+=(custom:mytheme) diff --git a/.antidote/tests/tmp_home/.zsh/functions/myfunc b/.antidote/tests/tmp_home/.zsh/functions/myfunc new file mode 100644 index 0000000..bb9ebd1 --- /dev/null +++ b/.antidote/tests/tmp_home/.zsh/functions/myfunc @@ -0,0 +1,5 @@ +#!/bin/zsh +function myfunc { + echo myfunc "$@" +} +myfunc "$@" diff --git a/.antidote/tools/buildman b/.antidote/tools/buildman new file mode 100755 index 0000000..3c2e0b8 --- /dev/null +++ b/.antidote/tools/buildman @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh + +# https://pandoc.org/demo/pandoc.1.md +# https://eddieantonio.ca/blog/2015/12/18/authoring-manpages-in-markdown-with-pandoc/ +# https://jeromebelleman.gitlab.io/posts/publishing/manpages/ + +0=${(%):-%x} +BASEDIR=${0:a:h:h} +TMPDIR=$BASEDIR/.tmp/buildman +[[ -d $TMPDIR ]] && command rm -rf $TMPDIR +mkdir -p $TMPDIR + +sedi() { + sed --version &> /dev/null && sed -i -- "$@" || sed -i "" "$@" +} + +for manpage in $BASEDIR/man/*.md; do + case ${manpage:t:r} in + footer|example) continue ;; + esac + print "Building ${manpage:t:r} manpage..." + [[ -d $BASEDIR/man/man1 ]] || mkdir -p $BASEDIR/man/man1 + + mdfile=$TMPDIR/${manpage:t}.md + cat ${manpage} > $mdfile + print "" >> $mdfile + cat $BASEDIR/man/footer.md >> $mdfile + + manfile=$BASEDIR/man/man1/${manpage:t:r}.1 + pandoc --standalone --to man ${mdfile} -o $manfile + + # strip pandoc version so that every manpage build doesn't need to + # result in a new commit just b/c pandoc has a minor point release. + pandoc_ver=$(pandoc -v | awk 'NR==1{print $2}') + sedi "s/Pandoc $pandoc_ver/Pandoc/g" $manfile +done diff --git a/.antidote/tools/bumpver b/.antidote/tools/bumpver new file mode 100755 index 0000000..258f3d5 --- /dev/null +++ b/.antidote/tools/bumpver @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh +0=${(%):-%x} +bumpversion --allow-dirty ${1:-revision} +newver=$(grep 'current_version' ${0:h:h}/.bumpversion.cfg | sed -E 's/^[^0-9]+(.*)$/\1/') +print "Version bumped to $newver." +print "Now run:" +print " git commit -am 'Bump version to $newver'" | tee >(pbcopy) diff --git a/.antidote/tools/run-clitests b/.antidote/tools/run-clitests new file mode 100755 index 0000000..7684d9e --- /dev/null +++ b/.antidote/tools/run-clitests @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh +0=${(%):-%x} +setopt extended_glob + +cd ${0:A:h:h} + +local o_unit o_rev +zparseopts -D -M -- -unit=o_unit -rev=o_rev || return 1 + +testfiles=() +if (( $# > 0 )); then + testfiles=($@) +elif (( $#o_unit )); then + testfiles=($PWD/tests/*.md~*test_real*~*foo*) +else + testfiles=($PWD/tests/*.md) +fi + +# if tests are run in reverse order, I can catch places where I didn't teardown properly +if (( $#o_rev )); then + testfiles=(${(O)testfiles}) +fi + +# foo example test command +# env -i PATH=$PATH FPATH=$FPATH \ +# zsh -f -- =clitest --list-run --progress dot --prompt '%' --color always $PWD/tests/foo.md + +env -i PATH=$PATH FPATH=$FPATH PAGER=cat \ + zsh -f -- \ + =clitest \ + --list-run --progress dot --prompt '%' \ + --color always \ + --pre-flight 'git --version; print $PWD $VENDOR $OSTYPE =zsh $ZSH_VERSION $ZSH_PATCHLEVEL' \ + -- $testfiles diff --git a/.antidote/tools/sloc b/.antidote/tools/sloc new file mode 100755 index 0000000..8ca635c --- /dev/null +++ b/.antidote/tools/sloc @@ -0,0 +1,13 @@ +#!/usr/bin/env zsh +0=${(%):-%x} +BASEDIR=${0:h:h} +cd $BASEDIR +print "loc:" +wc -l antidote.zsh ./functions/*(.) +print "sloc:" +for file in antidote.zsh ./functions/*(.); do + lines=$(awk '/^ *[^#]+$/{print}' $file | wc -l) + print $lines $file +done +print "sloc total:" +awk '/^ *[^#]+$/{print}' antidote.zsh ./functions/*(.) | wc -l diff --git a/linux/.clang-format b/.clang-format similarity index 100% rename from linux/.clang-format rename to .clang-format diff --git a/linux/.config/foot/foot.ini b/.config/foot/foot.ini similarity index 100% rename from linux/.config/foot/foot.ini rename to .config/foot/foot.ini diff --git a/nvim/init.lua b/.config/nvim/init.lua similarity index 100% rename from nvim/init.lua rename to .config/nvim/init.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..5678013 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,28 @@ +{ + "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, + "deadcolumn.nvim": { "branch": "master", "commit": "92c86f10bfba2717ca2280e2e759b047135d5288" }, + "dropbar.nvim": { "branch": "master", "commit": "d08bf6b5e2b3bf160050b0f991c1831bf05a7523" }, + "git-messenger.vim": { "branch": "master", "commit": "fd124457378a295a5d1036af4954b35d6b807385" }, + "gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lsp_signature.nvim": { "branch": "master", "commit": "0efb088dce050d38a3608ee69f80f2a62cf9849c" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c953789db7fd28eafe5eb5659846d34b5024b3cc" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" }, + "nord.nvim": { "branch": "main", "commit": "07647ad23e5b7fc1599a841dcd8f173b9aeb0419" }, + "nvim-lspconfig": { "branch": "master", "commit": "3f58aeca0c6ece8a9fb8782ea3fcb6024f285be3" }, + "nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" }, + "nvim-tree.lua": { "branch": "master", "commit": "037d89e60fb01a6c11a48a19540253b8c72a3c32" }, + "nvim-treesitter": { "branch": "main", "commit": "4967fa48b0fe7a7f92cee546c76bb4bb61bb14d5" }, + "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "refactoring.nvim": { "branch": "master", "commit": "6784b54587e6d8a6b9ea199318512170ffb9e418" }, + "stcursorword": { "branch": "main", "commit": "ab099f1682a0b251cda8f089d028a31426b83a06" }, + "telescope-hierarchy.nvim": { "branch": "main", "commit": "85fb67112daf99f3918531558ee85a36c1891f91" }, + "telescope-menufacture": { "branch": "main", "commit": "751aca3f022039874790024b3cf25d643e335612" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua similarity index 100% rename from nvim/lua/config/init.lua rename to .config/nvim/lua/config/init.lua diff --git a/nvim/lua/config/keybinds.lua b/.config/nvim/lua/config/keybinds.lua similarity index 100% rename from nvim/lua/config/keybinds.lua rename to .config/nvim/lua/config/keybinds.lua diff --git a/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua similarity index 100% rename from nvim/lua/config/lazy.lua rename to .config/nvim/lua/config/lazy.lua diff --git a/nvim/lua/config/lsp.lua b/.config/nvim/lua/config/lsp.lua similarity index 100% rename from nvim/lua/config/lsp.lua rename to .config/nvim/lua/config/lsp.lua diff --git a/nvim/lua/config/rest.lua b/.config/nvim/lua/config/rest.lua similarity index 100% rename from nvim/lua/config/rest.lua rename to .config/nvim/lua/config/rest.lua diff --git a/nvim/lua/config/settings.lua b/.config/nvim/lua/config/settings.lua similarity index 100% rename from nvim/lua/config/settings.lua rename to .config/nvim/lua/config/settings.lua diff --git a/nvim/lua/plugins_base/deadcolumn.lua b/.config/nvim/lua/plugins_base/deadcolumn.lua similarity index 100% rename from nvim/lua/plugins_base/deadcolumn.lua rename to .config/nvim/lua/plugins_base/deadcolumn.lua diff --git a/nvim/lua/plugins_base/dropbar.lua b/.config/nvim/lua/plugins_base/dropbar.lua similarity index 100% rename from nvim/lua/plugins_base/dropbar.lua rename to .config/nvim/lua/plugins_base/dropbar.lua diff --git a/nvim/lua/plugins_base/git-messenger.lua b/.config/nvim/lua/plugins_base/git-messenger.lua similarity index 100% rename from nvim/lua/plugins_base/git-messenger.lua rename to .config/nvim/lua/plugins_base/git-messenger.lua diff --git a/nvim/lua/plugins_base/gitsigns.lua b/.config/nvim/lua/plugins_base/gitsigns.lua similarity index 100% rename from nvim/lua/plugins_base/gitsigns.lua rename to .config/nvim/lua/plugins_base/gitsigns.lua diff --git a/nvim/lua/plugins_base/indent-blankline.lua b/.config/nvim/lua/plugins_base/indent-blankline.lua similarity index 100% rename from nvim/lua/plugins_base/indent-blankline.lua rename to .config/nvim/lua/plugins_base/indent-blankline.lua diff --git a/nvim/lua/plugins_base/mini_icons.lua b/.config/nvim/lua/plugins_base/mini_icons.lua similarity index 100% rename from nvim/lua/plugins_base/mini_icons.lua rename to .config/nvim/lua/plugins_base/mini_icons.lua diff --git a/nvim/lua/plugins_base/nord.lua b/.config/nvim/lua/plugins_base/nord.lua similarity index 100% rename from nvim/lua/plugins_base/nord.lua rename to .config/nvim/lua/plugins_base/nord.lua diff --git a/nvim/lua/plugins_base/nvim-surround.lua b/.config/nvim/lua/plugins_base/nvim-surround.lua similarity index 100% rename from nvim/lua/plugins_base/nvim-surround.lua rename to .config/nvim/lua/plugins_base/nvim-surround.lua diff --git a/nvim/lua/plugins_base/nvim-tree.lua b/.config/nvim/lua/plugins_base/nvim-tree.lua similarity index 100% rename from nvim/lua/plugins_base/nvim-tree.lua rename to .config/nvim/lua/plugins_base/nvim-tree.lua diff --git a/.config/nvim/lua/plugins_base/nvim-treesitter.lua b/.config/nvim/lua/plugins_base/nvim-treesitter.lua new file mode 100644 index 0000000..b184942 --- /dev/null +++ b/.config/nvim/lua/plugins_base/nvim-treesitter.lua @@ -0,0 +1,5 @@ +return { + "nvim-treesitter/nvim-treesitter", + lazy = false, + build = ':TSUpdate' +} diff --git a/nvim/lua/plugins_base/refactoring.lua b/.config/nvim/lua/plugins_base/refactoring.lua similarity index 100% rename from nvim/lua/plugins_base/refactoring.lua rename to .config/nvim/lua/plugins_base/refactoring.lua diff --git a/nvim/lua/plugins_base/statusline.lua b/.config/nvim/lua/plugins_base/statusline.lua similarity index 100% rename from nvim/lua/plugins_base/statusline.lua rename to .config/nvim/lua/plugins_base/statusline.lua diff --git a/nvim/lua/plugins_base/stcursorword.lua b/.config/nvim/lua/plugins_base/stcursorword.lua similarity index 100% rename from nvim/lua/plugins_base/stcursorword.lua rename to .config/nvim/lua/plugins_base/stcursorword.lua diff --git a/nvim/lua/plugins_base/telescope.lua b/.config/nvim/lua/plugins_base/telescope.lua similarity index 100% rename from nvim/lua/plugins_base/telescope.lua rename to .config/nvim/lua/plugins_base/telescope.lua diff --git a/nvim/lua/plugins_base/toggleterm.lua b/.config/nvim/lua/plugins_base/toggleterm.lua similarity index 100% rename from nvim/lua/plugins_base/toggleterm.lua rename to .config/nvim/lua/plugins_base/toggleterm.lua diff --git a/nvim/lua/plugins_base/which-key.lua b/.config/nvim/lua/plugins_base/which-key.lua similarity index 100% rename from nvim/lua/plugins_base/which-key.lua rename to .config/nvim/lua/plugins_base/which-key.lua diff --git a/nvim/lua/plugins_lsp/lsp.lua b/.config/nvim/lua/plugins_lsp/lsp.lua similarity index 100% rename from nvim/lua/plugins_lsp/lsp.lua rename to .config/nvim/lua/plugins_lsp/lsp.lua diff --git a/starship.toml b/.config/starship.toml similarity index 100% rename from starship.toml rename to .config/starship.toml diff --git a/.fonts/.uuid b/.fonts/.uuid new file mode 100644 index 0000000..de875de --- /dev/null +++ b/.fonts/.uuid @@ -0,0 +1 @@ +e40482cd-b835-44ad-821e-bce6b46f42fc \ No newline at end of file diff --git a/linux/.fonts/CommitMono-400-Italic.otf b/.fonts/CommitMono-400-Italic.otf similarity index 100% rename from linux/.fonts/CommitMono-400-Italic.otf rename to .fonts/CommitMono-400-Italic.otf diff --git a/linux/.fonts/CommitMono-400-Regular.otf b/.fonts/CommitMono-400-Regular.otf similarity index 100% rename from linux/.fonts/CommitMono-400-Regular.otf rename to .fonts/CommitMono-400-Regular.otf diff --git a/linux/.fonts/CommitMono-700-Italic.otf b/.fonts/CommitMono-700-Italic.otf similarity index 100% rename from linux/.fonts/CommitMono-700-Italic.otf rename to .fonts/CommitMono-700-Italic.otf diff --git a/linux/.fonts/CommitMono-700-Regular.otf b/.fonts/CommitMono-700-Regular.otf similarity index 100% rename from linux/.fonts/CommitMono-700-Regular.otf rename to .fonts/CommitMono-700-Regular.otf diff --git a/linux/.fonts/CommitMonoNerdFont-Bold.otf b/.fonts/CommitMonoNerdFont-Bold.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFont-Bold.otf rename to .fonts/CommitMonoNerdFont-Bold.otf diff --git a/linux/.fonts/CommitMonoNerdFont-BoldItalic.otf b/.fonts/CommitMonoNerdFont-BoldItalic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFont-BoldItalic.otf rename to .fonts/CommitMonoNerdFont-BoldItalic.otf diff --git a/linux/.fonts/CommitMonoNerdFont-Italic.otf b/.fonts/CommitMonoNerdFont-Italic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFont-Italic.otf rename to .fonts/CommitMonoNerdFont-Italic.otf diff --git a/linux/.fonts/CommitMonoNerdFont-Regular.otf b/.fonts/CommitMonoNerdFont-Regular.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFont-Regular.otf rename to .fonts/CommitMonoNerdFont-Regular.otf diff --git a/linux/.fonts/CommitMonoNerdFontMono-Bold.otf b/.fonts/CommitMonoNerdFontMono-Bold.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontMono-Bold.otf rename to .fonts/CommitMonoNerdFontMono-Bold.otf diff --git a/linux/.fonts/CommitMonoNerdFontMono-BoldItalic.otf b/.fonts/CommitMonoNerdFontMono-BoldItalic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontMono-BoldItalic.otf rename to .fonts/CommitMonoNerdFontMono-BoldItalic.otf diff --git a/linux/.fonts/CommitMonoNerdFontMono-Italic.otf b/.fonts/CommitMonoNerdFontMono-Italic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontMono-Italic.otf rename to .fonts/CommitMonoNerdFontMono-Italic.otf diff --git a/linux/.fonts/CommitMonoNerdFontMono-Regular.otf b/.fonts/CommitMonoNerdFontMono-Regular.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontMono-Regular.otf rename to .fonts/CommitMonoNerdFontMono-Regular.otf diff --git a/linux/.fonts/CommitMonoNerdFontPropo-Bold.otf b/.fonts/CommitMonoNerdFontPropo-Bold.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontPropo-Bold.otf rename to .fonts/CommitMonoNerdFontPropo-Bold.otf diff --git a/linux/.fonts/CommitMonoNerdFontPropo-BoldItalic.otf b/.fonts/CommitMonoNerdFontPropo-BoldItalic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontPropo-BoldItalic.otf rename to .fonts/CommitMonoNerdFontPropo-BoldItalic.otf diff --git a/linux/.fonts/CommitMonoNerdFontPropo-Italic.otf b/.fonts/CommitMonoNerdFontPropo-Italic.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontPropo-Italic.otf rename to .fonts/CommitMonoNerdFontPropo-Italic.otf diff --git a/linux/.fonts/CommitMonoNerdFontPropo-Regular.otf b/.fonts/CommitMonoNerdFontPropo-Regular.otf similarity index 100% rename from linux/.fonts/CommitMonoNerdFontPropo-Regular.otf rename to .fonts/CommitMonoNerdFontPropo-Regular.otf diff --git a/linux/.local/share/konsole/main.profile b/.local/share/konsole/main.profile similarity index 100% rename from linux/.local/share/konsole/main.profile rename to .local/share/konsole/main.profile diff --git a/linux/.local/share/konsole/nord.colorscheme b/.local/share/konsole/nord.colorscheme similarity index 100% rename from linux/.local/share/konsole/nord.colorscheme rename to .local/share/konsole/nord.colorscheme diff --git a/linux/.tmux.conf b/.tmux.conf similarity index 100% rename from linux/.tmux.conf rename to .tmux.conf diff --git a/.tmux/plugins/tpm/.gitattributes b/.tmux/plugins/tpm/.gitattributes new file mode 100644 index 0000000..80772e4 --- /dev/null +++ b/.tmux/plugins/tpm/.gitattributes @@ -0,0 +1,9 @@ +# Force text files to have unix eols, so Windows/Cygwin does not break them +*.* eol=lf + +# These files are unfortunately not recognized as text files so +# explicitly listing them here +tpm eol=lf +bin/* eol=lf +bindings/* eol=lf +tests/* eol=lf diff --git a/.tmux/plugins/tpm/.gitignore b/.tmux/plugins/tpm/.gitignore new file mode 100644 index 0000000..8a94156 --- /dev/null +++ b/.tmux/plugins/tpm/.gitignore @@ -0,0 +1,4 @@ +**/.vagrant/ +run_tests +tests/run_tests_in_isolation +tests/helpers/helpers.sh diff --git a/.tmux/plugins/tpm/.gitmodules b/.tmux/plugins/tpm/.gitmodules new file mode 100644 index 0000000..5e44e3c --- /dev/null +++ b/.tmux/plugins/tpm/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/tmux-test"] + path = lib/tmux-test + url = https://github.com/tmux-plugins/tmux-test.git diff --git a/.tmux/plugins/tpm/.travis.yml b/.tmux/plugins/tpm/.travis.yml new file mode 100644 index 0000000..ac45d8b --- /dev/null +++ b/.tmux/plugins/tpm/.travis.yml @@ -0,0 +1,19 @@ +# generic packages and tmux +before_install: + - sudo apt-get update + - sudo apt-get install -y git-core expect + - sudo apt-get install -y python-software-properties software-properties-common + - sudo apt-get install -y libevent-dev libncurses-dev + - git clone https://github.com/tmux/tmux.git + - cd tmux + - git checkout 2.0 + - sh autogen.sh + - ./configure && make && sudo make install + +install: + - git fetch --unshallow --recurse-submodules || git fetch --recurse-submodules + # manual `git clone` required for testing `tmux-test` plugin itself + - git clone https://github.com/tmux-plugins/tmux-test lib/tmux-test; true + - lib/tmux-test/setup + +script: ./tests/run_tests_in_isolation diff --git a/.tmux/plugins/tpm/CHANGELOG.md b/.tmux/plugins/tpm/CHANGELOG.md new file mode 100644 index 0000000..a9ce81e --- /dev/null +++ b/.tmux/plugins/tpm/CHANGELOG.md @@ -0,0 +1,86 @@ +# Changelog + +### master + +### v3.1.0, 2023-01-03 +- upgrade to new version of `tmux-test` +- bug: when using `emacs` copy mode, Enter does not quit screen after tpm + installation/update. Fix by making `Escape` the key for emacs mode. +- add a doc with troubleshooting instructions +- add `.gitattributes` file that forces linefeed characters (classic `\n`) as + line endings - helps with misconfigured git on windows/cygwin +- readme update: announce Cygwin support +- un-deprecate old plugin definition syntax: `set -g @tpm_plugins` +- More stuff, check `git log`. + +### v3.0.0, 2015-08-03 +- refactor `shared_set_tpm_path_constant` function +- move all instructions to `docs/` dir +- add `bin/install_plugins` cli executable script +- improved test runner function +- switch to using [tmux-test](https://github.com/tmux-plugins/tmux-test) + framework +- add `bin/update_plugins` cli executable script +- refactor test `expect` scripts, make them simpler and ensure they properly + assert expectations +- refactor code that sets 'TMUX_PLUGIN_MANAGER_PATH' global env var +- stop using global variable for 'tpm path' +- support defining plugins via `set -g @plugin` in sourced files as well + +### v2.0.0, 2015-07-07 +- enable overriding default key bindings +- start using `C-c` to clear screen +- add uninstall/clean procedure and keybinding (prefix+alt+u) (@chilicuil) +- add new `set @plugin 'repo'` plugin definition syntax (@chilicuil) +- revert back to using `-g` flag in new plugin definition syntax +- permit leading whitespace with new plugin definition syntax (thanks @chilicuil) +- make sure `TMUX_PLUGIN_MANAGER_PATH` always has trailng slash +- ensure old/deprecated plugin syntax `set -g @tpm_plugins` works alongside new + `set -g @plugin` syntax + +### v1.2.2, 2015-02-08 +- set GIT_TERMINAL_PROMPT=0 when doing `git clone`, `pull` or `submodule update` + to ensure git does not prompt for username/password in any case + +### v1.2.1, 2014-11-21 +- change the way plugin name is expanded. It now uses the http username + and password by default, like this: `https://git::@github.com/`. This prevents + username and password prompt (and subsequently tmux install hanging) with old + git versions. Fixes #7. + +### v1.2.0, 2014-11-20 +- refactor tests so they can be used on travis +- add travis.yml, add travis badge to the readme + +### v1.1.0, 2014-11-19 +- if the plugin is not downloaded do not source it +- remove `PLUGINS.md`, an obsolete list of plugins +- update readme with instructions about uninstalling plugins +- tilde char and `$HOME` in `TMUX_SHARED_MANAGER_PATH` couldn't be used because + they are just plain strings. Fixing the problem by manually expanding them. +- bugfix: fragile `*.tmux` file globbing (@majutsushi) + +### v1.0.0, 2014-08-05 +- update readme because of github organization change to + [tmux-plugins](https://github.com/tmux-plugins) +- update tests to pass +- update README to suggest different first plugin +- update list of plugins in the README +- remove README 'about' section +- move key binding to the main file. Delete `key_binding.sh`. +- rename `display_message` -> `echo_message` +- installing plugins installs just new plugins. Already installed plugins aren't + updated. +- add 'update plugin' binding and functionality +- add test for updating a plugin + +### v0.0.2, 2014-07-17 +- run all *.tmux plugin files as executables +- fix all redirects to /dev/null +- fix bug: TPM shared path is created before sync (cloning plugins from github + is done) +- add test suite running in Vagrant +- add Tmux version check. `TPM` won't run if Tmux version is less than 1.9. + +### v0.0.1, 2014-05-21 +- get TPM up and running diff --git a/.tmux/plugins/tpm/HOW_TO_PLUGIN.md b/.tmux/plugins/tpm/HOW_TO_PLUGIN.md new file mode 100644 index 0000000..9901619 --- /dev/null +++ b/.tmux/plugins/tpm/HOW_TO_PLUGIN.md @@ -0,0 +1,2 @@ +Instructions moved to +[docs/how_to_create_plugin.md](docs/how_to_create_plugin.md). diff --git a/.tmux/plugins/tpm/LICENSE.md b/.tmux/plugins/tpm/LICENSE.md new file mode 100644 index 0000000..1222865 --- /dev/null +++ b/.tmux/plugins/tpm/LICENSE.md @@ -0,0 +1,20 @@ +MIT license +Copyright (C) 2014 Bruno Sutic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.tmux/plugins/tpm/README.md b/.tmux/plugins/tpm/README.md new file mode 100644 index 0000000..2371863 --- /dev/null +++ b/.tmux/plugins/tpm/README.md @@ -0,0 +1,101 @@ +# Tmux Plugin Manager + +[![Build Status](https://travis-ci.org/tmux-plugins/tpm.svg?branch=master)](https://travis-ci.org/tmux-plugins/tpm) + +Installs and loads `tmux` plugins. + +Tested and working on Linux, OSX, and Cygwin. + +See list of plugins [here](https://github.com/tmux-plugins/list). + +### Installation + +Requirements: `tmux` version 1.9 (or higher), `git`, `bash`. + +Clone TPM: + +```bash +git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +``` + +Put this at the bottom of `~/.tmux.conf` (`$XDG_CONFIG_HOME/tmux/tmux.conf` +works too): + +```bash +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +# Other examples: +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'github_username/plugin_name#branch' +# set -g @plugin 'git@github.com:user/plugin' +# set -g @plugin 'git@bitbucket.com:user/plugin' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' +``` + +Reload TMUX environment so TPM is sourced: + +```bash +# type this in terminal if tmux is already running +tmux source ~/.tmux.conf +``` + +That's it! + +### Installing plugins + +1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` +2. Press `prefix` + I (capital i, as in **I**nstall) to fetch the plugin. + +You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced. + +### Uninstalling plugins + +1. Remove (or comment out) plugin from the list. +2. Press `prefix` + alt + u (lowercase u as in **u**ninstall) to remove the plugin. + +All the plugins are installed to `~/.tmux/plugins/` so alternatively you can +find plugin directory there and remove it. + +### Key bindings + +`prefix` + I +- Installs new plugins from GitHub or any other git repository +- Refreshes TMUX environment + +`prefix` + U +- updates plugin(s) + +`prefix` + alt + u +- remove/uninstall plugins not on the plugin list + +### Docs + +- [Help, tpm not working](docs/tpm_not_working.md) - problem solutions + +More advanced features and instructions, regular users probably do not need +this: + +- [How to create a plugin](docs/how_to_create_plugin.md). It's easy. +- [Managing plugins via the command line](docs/managing_plugins_via_cmd_line.md) +- [Changing plugins install dir](docs/changing_plugins_install_dir.md) +- [Automatic TPM installation on a new machine](docs/automatic_tpm_installation.md) + +### Tests + +Tests for this project run on [Travis CI](https://travis-ci.org/tmux-plugins/tpm). + +When run locally, [vagrant](https://www.vagrantup.com/) is required. +Run tests with: + +```bash +# within project directory +./run_tests +``` + +### License + +[MIT](LICENSE.md) diff --git a/.tmux/plugins/tpm/bin/clean_plugins b/.tmux/plugins/tpm/bin/clean_plugins new file mode 100755 index 0000000..12f8730 --- /dev/null +++ b/.tmux/plugins/tpm/bin/clean_plugins @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" + +main() { + "$SCRIPTS_DIR/clean_plugins.sh" # has correct exit code +} +main diff --git a/.tmux/plugins/tpm/bin/install_plugins b/.tmux/plugins/tpm/bin/install_plugins new file mode 100755 index 0000000..c66b15b --- /dev/null +++ b/.tmux/plugins/tpm/bin/install_plugins @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" + +main() { + "$SCRIPTS_DIR/install_plugins.sh" # has correct exit code +} +main diff --git a/.tmux/plugins/tpm/bin/update_plugins b/.tmux/plugins/tpm/bin/update_plugins new file mode 100755 index 0000000..30a5646 --- /dev/null +++ b/.tmux/plugins/tpm/bin/update_plugins @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +PROGRAM_NAME="$0" + +if [ $# -eq 0 ]; then + echo "usage:" + echo " $PROGRAM_NAME all update all plugins" + echo " $PROGRAM_NAME tmux-foo update plugin 'tmux-foo'" + echo " $PROGRAM_NAME tmux-bar tmux-baz update multiple plugins" + exit 1 +fi + +main() { + "$SCRIPTS_DIR/update_plugin.sh" --shell-echo "$*" # has correct exit code +} +main "$*" + diff --git a/.tmux/plugins/tpm/bindings/clean_plugins b/.tmux/plugins/tpm/bindings/clean_plugins new file mode 100755 index 0000000..9a0d5d7 --- /dev/null +++ b/.tmux/plugins/tpm/bindings/clean_plugins @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + reload_tmux_environment + "$SCRIPTS_DIR/clean_plugins.sh" --tmux-echo >/dev/null 2>&1 + reload_tmux_environment + end_message +} +main diff --git a/.tmux/plugins/tpm/bindings/install_plugins b/.tmux/plugins/tpm/bindings/install_plugins new file mode 100755 index 0000000..3ade3c4 --- /dev/null +++ b/.tmux/plugins/tpm/bindings/install_plugins @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + reload_tmux_environment + "$SCRIPTS_DIR/install_plugins.sh" --tmux-echo >/dev/null 2>&1 + reload_tmux_environment + end_message +} +main diff --git a/.tmux/plugins/tpm/bindings/update_plugins b/.tmux/plugins/tpm/bindings/update_plugins new file mode 100755 index 0000000..28cc281 --- /dev/null +++ b/.tmux/plugins/tpm/bindings/update_plugins @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +# This script: +# - shows a list of installed plugins +# - starts a prompt to enter the name of the plugin that will be updated + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +display_plugin_update_list() { + local plugins="$(tpm_plugins_list_helper)" + tmux_echo "Installed plugins:" + tmux_echo "" + + for plugin in $plugins; do + # displaying only installed plugins + if plugin_already_installed "$plugin"; then + local plugin_name="$(plugin_name_helper "$plugin")" + tmux_echo " $plugin_name" + fi + done + + tmux_echo "" + tmux_echo "Type plugin name to update it." + tmux_echo "" + tmux_echo "- \"all\" - updates all plugins" + tmux_echo "- ENTER - cancels" +} + +update_plugin_prompt() { + tmux command-prompt -p 'plugin update:' " \ + send-keys C-c; \ + run-shell '$SCRIPTS_DIR/update_plugin_prompt_handler.sh %1'" +} + +main() { + reload_tmux_environment + display_plugin_update_list + update_plugin_prompt +} +main diff --git a/.tmux/plugins/tpm/docs/automatic_tpm_installation.md b/.tmux/plugins/tpm/docs/automatic_tpm_installation.md new file mode 100644 index 0000000..630573f --- /dev/null +++ b/.tmux/plugins/tpm/docs/automatic_tpm_installation.md @@ -0,0 +1,12 @@ +# Automatic tpm installation + +One of the first things we do on a new machine is cloning our dotfiles. Not everything comes with them though, so for example `tpm` most likely won't be installed. + +If you want to install `tpm` and plugins automatically when tmux is started, put the following snippet in `.tmux.conf` before the final `run '~/.tmux/plugins/tpm/tpm'`: + +``` +if "test ! -d ~/.tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" +``` + +This useful tip was submitted by @acr4 and narfman0. diff --git a/.tmux/plugins/tpm/docs/changing_plugins_install_dir.md b/.tmux/plugins/tpm/docs/changing_plugins_install_dir.md new file mode 100644 index 0000000..27de96d --- /dev/null +++ b/.tmux/plugins/tpm/docs/changing_plugins_install_dir.md @@ -0,0 +1,16 @@ +# Changing plugins install dir + +By default, TPM installs plugins in a subfolder named `plugins/` inside +`$XDG_CONFIG_HOME/tmux/` if a `tmux.conf` file was found at that location, or +inside `~/.tmux/` otherwise. + +You can change the install path by putting this in `.tmux.conf`: + + set-environment -g TMUX_PLUGIN_MANAGER_PATH '/some/other/path/' + +Tmux plugin manager initialization in `.tmux.conf` should also be updated: + + # initializes TMUX plugin manager in a new path + run /some/other/path/tpm/tpm + +Please make sure that the `run` line is at the very bottom of `.tmux.conf`. diff --git a/.tmux/plugins/tpm/docs/how_to_create_plugin.md b/.tmux/plugins/tpm/docs/how_to_create_plugin.md new file mode 100644 index 0000000..f7d9c13 --- /dev/null +++ b/.tmux/plugins/tpm/docs/how_to_create_plugin.md @@ -0,0 +1,108 @@ +# How to create Tmux plugins + +Creating a new plugin is easy. + +For demonstration purposes we'll create a simple plugin that lists all +installed TPM plugins. Yes, a plugin that lists plugins :) We'll bind that to +`prefix + T`. + +The source code for this example plugin can be found +[here](https://github.com/tmux-plugins/tmux-example-plugin). + +### 1. create a new git project + +TPM depends on git for downloading and updating plugins. + +To create a new git project: + + $ mkdir tmux_my_plugin + $ cd tmux_my_plugin + $ git init + +### 2. create a `*.tmux` plugin run file + +When it sources a plugin, TPM executes all `*.tmux` files in your plugins' +directory. That's how plugins are run. + +Create a plugin run file in plugin directory: + + $ touch my_plugin.tmux + $ chmod u+x my_plugin.tmux + +You can have more than one `*.tmux` file, and all will get executed. However, usually +you'll need just one. + +### 3. create a plugin key binding + +We want the behavior of the plugin to trigger when a user hits `prefix + T`. + +Key `T` is chosen because: + - it's "kind of" a mnemonic for `TPM` + - the key is not used by Tmux natively. Tmux man page, KEY BINDINGS section + contains a list of all the bindings Tmux uses. There's plenty of unused keys + and we don't want to override any of Tmux default key bindings. + +Open the plugin run file in your favorite text editor: + + $ vim my_plugin.tmux + # or + $ subl my_plugin.tmux + +Put the following content in the file: + + #!/usr/bin/env bash + + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + tmux bind-key T run-shell "$CURRENT_DIR/scripts/tmux_list_plugins.sh" + +As you can see, plugin run file is a simple bash script that sets up the binding. + +When pressed, `prefix + T` will execute another shell script: +`tmux_list_plugins.sh`. That script should be in `scripts/` directory - +relative to the plugin run file. + + +### 4. listing plugins + +Now that we have the binding, let's create a script that's invoked with +`prefix + T`. + + $ mkdir scripts + $ touch scripts/tmux_list_plugins.sh + $ chmod u+x scripts/tmux_list_plugins.sh + +And here's the script content: + + #!/usr/bin/env bash + + # fetching the directory where plugins are installed + plugin_path="$(tmux show-env -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)" + + # listing installed plugins + ls -1 "$plugin_path" + +### 5. try it out + +To see if this works, execute the plugin run file: + + $ ./my_plugin.tmux + +That should set up the key binding. Now hit `prefix + T` and see if it works. + +### 6. publish the plugin + +When everything is ready, push the plugin to an online git repository, +preferably GitHub. + +Other users can install your plugin by just adding plugin git URL to the +`@plugin` list in their `.tmux.conf`. + +If the plugin is on GitHub, your users will be able to use the shorthand of +`github_username/repository`. + +### Conclusion + +Hopefully, that was easy. As you can see, it's mostly shell scripting. + +You can use other scripting languages (ruby, python etc) but plain old shell +is preferred because of portability. diff --git a/.tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md b/.tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md new file mode 100644 index 0000000..7aefd7d --- /dev/null +++ b/.tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md @@ -0,0 +1,36 @@ +# Managing plugins via the command line + +Aside from tmux key bindings, TPM provides shell interface for managing plugins +via scripts located in [bin/](../bin/) directory. + +Tmux does not need to be started in order to run scripts (but it's okay if it +is). If you [changed tpm install dir](../docs/changing_plugins_install_dir.md) +in `.tmux.conf` that should work fine too. + +Prerequisites: + +- tmux installed on the system (doh) +- `.tmux.conf` set up for TPM + +### Installing plugins + +As usual, plugins need to be specified in `.tmux.conf`. Run the following +command to install plugins: + + ~/.tmux/plugins/tpm/bin/install_plugins + +### Updating plugins + +To update all installed plugins: + + ~/.tmux/plugins/tpm/bin/update_plugins all + +or update a single plugin: + + ~/.tmux/plugins/tpm/bin/update_plugins tmux-sensible + +### Removing plugins + +To remove plugins not on the plugin list: + + ~/.tmux/plugins/tpm/bin/clean_plugins diff --git a/.tmux/plugins/tpm/docs/tpm_not_working.md b/.tmux/plugins/tpm/docs/tpm_not_working.md new file mode 100644 index 0000000..6680291 --- /dev/null +++ b/.tmux/plugins/tpm/docs/tpm_not_working.md @@ -0,0 +1,102 @@ +# Help, tpm not working! + +Here's the list of issues users had with `tpm`: + +
+ +> Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even + defined. + +Related [issue #22](https://github.com/tmux-plugins/tpm/issues/22) + +- Do you have required `tmux` version to run `tpm`?
+ Check `tmux` version with `$ tmux -V` command and make sure it's higher or + equal to the required version for `tpm` as stated in the readme. + +- ZSH tmux plugin might be causing issues.
+ If you have it installed, try disabling it and see if `tpm` works then. + +
+ +> Help, I'm using custom config file with `tmux -f /path/to/my_tmux.conf` +to start Tmux and for some reason plugins aren't loaded!? + +Related [issue #57](https://github.com/tmux-plugins/tpm/issues/57) + +`tpm` has a known issue when using custom config file with `-f` option. +The solution is to use alternative plugin definition syntax. Here are the steps +to make it work: + +1. remove all `set -g @plugin` lines from tmux config file +2. in the config file define the plugins in the following way: + + # List of plugins + set -g @tpm_plugins ' \ + tmux-plugins/tpm \ + tmux-plugins/tmux-sensible \ + tmux-plugins/tmux-resurrect \ + ' + + # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) + run '~/.tmux/plugins/tpm/tpm' + +3. Reload TMUX environment so TPM is sourced: `$ tmux source /path/to/my_tmux.conf` + +The plugins should now be working. + +
+ +> Weird sequence of characters show up when installing or updating plugins + +Related: [issue #25](https://github.com/tmux-plugins/tpm/issues/25) + +- This could be caused by [tmuxline.vim](https://github.com/edkolev/tmuxline.vim) + plugin. Uninstall it and see if things work. + +
+ +> "failed to connect to server" error when sourcing .tmux.conf + +Related: [issue #48](https://github.com/tmux-plugins/tpm/issues/48) + +- Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`. + +
+ +> tpm not working: '~/.tmux/plugins/tpm/tpm' returned 2 (Windows / Cygwin) + +Related: [issue #81](https://github.com/tmux-plugins/tpm/issues/81) + +This issue is most likely caused by Windows line endings. For example, if you +have git's `core.autocrlf` option set to `true`, git will automatically convert +all the files to Windows line endings which might cause a problem. + +The solution is to convert all line ending to Unix newline characters. This +command handles that for all files under `.tmux/` dir (skips `.git` +subdirectories): + +```bash +find ~/.tmux -type d -name '.git*' -prune -o -type f -print0 | xargs -0 dos2unix +``` + +
+ +> '~/.tmux/plugins/tpm/tpm' returned 127 (on macOS, w/ tmux installed using brew) + +Related: [issue #67](https://github.com/tmux-plugins/tpm/issues/67) + +This problem is because tmux's `run-shell` command runs a shell which doesn't read from user configs, thus tmux installed in a brew prefix (e.g. `/usr/local/bin`) will not be found. + +The solution is to find your brew prefix + +```sh +> echo "$(brew --prefix)/bin" +/opt/homebrew/bin +``` + +And prepend it to the `PATH` environment variable +``` +set-environment -g PATH "/opt/homebrew/bin:/bin:/usr/bin" +``` + +before any `run-shell`/`run` commands in `~/.tmux.conf`. diff --git a/.tmux/plugins/tpm/scripts/check_tmux_version.sh b/.tmux/plugins/tpm/scripts/check_tmux_version.sh new file mode 100755 index 0000000..b0aedec --- /dev/null +++ b/.tmux/plugins/tpm/scripts/check_tmux_version.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +VERSION="$1" +UNSUPPORTED_MSG="$2" + +get_tmux_option() { + local option=$1 + local default_value=$2 + local option_value=$(tmux show-option -gqv "$option") + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +# Ensures a message is displayed for 5 seconds in tmux prompt. +# Does not override the 'display-time' tmux option. +display_message() { + local message="$1" + + # display_duration defaults to 5 seconds, if not passed as an argument + if [ "$#" -eq 2 ]; then + local display_duration="$2" + else + local display_duration="5000" + fi + + # saves user-set 'display-time' option + local saved_display_time=$(get_tmux_option "display-time" "750") + + # sets message display time to 5 seconds + tmux set-option -gq display-time "$display_duration" + + # displays message + tmux display-message "$message" + + # restores original 'display-time' value + tmux set-option -gq display-time "$saved_display_time" +} + +# this is used to get "clean" integer version number. Examples: +# `tmux 1.9` => `19` +# `1.9a` => `19` +get_digits_from_string() { + local string="$1" + local only_digits="$(echo "$string" | tr -dC '[:digit:]')" + echo "$only_digits" +} + +tmux_version_int() { + local tmux_version_string=$(tmux -V) + echo "$(get_digits_from_string "$tmux_version_string")" +} + +unsupported_version_message() { + if [ -n "$UNSUPPORTED_MSG" ]; then + echo "$UNSUPPORTED_MSG" + else + echo "Error, Tmux version unsupported! Please install Tmux version $VERSION or greater!" + fi +} + +exit_if_unsupported_version() { + local current_version="$1" + local supported_version="$2" + if [ "$current_version" -lt "$supported_version" ]; then + display_message "$(unsupported_version_message)" + exit 1 + fi +} + +main() { + local supported_version_int="$(get_digits_from_string "$VERSION")" + local current_version_int="$(tmux_version_int)" + exit_if_unsupported_version "$current_version_int" "$supported_version_int" +} +main diff --git a/.tmux/plugins/tpm/scripts/clean_plugins.sh b/.tmux/plugins/tpm/scripts/clean_plugins.sh new file mode 100755 index 0000000..a025524 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/clean_plugins.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +clean_plugins() { + local plugins plugin plugin_directory + plugins="$(tpm_plugins_list_helper)" + + for plugin_directory in "$(tpm_path)"/*; do + [ -d "${plugin_directory}" ] || continue + plugin="$(plugin_name_helper "${plugin_directory}")" + case "${plugins}" in + *"${plugin}"*) : ;; + *) + [ "${plugin}" = "tpm" ] && continue + echo_ok "Removing \"$plugin\"" + rm -rf "${plugin_directory}" >/dev/null 2>&1 + [ -d "${plugin_directory}" ] && + echo_err " \"$plugin\" clean fail" || + echo_ok " \"$plugin\" clean success" + ;; + esac + done +} + +main() { + ensure_tpm_path_exists + clean_plugins + exit_value_helper +} +main diff --git a/.tmux/plugins/tpm/scripts/helpers/plugin_functions.sh b/.tmux/plugins/tpm/scripts/helpers/plugin_functions.sh new file mode 100644 index 0000000..f33d215 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/helpers/plugin_functions.sh @@ -0,0 +1,104 @@ +# using @tpm_plugins is now deprecated in favor of using @plugin syntax +tpm_plugins_variable_name="@tpm_plugins" + +# manually expanding tilde char or `$HOME` variable. +_manual_expansion() { + local path="$1" + local expanded_tilde="${path/#\~/$HOME}" + echo "${expanded_tilde/#\$HOME/$HOME}" +} + +_tpm_path() { + local string_path="$(tmux start-server\; show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)/" + _manual_expansion "$string_path" +} + +_CACHED_TPM_PATH="$(_tpm_path)" + +# Get the absolute path to the users configuration file of TMux. +# This includes a prioritized search on different locations. +# +_get_user_tmux_conf() { + # Define the different possible locations. + xdg_location="${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" + default_location="$HOME/.tmux.conf" + + # Search for the correct configuration file by priority. + if [ -f "$xdg_location" ]; then + echo "$xdg_location" + + else + echo "$default_location" + fi +} + +_tmux_conf_contents() { + user_config=$(_get_user_tmux_conf) + cat /etc/tmux.conf "$user_config" 2>/dev/null + if [ "$1" == "full" ]; then # also output content from sourced files + local file + for file in $(_sourced_files); do + cat $(_manual_expansion "$file") 2>/dev/null + done + fi +} + +# return files sourced from tmux config files +_sourced_files() { + _tmux_conf_contents | + sed -E -n -e "s/^[[:space:]]*source(-file)?[[:space:]]+(-q+[[:space:]]+)?['\"]?([^'\"]+)['\"]?/\3/p" +} + +# Want to be able to abort in certain cases +trap "exit 1" TERM +export TOP_PID=$$ + +_fatal_error_abort() { + echo >&2 "Aborting." + kill -s TERM $TOP_PID +} + +# PUBLIC FUNCTIONS BELOW + +tpm_path() { + if [ "$_CACHED_TPM_PATH" == "/" ]; then + echo >&2 "FATAL: Tmux Plugin Manager not configured in tmux.conf" + _fatal_error_abort + fi + echo "$_CACHED_TPM_PATH" +} + +tpm_plugins_list_helper() { + # lists plugins from @tpm_plugins option + echo "$(tmux start-server\; show-option -gqv "$tpm_plugins_variable_name")" + + # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries + _tmux_conf_contents "full" | + awk '/^[ \t]*set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' +} + +# Allowed plugin name formats: +# 1. "git://github.com/user/plugin_name.git" +# 2. "user/plugin_name" +plugin_name_helper() { + local plugin="$1" + # get only the part after the last slash, e.g. "plugin_name.git" + local plugin_basename="$(basename "$plugin")" + # remove ".git" extension (if it exists) to get only "plugin_name" + local plugin_name="${plugin_basename%.git}" + echo "$plugin_name" +} + +plugin_path_helper() { + local plugin="$1" + local plugin_name="$(plugin_name_helper "$plugin")" + echo "$(tpm_path)${plugin_name}/" +} + +plugin_already_installed() { + local plugin="$1" + local plugin_path="$(plugin_path_helper "$plugin")" + [ -d "$plugin_path" ] && + cd "$plugin_path" && + git remote >/dev/null 2>&1 +} diff --git a/.tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh b/.tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh new file mode 100644 index 0000000..ecaa37e --- /dev/null +++ b/.tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh @@ -0,0 +1,7 @@ +echo_ok() { + echo "$*" +} + +echo_err() { + fail_helper "$*" +} diff --git a/.tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh b/.tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh new file mode 100644 index 0000000..7a6ef0a --- /dev/null +++ b/.tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh @@ -0,0 +1,28 @@ +_has_emacs_mode_keys() { + $(tmux show -gw mode-keys | grep -q emacs) +} + +tmux_echo() { + local message="$1" + tmux run-shell "echo '$message'" +} + +echo_ok() { + tmux_echo "$*" +} + +echo_err() { + tmux_echo "$*" +} + +end_message() { + if _has_emacs_mode_keys; then + local continue_key="ESCAPE" + else + local continue_key="ENTER" + fi + tmux_echo "" + tmux_echo "TMUX environment reloaded." + tmux_echo "" + tmux_echo "Done, press $continue_key to continue." +} diff --git a/.tmux/plugins/tpm/scripts/helpers/tmux_utils.sh b/.tmux/plugins/tpm/scripts/helpers/tmux_utils.sh new file mode 100644 index 0000000..238952d --- /dev/null +++ b/.tmux/plugins/tpm/scripts/helpers/tmux_utils.sh @@ -0,0 +1,6 @@ +HELPERS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source "$HELPERS_DIR/plugin_functions.sh" + +reload_tmux_environment() { + tmux source-file $(_get_user_tmux_conf) >/dev/null 2>&1 +} diff --git a/.tmux/plugins/tpm/scripts/helpers/utility.sh b/.tmux/plugins/tpm/scripts/helpers/utility.sh new file mode 100644 index 0000000..de6eb35 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/helpers/utility.sh @@ -0,0 +1,17 @@ +ensure_tpm_path_exists() { + mkdir -p "$(tpm_path)" +} + +fail_helper() { + local message="$1" + echo "$message" >&2 + FAIL="true" +} + +exit_value_helper() { + if [ "$FAIL" == "true" ]; then + exit 1 + else + exit 0 + fi +} diff --git a/.tmux/plugins/tpm/scripts/install_plugins.sh b/.tmux/plugins/tpm/scripts/install_plugins.sh new file mode 100755 index 0000000..e2450ac --- /dev/null +++ b/.tmux/plugins/tpm/scripts/install_plugins.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +clone() { + local plugin="$1" + local branch="$2" + if [ -n "$branch" ]; then + cd "$(tpm_path)" && + GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" >/dev/null 2>&1 + else + cd "$(tpm_path)" && + GIT_TERMINAL_PROMPT=0 git clone --single-branch --recursive "$plugin" >/dev/null 2>&1 + fi +} + +# tries cloning: +# 1. plugin name directly - works if it's a valid git url +# 2. expands the plugin name to point to a GitHub repo and tries cloning again +clone_plugin() { + local plugin="$1" + local branch="$2" + clone "$plugin" "$branch" || + clone "https://git::@github.com/$plugin" "$branch" +} + +# clone plugin and produce output +install_plugin() { + local plugin="$1" + local branch="$2" + local plugin_name="$(plugin_name_helper "$plugin")" + + if plugin_already_installed "$plugin"; then + echo_ok "Already installed \"$plugin_name\"" + else + echo_ok "Installing \"$plugin_name\"" + clone_plugin "$plugin" "$branch" && + echo_ok " \"$plugin_name\" download success" || + echo_err " \"$plugin_name\" download fail" + fi +} + +install_plugins() { + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + IFS='#' read -ra plugin <<< "$plugin" + install_plugin "${plugin[0]}" "${plugin[1]}" + done +} + +verify_tpm_path_permissions() { + local path="$(tpm_path)" + # check the write permission flag for all users to ensure + # that we have proper access + [ -w "$path" ] || + echo_err "$path is not writable!" +} + +main() { + ensure_tpm_path_exists + verify_tpm_path_permissions + install_plugins + exit_value_helper +} +main diff --git a/.tmux/plugins/tpm/scripts/source_plugins.sh b/.tmux/plugins/tpm/scripts/source_plugins.sh new file mode 100755 index 0000000..6381d54 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/source_plugins.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" + +plugin_dir_exists() { + [ -d "$1" ] +} + +# Runs all *.tmux files from the plugin directory. +# Files are ran as executables. +# No errors if the plugin dir does not exist. +silently_source_all_tmux_files() { + local plugin_path="$1" + local plugin_tmux_files="$plugin_path*.tmux" + if plugin_dir_exists "$plugin_path"; then + for tmux_file in $plugin_tmux_files; do + # if the glob didn't find any files this will be the + # unexpanded glob which obviously doesn't exist + [ -f "$tmux_file" ] || continue + # runs *.tmux file as an executable + $tmux_file >/dev/null 2>&1 + done + fi +} + +source_plugins() { + local plugin plugin_path + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + IFS='#' read -ra plugin <<< "$plugin" + plugin_path="$(plugin_path_helper "${plugin[0]}")" + silently_source_all_tmux_files "$plugin_path" + done +} + +main() { + source_plugins +} +main diff --git a/.tmux/plugins/tpm/scripts/update_plugin.sh b/.tmux/plugins/tpm/scripts/update_plugin.sh new file mode 100755 index 0000000..e533664 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/update_plugin.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# this script handles core logic of updating plugins + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +# from now on ignore first script argument +shift + +pull_changes() { + local plugin="$1" + local plugin_path="$(plugin_path_helper "$plugin")" + cd "$plugin_path" && + GIT_TERMINAL_PROMPT=0 git pull && + GIT_TERMINAL_PROMPT=0 git submodule update --init --recursive +} + +update() { + local plugin="$1" output + output=$(pull_changes "$plugin" 2>&1) + if (( $? == 0 )); then + echo_ok " \"$plugin\" update success" + echo_ok "$(echo "$output" | sed -e 's/^/ | /')" + else + echo_err " \"$plugin\" update fail" + echo_err "$(echo "$output" | sed -e 's/^/ | /')" + fi +} + +update_all() { + echo_ok "Updating all plugins!" + echo_ok "" + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + IFS='#' read -ra plugin <<< "$plugin" + local plugin_name="$(plugin_name_helper "${plugin[0]}")" + # updating only installed plugins + if plugin_already_installed "$plugin_name"; then + update "$plugin_name" & + fi + done + wait +} + +update_plugins() { + local plugins="$*" + for plugin in $plugins; do + IFS='#' read -ra plugin <<< "$plugin" + local plugin_name="$(plugin_name_helper "${plugin[0]}")" + if plugin_already_installed "$plugin_name"; then + update "$plugin_name" & + else + echo_err "$plugin_name not installed!" & + fi + done + wait +} + +main() { + ensure_tpm_path_exists + if [ "$1" == "all" ]; then + update_all + else + update_plugins "$*" + fi + exit_value_helper +} +main "$*" diff --git a/.tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh b/.tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh new file mode 100755 index 0000000..5e1f7d9 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +if [ $# -eq 0 ]; then + exit 0 +fi + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + "$CURRENT_DIR/update_plugin.sh" --tmux-echo "$*" + reload_tmux_environment + end_message +} +main "$*" diff --git a/.tmux/plugins/tpm/scripts/variables.sh b/.tmux/plugins/tpm/scripts/variables.sh new file mode 100644 index 0000000..5601a86 --- /dev/null +++ b/.tmux/plugins/tpm/scripts/variables.sh @@ -0,0 +1,13 @@ +install_key_option="@tpm-install" +default_install_key="I" + +update_key_option="@tpm-update" +default_update_key="U" + +clean_key_option="@tpm-clean" +default_clean_key="M-u" + +SUPPORTED_TMUX_VERSION="1.9" + +DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH" +DEFAULT_TPM_PATH="$HOME/.tmux/plugins/" diff --git a/.tmux/plugins/tpm/tests/expect_failed_plugin_download b/.tmux/plugins/tpm/tests/expect_failed_plugin_download new file mode 100755 index 0000000..b970477 --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_failed_plugin_download @@ -0,0 +1,36 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 20 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"non-existing-plugin\"" +} + +expect { + "\"non-existing-plugin\" download fail" +} + +expect { + "Done, press ENTER to continue" { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/expect_successful_clean_plugins b/.tmux/plugins/tpm/tests/expect_successful_clean_plugins new file mode 100755 index 0000000..987c49d --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_successful_clean_plugins @@ -0,0 +1,35 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + alt + u +send "u" + +set timeout 5 + +expect_after { + timeout { exit 1 } +} + +expect { + "Removing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" clean success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download b/.tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download new file mode 100755 index 0000000..cc87a26 --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download @@ -0,0 +1,44 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" download success" +} + +expect { + "Installing \"tmux-copycat\"" +} + +expect { + "\"tmux-copycat\" download success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/expect_successful_plugin_download b/.tmux/plugins/tpm/tests/expect_successful_plugin_download new file mode 100755 index 0000000..388f05d --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_successful_plugin_download @@ -0,0 +1,50 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" download success" +} + +expect { + "Done, press ENTER to continue" { + send " " + } +} + +sleep 1 +# this is tmux prefix + I +send "I" + +expect { + "Already installed \"tmux-example-plugin\"" +} + +expect { + "Done, press ENTER to continue" { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin b/.tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin new file mode 100755 index 0000000..bcd64fe --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin @@ -0,0 +1,55 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + U +send "U" + +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installed plugins" +} + +expect { + "tmux-example-plugin" +} + +expect { + "\"all\" - updates all plugins" +} + +expect { + "ENTER - cancels" +} + +# wait for tmux to display prompt before sending characters +sleep 1 +send "tmux-example-plugin\r" + +expect { + "Updating \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" update success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins b/.tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins new file mode 100755 index 0000000..4f3a4a3 --- /dev/null +++ b/.tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins @@ -0,0 +1,59 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + U +send "U" + +set timeout 5 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installed plugins" +} + +expect { + "tmux-example-plugin" +} + +expect { + "\"all\" - updates all plugins" +} + +expect { + "ENTER - cancels" +} + +# wait for tmux to display prompt before sending characters +sleep 1 +send "all\r" + +expect { + "Updating all plugins!" +} + +expect { + "Updating \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" update success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/.tmux/plugins/tpm/tests/helpers/tpm.sh b/.tmux/plugins/tpm/tests/helpers/tpm.sh new file mode 100644 index 0000000..1594afb --- /dev/null +++ b/.tmux/plugins/tpm/tests/helpers/tpm.sh @@ -0,0 +1,13 @@ +check_dir_exists_helper() { + [ -d "$1" ] +} + +# runs the scripts and asserts it has the correct output and exit code +script_run_helper() { + local script="$1" + local expected_output="$2" + local expected_exit_code="${3:-0}" + $script 2>&1 | + grep "$expected_output" >/dev/null 2>&1 && # grep -q flag quits the script early + [ "${PIPESTATUS[0]}" -eq "$expected_exit_code" ] +} diff --git a/.tmux/plugins/tpm/tests/test_plugin_clean.sh b/.tmux/plugins/tpm/tests/test_plugin_clean.sh new file mode 100755 index 0000000..d36c468 --- /dev/null +++ b/.tmux/plugins/tpm/tests/test_plugin_clean.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +manually_install_the_plugin() { + rm -rf "$PLUGINS_DIR" + mkdir -p "$PLUGINS_DIR" + cd "$PLUGINS_DIR" + git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin +} + +# TMUX KEY-BINDING TESTS + +test_plugin_uninstallation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + "$CURRENT_DIR/expect_successful_clean_plugins" || + fail_helper "[key-binding] clean fails" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_uninstallation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean success' || + fail_helper "[script] plugin cleaning fails" + + teardown_helper +} + +test_unsuccessful_plugin_uninstallation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + chmod 000 "$PLUGINS_DIR/tmux-example-plugin" # disable directory deletion + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean fail' "$expected_exit_code" || + fail_helper "[script] unsuccessful plugin cleaning doesn't fail" + + chmod 755 "$PLUGINS_DIR/tmux-example-plugin" # enable directory deletion + + teardown_helper +} + +run_tests diff --git a/.tmux/plugins/tpm/tests/test_plugin_installation.sh b/.tmux/plugins/tpm/tests/test_plugin_installation.sh new file mode 100755 index 0000000..94fb674 --- /dev/null +++ b/.tmux/plugins/tpm/tests/test_plugin_installation.sh @@ -0,0 +1,284 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PLUGINS_DIR="$HOME/.tmux/plugins" +TPM_DIR="$PWD" + +CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" +ADDITIONAL_CONFIG_FILE_1="$HOME/.tmux/additional_config_file_1" +ADDITIONAL_CONFIG_FILE_2="$HOME/.tmux/additional_config_file_2" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +# TMUX KEY-BINDING TESTS + +test_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails" + + teardown_helper +} + +test_plugin_installation_via_tmux_key_binding_set_option() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-option -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding][set-option] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][set-option] plugin download fails" + + teardown_helper +} + +test_plugin_installation_custom_dir_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding][custom dir] plugin installation fails" + + check_dir_exists_helper "$CUSTOM_PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][custom dir] plugin download fails" + + teardown_helper + rm -rf "$CUSTOM_PLUGINS_DIR" +} + +test_non_existing_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/non-existing-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_failed_plugin_download" || + fail_helper "[key-binding] non existing plugin installation doesn't fail" + + teardown_helper +} + +test_multiple_plugins_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + \ \ set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding] multiple plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding] plugin download fails (tmux-copycat)" + + teardown_helper +} + +test_plugins_installation_from_sourced_file_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + source '$ADDITIONAL_CONFIG_FILE_1' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding][sourced file] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][sourced file] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding][sourced file] plugin download fails (tmux-copycat)" + + teardown_helper +} + +test_plugins_installation_from_multiple_sourced_files_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + \ \ source '$ADDITIONAL_CONFIG_FILE_1' + source-file '$ADDITIONAL_CONFIG_FILE_2' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-example-plugin'" > "$ADDITIONAL_CONFIG_FILE_1" + echo " set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_2" + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding][multiple sourced files] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][multiple sourced files] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding][multiple sourced files] plugin download fails (tmux-copycat)" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script] plugin already installed message fail" + + teardown_helper +} + +test_plugin_installation_custom_dir_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script][custom dir] plugin installation fails" + + check_dir_exists_helper "$CUSTOM_PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][custom dir] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script][custom dir] plugin already installed message fail" + + teardown_helper + rm -rf "$CUSTOM_PLUGINS_DIR" +} + +test_non_existing_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/non-existing-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/install_plugins" '"non-existing-plugin" download fail' "$expected_exit_code" || + fail_helper "[script] non existing plugin installation doesn't fail" + + teardown_helper +} + +test_multiple_plugins_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + \ \ set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] multiple plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script] multiple plugins already installed message fail" + + teardown_helper +} + +test_plugins_installation_from_sourced_file_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + source '$ADDITIONAL_CONFIG_FILE_1' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-copycat" download success' || + fail_helper "[script][sourced file] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][sourced file] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script][sourced file] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script][sourced file] plugins already installed message fail" + + teardown_helper +} + +test_plugins_installation_from_multiple_sourced_files_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + \ \ source '$ADDITIONAL_CONFIG_FILE_1' + source-file '$ADDITIONAL_CONFIG_FILE_2' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo " set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + echo "set -g @plugin 'tmux-plugins/tmux-sensible'" > "$ADDITIONAL_CONFIG_FILE_2" + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-sensible" download success' || + fail_helper "[script][multiple sourced files] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-copycat)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-sensible/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-sensible)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-sensible"' || + fail_helper "[script][multiple sourced files] plugins already installed message fail" + + teardown_helper +} + +run_tests diff --git a/.tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh b/.tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh new file mode 100755 index 0000000..b1d0cf6 --- /dev/null +++ b/.tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PLUGINS_DIR="$HOME/.tmux/plugins" +TPM_DIR="$PWD" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +# TMUX KEY-BINDING TESTS + +test_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + # opens tmux and test it with `expect` + $CURRENT_DIR/expect_successful_plugin_download || + fail_helper "[key-binding] plugin installation fails" + + # check plugin dir exists after download + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails" + + teardown_helper +} + +test_legacy_and_new_syntax_for_plugin_installation_work_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins " \ + tmux-plugins/tmux-example-plugin \ + " + set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + # opens tmux and test it with `expect` + "$CURRENT_DIR"/expect_successful_multiple_plugins_download || + fail_helper "[key-binding] multiple plugins installation fails" + + # check plugin dir exists after download + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding] plugin download fails (tmux-copycat)" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script] plugin already installed message fail" + + teardown_helper +} + +test_legacy_and_new_syntax_for_plugin_installation_work_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins " \ + tmux-plugins/tmux-example-plugin \ + " + set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] multiple plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script] multiple plugins already installed message fail" + + teardown_helper +} + +run_tests diff --git a/.tmux/plugins/tpm/tests/test_plugin_sourcing.sh b/.tmux/plugins/tpm/tests/test_plugin_sourcing.sh new file mode 100755 index 0000000..c06f1fe --- /dev/null +++ b/.tmux/plugins/tpm/tests/test_plugin_sourcing.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +check_binding_defined() { + local binding="$1" + tmux list-keys | grep -q "$binding" +} + +create_test_plugin_helper() { + local plugin_path="$PLUGINS_DIR/tmux_test_plugin/" + rm -rf "$plugin_path" + mkdir -p "$plugin_path" + + while read line; do + echo "$line" >> "$plugin_path/test_plugin.tmux" + done + chmod +x "$plugin_path/test_plugin.tmux" +} + +check_tpm_path() { + local correct_tpm_path="$1" + local tpm_path="$(tmux start-server\; show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)" + [ "$correct_tpm_path" == "$tpm_path" ] +} + +test_plugin_sourcing() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "doesnt_matter/tmux_test_plugin" + run-shell "$TPM_DIR/tpm" + HERE + + # manually creates a local tmux plugin + create_test_plugin_helper <<- HERE + tmux bind-key R run-shell foo_command + HERE + + tmux new-session -d # tmux starts detached + check_binding_defined "R run-shell foo_command" || + fail_helper "Plugin sourcing fails" + + teardown_helper +} + +test_default_tpm_path() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + check_tpm_path "${PLUGINS_DIR}/" || + fail_helper "Default TPM path not correct" + + teardown_helper +} + +test_custom_tpm_path() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + run-shell "$TPM_DIR/tpm" + HERE + + check_tpm_path "$CUSTOM_PLUGINS_DIR" || + fail_helper "Custom TPM path not correct" + + teardown_helper +} + +run_tests diff --git a/.tmux/plugins/tpm/tests/test_plugin_update.sh b/.tmux/plugins/tpm/tests/test_plugin_update.sh new file mode 100755 index 0000000..4924d16 --- /dev/null +++ b/.tmux/plugins/tpm/tests/test_plugin_update.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +manually_install_the_plugin() { + mkdir -p "$PLUGINS_DIR" + cd "$PLUGINS_DIR" + git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin +} + +# TMUX KEY-BINDING TESTS + +test_plugin_update_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + "$CURRENT_DIR/expect_successful_update_of_all_plugins" || + fail_helper "[key-binding] 'update all plugins' fails" + + "$CURRENT_DIR/expect_successful_update_of_a_single_plugin" || + fail_helper "[key-binding] 'update single plugin' fails" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_update_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/update_plugins" 'usage' "$expected_exit_code" || + fail_helper "[script] running update plugins without args should fail" + + script_run_helper "$TPM_DIR/bin/update_plugins tmux-example-plugin" '"tmux-example-plugin" update success' || + fail_helper "[script] plugin update fails" + + script_run_helper "$TPM_DIR/bin/update_plugins all" '"tmux-example-plugin" update success' || + fail_helper "[script] update all plugins fails" + + teardown_helper +} + +run_tests diff --git a/.tmux/plugins/tpm/tpm b/.tmux/plugins/tpm/tpm new file mode 100755 index 0000000..7ad4b99 --- /dev/null +++ b/.tmux/plugins/tpm/tpm @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +BINDINGS_DIR="$CURRENT_DIR/bindings" +SCRIPTS_DIR="$CURRENT_DIR/scripts" + +source "$SCRIPTS_DIR/variables.sh" + +get_tmux_option() { + local option="$1" + local default_value="$2" + local option_value="$(tmux show-option -gqv "$option")" + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +tpm_path_set() { + tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1 +} + +# Check if configuration file exists at an XDG-compatible location, if so use +# that directory for TMUX_PLUGIN_MANAGER_PATH. Otherwise use $DEFAULT_TPM_PATH. +set_default_tpm_path() { + local xdg_tmux_path="${XDG_CONFIG_HOME:-$HOME/.config}/tmux" + local tpm_path="$DEFAULT_TPM_PATH" + + if [ -f "$xdg_tmux_path/tmux.conf" ]; then + tpm_path="$xdg_tmux_path/plugins/" + fi + + tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$tpm_path" +} + +# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set. +# +# Put this in `.tmux.conf` to override the default: +# `set-environment -g TMUX_PLUGIN_MANAGER_PATH "/some/other/path/"` +set_tpm_path() { + if ! tpm_path_set; then + set_default_tpm_path + fi +} + +# 1. Fetches plugin names from `@plugin` variables +# 2. Creates full plugin path +# 3. Sources all *.tmux files from each of the plugin directories +# - no errors raised if directory does not exist +# Files are sourced as tmux config files, not as shell scripts! +source_plugins() { + "$SCRIPTS_DIR/source_plugins.sh" >/dev/null 2>&1 +} + +# prefix + I - downloads TPM plugins and reloads TMUX environment +# prefix + U - updates a plugin (or all of them) and reloads TMUX environment +# prefix + alt + u - remove unused TPM plugins and reloads TMUX environment +set_tpm_key_bindings() { + local install_key="$(get_tmux_option "$install_key_option" "$default_install_key")" + tmux bind-key "$install_key" run-shell "$BINDINGS_DIR/install_plugins" + + local update_key="$(get_tmux_option "$update_key_option" "$default_update_key")" + tmux bind-key "$update_key" run-shell "$BINDINGS_DIR/update_plugins" + + local clean_key="$(get_tmux_option "$clean_key_option" "$default_clean_key")" + tmux bind-key "$clean_key" run-shell "$BINDINGS_DIR/clean_plugins" +} + +supported_tmux_version_ok() { + "$SCRIPTS_DIR/check_tmux_version.sh" "$SUPPORTED_TMUX_VERSION" +} + +main() { + if supported_tmux_version_ok; then + set_tpm_path + set_tpm_key_bindings + source_plugins + fi +} +main diff --git a/linux/.zsh_plugins.txt b/.zsh_plugins.txt similarity index 100% rename from linux/.zsh_plugins.txt rename to .zsh_plugins.txt diff --git a/linux/.zshrc b/.zshrc similarity index 100% rename from linux/.zshrc rename to .zshrc diff --git a/linux/README.md b/README.md similarity index 100% rename from linux/README.md rename to README.md diff --git a/linux/.antidote b/linux/.antidote deleted file mode 160000 index 9be3256..0000000 --- a/linux/.antidote +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9be325619f398a4b2c4f00795345844aeeacaddf diff --git a/linux/.config/nvim b/linux/.config/nvim deleted file mode 120000 index 03f63dc..0000000 --- a/linux/.config/nvim +++ /dev/null @@ -1 +0,0 @@ -../../nvim \ No newline at end of file diff --git a/linux/.config/starship.toml b/linux/.config/starship.toml deleted file mode 120000 index a9d1d34..0000000 --- a/linux/.config/starship.toml +++ /dev/null @@ -1 +0,0 @@ -../../starship.toml \ No newline at end of file diff --git a/linux/.tmux/plugins/tpm b/linux/.tmux/plugins/tpm deleted file mode 160000 index 99469c4..0000000 --- a/linux/.tmux/plugins/tpm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946 diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json deleted file mode 100644 index d581f90..0000000 --- a/nvim/lazy-lock.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "conform.nvim": { "branch": "master", "commit": "26c02e1155a4980900bdccabca4516f4c712aae9" }, - "deadcolumn.nvim": { "branch": "master", "commit": "92c86f10bfba2717ca2280e2e759b047135d5288" }, - "dropbar.nvim": { "branch": "master", "commit": "d08bf6b5e2b3bf160050b0f991c1831bf05a7523" }, - "git-messenger.vim": { "branch": "master", "commit": "fd124457378a295a5d1036af4954b35d6b807385" }, - "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "lazy.nvim": { "branch": "main", "commit": "202d8e92b3a74ac88eb3a7f1e40fb59b4c2a6535" }, - "lsp_signature.nvim": { "branch": "master", "commit": "62cadce83aaceed677ffe7a2d6a57141af7131ea" }, - "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, - "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" }, - "nord.nvim": { "branch": "main", "commit": "07647ad23e5b7fc1599a841dcd8f173b9aeb0419" }, - "nvim-lspconfig": { "branch": "master", "commit": "a89bfcfd0e44f898341ac8a80ba83ccf6218bef3" }, - "nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" }, - "nvim-tree.lua": { "branch": "master", "commit": "64e2192f5250796aa4a7f33c6ad888515af50640" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "refactoring.nvim": { "branch": "master", "commit": "6784b54587e6d8a6b9ea199318512170ffb9e418" }, - "stcursorword": { "branch": "main", "commit": "f6810ed5001eeee6061fdce77b292a5565823ded" }, - "telescope-hierarchy.nvim": { "branch": "main", "commit": "b277da38d55663e3a260b581a193df3f36aa06b3" }, - "telescope-menufacture": { "branch": "main", "commit": "751aca3f022039874790024b3cf25d643e335612" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } -} diff --git a/nvim/lua/plugins_base/nvim-treesitter.lua b/nvim/lua/plugins_base/nvim-treesitter.lua deleted file mode 100644 index ebf4313..0000000 --- a/nvim/lua/plugins_base/nvim-treesitter.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - 'nvim-treesitter/nvim-treesitter', - config = function() - require("nvim-treesitter.configs").setup({ - auto_install = true, - sync_install = false, - highlight = { - enable = true, - }, - }) - end -} diff --git a/windows/README.md b/windows/README.md deleted file mode 100644 index f82cd3f..0000000 --- a/windows/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# dots2-windows - -Dotfiles for Windows managed using [PSDotFiles](https://github.com/ralish/PSDotFiles). Install it using: - -``` -Install-Module -Name PSDotFiles -$DotFilesPath = $PWD -Install-DotFiles -``` - -Run from outside Windows Terminal to prevent issues symlinking. diff --git a/windows/metadata/nvim.xml b/windows/metadata/nvim.xml deleted file mode 100644 index d4bc25f..0000000 --- a/windows/metadata/nvim.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Neovim - - - FindInPath - nvim - - - - LocalApplicationData - nvim - - diff --git a/windows/metadata/pwsh.xml b/windows/metadata/pwsh.xml deleted file mode 100644 index 51490fb..0000000 --- a/windows/metadata/pwsh.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Windows PowerShell - - - FindInPath - powershell - - - - Personal - PowerShell - - diff --git a/windows/metadata/starship.xml b/windows/metadata/starship.xml deleted file mode 100644 index 95d85e5..0000000 --- a/windows/metadata/starship.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Starship - - - FindInPath - starship - - - - Personal - ..\.config - - diff --git a/windows/nvim b/windows/nvim deleted file mode 120000 index a071a4f..0000000 --- a/windows/nvim +++ /dev/null @@ -1 +0,0 @@ -../nvim \ No newline at end of file diff --git a/windows/pwsh/Microsoft.PowerShell_profile.ps1 b/windows/pwsh/Microsoft.PowerShell_profile.ps1 deleted file mode 100644 index 6e8e54e..0000000 --- a/windows/pwsh/Microsoft.PowerShell_profile.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -# TODO: Fix path -$DotFilesPath = "$HOME\Documents\dots2\windows" -$ENV:EDITOR = "nvim" - -Invoke-Expression (&starship init powershell) diff --git a/windows/starship/starship.toml b/windows/starship/starship.toml deleted file mode 120000 index a9d1d34..0000000 --- a/windows/starship/starship.toml +++ /dev/null @@ -1 +0,0 @@ -../../starship.toml \ No newline at end of file diff --git a/windows/winterm/settings.json b/windows/winterm/settings.json deleted file mode 100644 index 84c3396..0000000 --- a/windows/winterm/settings.json +++ /dev/null @@ -1,322 +0,0 @@ -{ - "$help": "https://aka.ms/terminal-documentation", - "$schema": "https://aka.ms/terminal-profiles-schema", - "actions": - [ - { - "command": "unbound", - "keys": "ctrl+c" - }, - { - "command": "unbound", - "keys": "ctrl+v" - }, - { - "command": - { - "action": "copy", - "singleLine": false - } - }, - { - "command": "paste" - }, - { - "command": "find", - "keys": "ctrl+shift+f" - }, - { - "command": - { - "action": "splitPane", - "split": "auto", - "splitMode": "duplicate" - }, - "keys": "alt+shift+d" - } - ], - "copyFormatting": "none", - "copyOnSelect": false, - "defaultProfile": "{3d2a3b0c-ade0-47e2-849d-13e534a853e1}", - "profiles": - { - "defaults": - { - "colorScheme": "Nord", - "font": - { - "face": "CommitMono Nerd Font", - "size": 11, - "weight": "bold" - }, - "padding": "15" - }, - "list": - [ - { - "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", - "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", - "hidden": false, - "name": "Windows PowerShell" - }, - { - "commandline": "%SystemRoot%\\System32\\cmd.exe", - "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", - "hidden": false, - "name": "Command Prompt" - }, - { - "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", - "hidden": false, - "name": "Azure Cloud Shell", - "source": "Windows.Terminal.Azure" - }, - { - "altGrAliasing": true, - "antialiasingMode": "grayscale", - "closeOnExit": "graceful", - "commandline": "C:\\Scoop\\apps\\pwsh\\current\\pwsh.exe", - "guid": "{3d2a3b0c-ade0-47e2-849d-13e534a853e1}", - "hidden": false, - "historySize": 9001, - "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png", - "name": "Windows Pwsh", - "snapOnInput": true, - "startingDirectory": "%USERPROFILE%" - } - ] - }, - "schemes": - [ - { - "background": "#0C0C0C", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, - { - "background": "#012456", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell Powershell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, - { - "background": "#2E3440", - "black": "#3B4252", - "blue": "#81A1C1", - "brightBlack": "#4C566A", - "brightBlue": "#81A1C1", - "brightCyan": "#8FBCBB", - "brightGreen": "#A3BE8C", - "brightPurple": "#B48EAD", - "brightRed": "#BF616A", - "brightWhite": "#ECEFF4", - "brightYellow": "#EBCB8B", - "cursorColor": "#81A1C1", - "cyan": "#88C0D0", - "foreground": "#D8DEE9", - "green": "#A3BE8C", - "name": "Nord", - "purple": "#B48EAD", - "red": "#BF616A", - "selectionBackground": "#434C5E", - "white": "#E5E9F0", - "yellow": "#EBCB8B" - }, - { - "background": "#282C34", - "black": "#282C34", - "blue": "#61AFEF", - "brightBlack": "#5A6374", - "brightBlue": "#61AFEF", - "brightCyan": "#56B6C2", - "brightGreen": "#98C379", - "brightPurple": "#C678DD", - "brightRed": "#E06C75", - "brightWhite": "#DCDFE4", - "brightYellow": "#E5C07B", - "cursorColor": "#FFFFFF", - "cyan": "#56B6C2", - "foreground": "#DCDFE4", - "green": "#98C379", - "name": "One Half Dark", - "purple": "#C678DD", - "red": "#E06C75", - "selectionBackground": "#FFFFFF", - "white": "#DCDFE4", - "yellow": "#E5C07B" - }, - { - "background": "#FAFAFA", - "black": "#383A42", - "blue": "#0184BC", - "brightBlack": "#4F525D", - "brightBlue": "#61AFEF", - "brightCyan": "#56B5C1", - "brightGreen": "#98C379", - "brightPurple": "#C577DD", - "brightRed": "#DF6C75", - "brightWhite": "#FFFFFF", - "brightYellow": "#E4C07A", - "cursorColor": "#4F525D", - "cyan": "#0997B3", - "foreground": "#383A42", - "green": "#50A14F", - "name": "One Half Light", - "purple": "#A626A4", - "red": "#E45649", - "selectionBackground": "#FFFFFF", - "white": "#FAFAFA", - "yellow": "#C18301" - }, - { - "background": "#002B36", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#FFFFFF", - "cyan": "#2AA198", - "foreground": "#839496", - "green": "#859900", - "name": "Solarized Dark", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, - { - "background": "#FDF6E3", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#002B36", - "cyan": "#2AA198", - "foreground": "#657B83", - "green": "#859900", - "name": "Solarized Light", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, - { - "background": "#000000", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#FFFFFF", - "cyan": "#06989A", - "foreground": "#D3D7CF", - "green": "#4E9A06", - "name": "Tango Dark", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, - { - "background": "#FFFFFF", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#000000", - "cyan": "#06989A", - "foreground": "#555753", - "green": "#4E9A06", - "name": "Tango Light", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, - { - "background": "#000000", - "black": "#000000", - "blue": "#000080", - "brightBlack": "#808080", - "brightBlue": "#0000FF", - "brightCyan": "#00FFFF", - "brightGreen": "#00FF00", - "brightPurple": "#FF00FF", - "brightRed": "#FF0000", - "brightWhite": "#FFFFFF", - "brightYellow": "#FFFF00", - "cursorColor": "#FFFFFF", - "cyan": "#008080", - "foreground": "#C0C0C0", - "green": "#008000", - "name": "Vintage", - "purple": "#800080", - "red": "#800000", - "selectionBackground": "#FFFFFF", - "white": "#C0C0C0", - "yellow": "#808000" - } - ] -} \ No newline at end of file