diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/archlinux/README.md | 2 | ||||
-rw-r--r-- | plugins/autojump/autojump.plugin.zsh | 58 | ||||
-rw-r--r-- | plugins/cloudapp/cloudapp.plugin.zsh | 8 | ||||
-rw-r--r-- | plugins/docker-compose/_docker-compose | 168 | ||||
-rwxr-xr-x | plugins/emacs/emacsclient.sh | 2 | ||||
-rw-r--r-- | plugins/git-prompt/README.md | 61 | ||||
-rw-r--r-- | plugins/git-prompt/git-prompt.plugin.zsh | 3 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 7 | ||||
-rw-r--r-- | plugins/gitfast/README.md | 129 | ||||
-rw-r--r-- | plugins/gulp/gulp.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/httpie/README.md | 17 | ||||
-rw-r--r-- | plugins/httpie/_httpie | 181 | ||||
-rw-r--r-- | plugins/httpie/httpie.plugin.zsh | 33 | ||||
-rw-r--r-- | plugins/iwhois/README.md | 24 | ||||
-rw-r--r-- | plugins/iwhois/iwhois.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/osx/osx.plugin.zsh | 37 | ||||
-rw-r--r-- | plugins/pip/pip.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/swiftpm/README.md | 2 | ||||
-rw-r--r-- | plugins/swiftpm/_swift | 235 | ||||
-rw-r--r-- | plugins/tmuxinator/_tmuxinator | 6 | ||||
-rw-r--r-- | plugins/vi-mode/vi-mode.plugin.zsh | 3 |
21 files changed, 579 insertions, 410 deletions
diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 7ebe8e53d..ff2b6a4c4 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -14,7 +14,7 @@ | yalocs | yay -Qs | Search for packages in the local database | | yalst | yay -Qe | List installed packages including from AUR (tagged as "local") | | yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist | -| yaorph | yay -Qtd | Remove orphans using yaourt | +| yaorph | yay -Qtd | Remove orphans using yay | | yare | yay -R | Remove packages, keeping its settings and dependencies | | yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies | | yarep | yay -Si | Display information about a package in the repositories | diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index c0af67631..13c1d00ed 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,23 +1,39 @@ -if [ $commands[autojump] ]; then # check if autojump is installed - if [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation - . $HOME/.autojump/etc/profile.d/autojump.zsh - elif [ -f $HOME/.autojump/share/autojump/autojump.zsh ]; then # another manual user-local installation - . $HOME/.autojump/share/autojump/autojump.zsh - elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation - . $HOME/.nix-profile/etc/profile.d/autojump.zsh - elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation - . /run/current-system/sw/share/autojump/autojump.zsh - elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package - . /usr/share/autojump/autojump.zsh - elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation - . /etc/profile.d/autojump.zsh - elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation - . /etc/profile.d/autojump.sh - elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation - . /usr/local/share/autojump/autojump.zsh - elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports - . /opt/local/etc/profile.d/autojump.sh - elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew - . `brew --prefix`/etc/autojump.sh +(( $+commands[autojump] )) || { + echo '[oh-my-zsh] Please install autojump first (https://github.com/wting/autojump)' + return +} + +declare -a autojump_paths +autojump_paths=( + $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation + $HOME/.autojump/share/autojump/autojump.zsh # manual installation + $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation + /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation + /usr/share/autojump/autojump.zsh # Debian and Ubuntu package + /etc/profile.d/autojump.zsh # manual installation + /etc/profile.d/autojump.sh # Gentoo installation + /usr/local/share/autojump/autojump.zsh # FreeBSD installation + /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts + /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default) +) + +for file in $autojump_paths; do + if [[ -f "$file" ]]; then + source "$file" + found=1 + break + fi +done + +# if no path found, try Homebrew +if (( ! found && $+commands[brew] )); then + file=$(brew --prefix)/etc/profile.d/autojump.sh + if [[ -f "$file" ]]; then + source "$file" + found=1 fi fi + +(( ! found )) && echo '[oh-my-zsh] autojump script not found' + +unset autojump_paths file found diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh index 99252f690..3b363c81b 100644 --- a/plugins/cloudapp/cloudapp.plugin.zsh +++ b/plugins/cloudapp/cloudapp.plugin.zsh @@ -1,2 +1,6 @@ -#!/bin/zsh -alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb +alias cloudapp="${0:a:h}/cloudapp.rb" + +# Ensure only the owner can access the credentials file +if [[ -f ~/.cloudapp ]]; then + chmod 600 ~/.cloudapp +fi diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose index c0a54cced..808b068a3 100644 --- a/plugins/docker-compose/_docker-compose +++ b/plugins/docker-compose/_docker-compose @@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() { local already_selected local -a services already_selected=$(echo $words | tr " " "|") - __docker-compose_q config --services \ + __docker-compose_q ps --services "$@" \ | grep -Ev "^(${already_selected})$" } @@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() { __docker-compose_services_all() { [[ $PREFIX = -* ]] && return 1 integer ret=1 - services=$(__docker-compose_all_services_in_compose_file) + services=$(__docker-compose_all_services_in_compose_file "$@") _alternative "args:services:($services)" && ret=0 return ret } -# All services that have an entry with the given key in their docker-compose.yml section -__docker-compose_services_with_key() { - local already_selected - local -a buildable - already_selected=$(echo $words | tr " " "|") - # flatten sections to one line, then filter lines containing the key and return section name. - __docker-compose_q config \ - | sed -n -e '/^services:/,/^[^ ]/p' \ - | sed -n 's/^ //p' \ - | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \ - | grep " \+$1:" \ - | cut -d: -f1 \ - | grep -Ev "^(${already_selected})$" -} - # All services that are defined by a Dockerfile reference __docker-compose_services_from_build() { [[ $PREFIX = -* ]] && return 1 - integer ret=1 - buildable=$(__docker-compose_services_with_key build) - _alternative "args:buildable services:($buildable)" && ret=0 - - return ret + __docker-compose_services_all --filter source=build } # All services that are defined by an image __docker-compose_services_from_image() { [[ $PREFIX = -* ]] && return 1 - integer ret=1 - pullable=$(__docker-compose_services_with_key image) - _alternative "args:pullable services:($pullable)" && ret=0 - - return ret -} - -__docker-compose_get_services() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local kind - declare -a running paused stopped lines args services - - docker_status=$(docker ps > /dev/null 2>&1) - if [ $? -ne 0 ]; then - _message "Error! Docker is not running." - return 1 - fi - - kind=$1 - shift - [[ $kind =~ (stopped|all) ]] && args=($args -a) - - lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"}) - services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - lines=(${lines[2,-1]}) - - # Container ID - local line s name - local -a names - for line in $lines; do - if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then - names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}}) - for name in $names; do - s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" - s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}" - s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then - stopped=($stopped $s) - else - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then - paused=($paused $s) - fi - running=($running $s) - fi - done - fi - done - - [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0 - [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0 - [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0 - - return ret + __docker-compose_services_all --filter source=image } __docker-compose_pausedservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services paused "$@" + __docker-compose_services_all --filter status=paused } __docker-compose_stoppedservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services stopped "$@" + __docker-compose_services_all --filter status=stopped } __docker-compose_runningservices() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services running "$@" + __docker-compose_services_all --filter status=running } __docker-compose_services() { [[ $PREFIX = -* ]] && return 1 - __docker-compose_get_services all "$@" + __docker-compose_services_all } __docker-compose_caching_policy() { @@ -196,9 +113,12 @@ __docker-compose_subcommand() { $opts_help \ "*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \ '--force-rm[Always remove intermediate containers.]' \ - '--memory[Memory limit for the build container.]' \ + '(--quiet -q)'{--quiet,-q}'[Curb build output]' \ + '(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \ '--no-cache[Do not use cache when building the image.]' \ '--pull[Always attempt to pull a newer version of the image.]' \ + '--compress[Compress the build context using gzip.]' \ + '--parallel[Build images in parallel.]' \ '*:services:__docker-compose_services_from_build' && ret=0 ;; (bundle) @@ -213,7 +133,8 @@ __docker-compose_subcommand() { '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ '--resolve-image-digests[Pin image tags to digests.]' \ '--services[Print the service names, one per line.]' \ - '--volumes[Print the volume names, one per line.]' && ret=0 + '--volumes[Print the volume names, one per line.]' \ + '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0 ;; (create) _arguments \ @@ -222,11 +143,12 @@ __docker-compose_subcommand() { $opts_no_recreate \ $opts_no_build \ "(--no-build)--build[Build images before creating containers.]" \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (down) _arguments \ $opts_help \ + $opts_timeout \ "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ $opts_remove_orphans && ret=0 @@ -235,16 +157,18 @@ __docker-compose_subcommand() { _arguments \ $opts_help \ '--json[Output events as a stream of json objects]' \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (exec) _arguments \ $opts_help \ '-d[Detached mode: Run command in the background.]' \ '--privileged[Give extended privileges to the process.]' \ - '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ + '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ + '*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ + '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-):running services:__docker-compose_runningservices' \ '(-):command: _command_names -e' \ '*::arguments: _normal' && ret=0 @@ -252,12 +176,12 @@ __docker-compose_subcommand() { (help) _arguments ':subcommand:__docker-compose_commands' && ret=0 ;; - (images) - _arguments \ - $opts_help \ - '-q[Only display IDs]' \ - '*:services:__docker-compose_services_all' && ret=0 - ;; + (images) + _arguments \ + $opts_help \ + '-q[Only display IDs]' \ + '*:services:__docker-compose_services' && ret=0 + ;; (kill) _arguments \ $opts_help \ @@ -271,7 +195,7 @@ __docker-compose_subcommand() { $opts_no_color \ '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (pause) _arguments \ @@ -290,12 +214,16 @@ __docker-compose_subcommand() { _arguments \ $opts_help \ '-q[Only display IDs]' \ - '*:services:__docker-compose_services_all' && ret=0 + '--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \ + '*:services:__docker-compose_services' && ret=0 ;; (pull) _arguments \ $opts_help \ '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ + '--no-parallel[Disable parallel pulling]' \ + '(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \ + '--include-deps[Also pull services declared as dependencies]' \ '*:services:__docker-compose_services_from_image' && ret=0 ;; (push) @@ -317,6 +245,7 @@ __docker-compose_subcommand() { $opts_no_deps \ '-d[Detached mode: Run container in the background, print new container name.]' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ + '*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--name=[Assign a name to the container]:name: ' \ '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ @@ -326,6 +255,7 @@ __docker-compose_subcommand() { '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ + "--use-aliases[Use the services network aliases in the network(s) the container connects to]" \ '(-):services:__docker-compose_services' \ '(-):command: _command_names -e' \ '*::arguments: _normal' && ret=0 @@ -369,8 +299,10 @@ __docker-compose_subcommand() { "(--no-build)--build[Build images before starting containers.]" \ "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ + '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \ + '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \ $opts_remove_orphans \ - '*:services:__docker-compose_services_all' && ret=0 + '*:services:__docker-compose_services' && ret=0 ;; (version) _arguments \ @@ -409,8 +341,11 @@ _docker-compose() { '(- :)'{-h,--help}'[Get help]' \ '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ - '--verbose[Show more output]' \ + "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \ '(- :)'{-v,--version}'[Print version and exit]' \ + '--verbose[Show more output]' \ + '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \ + '--no-ansi[Do not print ANSI control characters]' \ '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ '--tls[Use TLS; implied by --tlsverify]' \ '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ @@ -421,7 +356,7 @@ _docker-compose() { '(-): :->command' \ '(-)*:: :->option-or-argument' && ret=0 - local -a relevant_compose_flags relevant_docker_flags compose_options docker_options + local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options relevant_compose_flags=( "--file" "-f" @@ -435,6 +370,10 @@ _docker-compose() { "--skip-hostname-check" ) + relevant_compose_repeatable_flags=( + "--file" "-f" + ) + relevant_docker_flags=( "--host" "-H" "--tls" @@ -452,9 +391,18 @@ _docker-compose() { fi fi if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then - compose_options+=$k - if [[ -n "$opt_args[$k]" ]]; then - compose_options+=$opt_args[$k] + if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then + values=("${(@s/:/)opt_args[$k]}") + for value in $values + do + compose_options+=$k + compose_options+=$value + done + else + compose_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + compose_options+=$opt_args[$k] + fi fi fi done diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 26b28d495..b4f49e12b 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -5,7 +5,7 @@ _emacsfun() # get list of emacs frames. frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` - if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then + if [ "$(echo "$frameslist" | sed -n '$=')" -ge 1 ] ;then # prevent creating another X frame if there is at least one present. emacsclient --alternate-editor "" "$@" else diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md new file mode 100644 index 000000000..e3b2d623a --- /dev/null +++ b/plugins/git-prompt/README.md @@ -0,0 +1,61 @@ +# git-prompt plugin + +A `zsh` prompt that displays information about the current git repository. In particular: +the branch name, difference with remote branch, number of files staged or changed, etc. + +To use it, add `git-prompt` to the plugins array in your zshrc file: + +```zsh +plugins=(... git-prompt) +``` + +See the [original repository](https://github.com/olivierverdier/zsh-git-prompt). + +## Examples + +The prompt may look like the following: + +- `(master↑3|✚1)`: on branch `master`, ahead of remote by 3 commits, 1 file changed but not staged +- `(status|●2)`: on branch `status`, 2 files staged +- `(master|✚7…)`: on branch `master`, 7 files changed, some files untracked +- `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed +- `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean +- `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean + +## Prompt Structure + +By default, the general appearance of the prompt is: + +``` +(<branch><branch tracking>|<local status>) +``` + +The symbols are as follows: + +### Local Status Symbols + +| Symbol | Meaning | +|--------|--------------------------------| +| ✔ | repository clean | +| ●n | there are `n` staged files | +| ✖n | there are `n` unmerged files | +| ✚n | there are `n` unstaged files | +| … | there are some untracked files | + +### Branch Tracking Symbols + +| Symbol | Meaning | +|--------|---------------------------------------------------------------| +| ↑n | ahead of remote by `n` commits | +| ↓n | behind remote by `n` commits | +| ↓m↑n | branches diverged: other by `m` commits, yours by `n` commits | + +## Customisation + +- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching. +- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`) + to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)` + to see what variables are available. + + +**Enjoy!** diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index 2776f297f..76ac2e62b 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -1,6 +1,3 @@ -# ZSH Git Prompt Plugin from: -# https://github.com/olivierverdier/zsh-git-prompt - __GIT_PROMPT_DIR="${0:A:h}" ## Hook function definitions diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index a4b6eb977..ef4697906 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -239,7 +239,12 @@ alias gsps='git show --pretty=short --show-signature' alias gsr='git svn rebase' alias gss='git status -s' alias gst='git status' -alias gsta='git stash save' + +# use the default stash push on git 2.13 and newer +[[ "$(git --version 2>/dev/null)" =~ '^git version ([0-9]+.[0-9]+)' && "$match" -ge '2.13' ]] \ + && alias gsta='git stash push' \ + || alias gsta='git stash save' + alias gstaa='git stash apply' alias gstc='git stash clear' alias gstd='git stash drop' diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md index c3073709e..84e35d77c 100644 --- a/plugins/gitfast/README.md +++ b/plugins/gitfast/README.md @@ -10,129 +10,6 @@ plugins=(... gitfast) ## Aliases -| Alias | Command | -| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -| g | `git` | -| ga | `git add` | -| gaa | `git add --all` | -| gapa | `git add --patch` | -| gau | `git add --update` | -| gb | `git branch` | -| gba | `git branch -a` | -| gbd | `git branch -d` | -| gbda | `git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d` | -| gbl | `git blame -b -w` | -| gbnm | `git branch --no-merged` | -| gbr | `git branch --remote` | -| gbs | `git bisect` | -| gbsb | `git bisect bad` | -| gbsg | `git bisect good` | -| gbsr | `git bisect reset` | -| gbss | `git bisect start` | -| gc | `git commit -v` | -| gc! | `git commit -v --amend` | -| gca | `git commit -v -a` | -| gca! | `git commit -v -a --amend` | -| gcam | `git commit -a -m` | -| gcan! | `git commit -v -a --no-edit --amend` | -| gcans! | `git commit -v -a -s --no-edit --amend` | -| gcb | `git checkout -b` | -| gcd | `git checkout develop` | -| gcf | `git config --list` | -| gcl | `git clone --recursive` | -| gclean | `git clean -fd` | -| gcm | `git checkout master` | -| gcmsg | `git commit -m` | -| gcn! | `git commit -v --no-edit --amend` | -| gco | `git checkout` | -| gcount | `git shortlog -sn` | -| gcp | `git cherry-pick` | -| gcpa | `git cherry-pick --abort` | -| gcpc | `git cherry-pick --continue` | -| gcs | `git commit -S` | -| gcsm | `git commit -s -m` | -| gd | `git diff` | -| gdca | `git diff --cached` | -| gdct | `` git describe --tags `git rev-list --tags --max-count=1` `` | -| gdt | `git diff-tree --no-commit-id --name-only -r` | -| gdw | `git diff --word-diff` | -| gf | `git fetch` | -| gfa | `git fetch --all --prune` | -| gfo | `git fetch origin` | -| gg | `git gui citool` | -| gga | `git gui citool --amend` | -| ggpull | `git pull origin $(git_current_branch)` | -| ggpur | `ggu` | -| ggpush | `git push origin $(git_current_branch)` | -| ggsup | `git branch --set-upstream-to=origin/$(git_current_branch)` | -| ghh | `git help` | -| gignore | `git update-index --assume-unchanged` | -| gignored | `git ls-files -v | grep "^[[:lower:]]"` | -| git-svn-dcommit-push | `git svn dcommit && git push github master:svntrunk` | -| gk | `\gitk --all --branches` | -| gke | `\gitk --all $(git log -g --pretty=%h)` | -| gl | `git pull` | -| glg | `git log --stat` | -| glgg | `git log --graph` | -| glgga | `git log --graph --decorate --all` | -| glgm | `git log --graph --max-count=10` | -| glgp | `git log --stat -p` | -| glo | `git log --oneline --decorate` | -| glog | `git log --oneline --decorate --graph` | -| gloga | `git log --oneline --decorate --graph --all` | -| glol | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit` | -| glola | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all` | -| glp | `_git_log_prettily` | -| glum | `git pull upstream master` | -| gm | `git merge` | -| gmom | `git merge origin/master` | -| gmt | `git mergetool --no-prompt` | -| gmtvim | `git mergetool --no-prompt --tool=vimdiff` | -| gmum | `git merge upstream/master` | -| gp | `git push` | -| gpd | `git push --dry-run` | -| gpoat | `git push origin --all && git push origin --tags` | -| gpristine | `git reset --hard && git clean -dfx` | -| gpsup | `git push --set-upstream origin $(git_current_branch)` | -| gpu | `git push upstream` | -| gpv | `git push -v` | -| gr | `git remote` | -| gra | `git remote add` | -| grb | `git rebase` | -| grba | `git rebase --abort` | -| grbc | `git rebase --continue` | -| grbi | `git rebase -i` | -| grbm | `git rebase master` | -| grbs | `git rebase --skip` | -| grh | `git reset HEAD` | -| grhh | `git reset HEAD --hard` | -| grmv | `git remote rename` | -| grrm | `git remote remove` | -| grset | `git remote set-url` | -| grt | `cd $(git rev-parse --show-toplevel || echo ".")` | -| gru | `git reset --` | -| grup | `git remote update` | -| grv | `git remote -v` | -| gsb | `git status -sb` | -| gsd | `git svn dcommit` | -| gsi | `git submodule init` | -| gsps | `git show --pretty=short --show-signature` | -| gsr | `git svn rebase` | -| gss | `git status -s` | -| gst | `git status` | -| gsta | `git stash save` | -| gstaa | `git stash apply` | -| gstc | `git stash clear` | -| gstd | `git stash drop` | -| gstl | `git stash list` | -| gstp | `git stash pop` | -| gsts | `git stash show --text` | -| gsu | `git submodule update` | -| gts | `git tag -s` | -| gtv | `git tag | sort -V` | -| gunignore | `git update-index --no-assume-unchanged` | -| gunwip | `git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1` | -| gup | `git pull --rebase` | -| gupv | `git pull --rebase -v` | -| gwch | `git whatchanged -p --abbrev-commit --pretty=medium` | -| gwip | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"` | +An earlier version of the plugin also loaded the git plugin. If you want to keep those +aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git) +as well. diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index 2b3105135..ec597421d 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -19,11 +19,11 @@ # Grabs all available tasks from the `gulpfile.js` # in the current directory. # -function $$gulp_completion { +function _gulp_completion { compls=$(gulp --tasks-simple 2>/dev/null) completions=(${=compls}) compadd -- $completions } -compdef $$gulp_completion gulp +compdef _gulp_completion gulp diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md index 56aa6a8ca..f22d3a64e 100644 --- a/plugins/httpie/README.md +++ b/plugins/httpie/README.md @@ -1,6 +1,15 @@ -## HTTPie -**Maintainer:** [lululau](https://github.com/lululau) +# HTTPie plugin + +This plugin adds completion for [HTTPie](https://httpie.org), a command line HTTP +client, a friendlier cURL replacement. + +To use it, add `httpie` to the plugins array in your zshrc file: -This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement. +```zsh +plugins=(... httpie) +``` -[HTTPie Homepage](https://httpie.org) +It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions). + + +**Maintainer:** [lululau](https://github.com/lululau) diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie new file mode 100644 index 000000000..4d702ef60 --- /dev/null +++ b/plugins/httpie/_httpie @@ -0,0 +1,181 @@ +#compdef http +# ------------------------------------------------------------------------------ +# Copyright (c) 2015 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for httpie 0.7.2 (http://httpie.org) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Akira Maeda <https://github.com/glidenote> +# * Valodim <https://github.com/Valodim> +# * Claus Klingberg <https://github.com/cjk> +# +# ------------------------------------------------------------------------------ +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------ + +_httpie_params () { + + local ret=1 expl + + # or a url + if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then + _httpie_urls && ret=0 + + # regular param, if we already have a url + elif (( CURRENT > NORMARG )); then + + # if the suffix is precisely : this is shorthand for a header + if [[ -prefix ':' ]]; then + PREFIX= + SUFFIX=: + fi + + # if we are in front of a : (possibly due to the PREFIX move before) + if [[ -suffix ':' ]]; then + + # this is rather buggy with normal tab behavior :\ + compstate[insert]=menu + _wanted http_header expl 'HTTP Header' \ + compadd -s ':' -S '' -- Content-Type Cookie && return 0 + fi + + # ignore all prefix stuff + compset -P '(#b)([^:@=]#)' + local name=$match[1] + + if compset -P '='; then + _message "$name data field value" + elif compset -P '@'; then + _files + elif compset -P ':=@'; then + _files + elif compset -P ':='; then + _message "$name raw json data" + elif compset -P '=='; then + _message "$name url parameter value" + elif compset -P ':'; then + _message "$name header content" + else + typeset -a ops + ops=( + '=:data field' + '\::header' + '==:request parameter' + '@:data file field' + '\:=:raw json field' + '\:=@:raw json field file path' + ) + _describe -t httpparams "parameter types" ops -Q -S '' + fi + + ret=0 + + fi + + # first arg may be a request method + (( CURRENT == NORMARG )) && + _wanted http_method expl 'Request Method' \ + compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0 + + return $ret + +} + +_httpie_urls() { + + local ret=1 + + if ! [[ -prefix [-+.a-z0-9]#:// ]]; then + local expl + compset -S '[^:/]*' && compstate[to_end]='' + _wanted url-schemas expl 'URL schema' compadd -S '' http:// https:// && ret=0 + else + _urls && ret=0 + fi + + return $ret + +} + +_httpie_printflags () { + + local ret=1 + + # not sure why this is necessary, but it will complete "-pH" style without it + [[ $IPREFIX == "-p" ]] && IPREFIX+=" " + + compset -P '(#b)([a-zA-Z]#)' + + local -a flags + [[ $match[1] != *H* ]] && flags+=( "H:request headers" ) + [[ $match[1] != *B* ]] && flags+=( "B:request body" ) + [[ $match[1] != *h* ]] && flags+=( "h:response headers" ) + [[ $match[1] != *b* ]] && flags+=( "b:response body" ) + + _describe -t printflags "print flags" flags -S '' && ret=0 + + return $ret + +} + +integer NORMARG + +_arguments -n -C -s \ + '(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \ + '(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \ + '--pretty=[Controls output processing.]:output format:(all colors format none)' \ + '(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \ + '(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \ + '(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \ + '(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \ + '(-p -b --body)'{-b,--body}'[Print only the response body.]' \ + '(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \ + '(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \ + '(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \ + '(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \ + '(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \ + '(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \ + '(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \ + '--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \ + '--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \ + '--follow[Allow full redirects.]' \ + "--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \ + '--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \ + '--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \ + '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \ + '--ignore-stdin[Do not attempt to read stdin.]' \ + '(- *)--help[show help message.]' \ + "(- *)--version[show program's version number and exit.]" \ + '--traceback[Prints exception traceback should one occur.]' \ + '--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \ + '*:args:_httpie_params' && return 0 diff --git a/plugins/httpie/httpie.plugin.zsh b/plugins/httpie/httpie.plugin.zsh deleted file mode 100644 index 68ead6c67..000000000 --- a/plugins/httpie/httpie.plugin.zsh +++ /dev/null @@ -1,33 +0,0 @@ -function _httpie_completion() { - _arguments -C \ - '(- 1 *)--version[display version information]' \ - '(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \ - '(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \ - '(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \ - '(-s|--style)'{-s,--style}'[Output coloring style]' \ - '(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \ - '(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \ - '(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \ - '(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \ - '(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \ - '(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \ - '(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \ - '(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \ - '(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \ - '(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \ - '(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \ - '(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \ - '(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \ - '(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \ - '(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \ - '(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \ - '(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \ - '(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \ - '(--help)--help[Show this help message and exit]' \ - '(--traceback)--traceback[Prints exception traceback should one occur]' \ - '(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 -} - -compdef _httpie_completion http
\ No newline at end of file diff --git a/plugins/iwhois/README.md b/plugins/iwhois/README.md deleted file mode 100644 index 1626b8524..000000000 --- a/plugins/iwhois/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# iwhois - -Provides a whois command with a more accurate and up-to-date list of whois servers -using CNAMES, via [whois.geek.nz](https://github.com/iwantmyname/whois.geek.nz). - -To use it, add iwhois to the plugins array of your zshrc file: -``` -plugins=(... iwhois) -``` - -### Usage - -The plugin defines the function `iwhois` that takes a domain name as an argument: - -``` -$ iwhois github.com - Domain Name: GITHUB.COM - Registry Domain ID: 1264983250_DOMAIN_COM-VRSN - Registrar WHOIS Server: whois.markmonitor.com - Registrar URL: http://www.markmonitor.com - Updated Date: 2017-06-26T16:02:39Z - Creation Date: 2007-10-09T18:20:50Z - ... -``` diff --git a/plugins/iwhois/iwhois.plugin.zsh b/plugins/iwhois/iwhois.plugin.zsh deleted file mode 100644 index 22a75eec1..000000000 --- a/plugins/iwhois/iwhois.plugin.zsh +++ /dev/null @@ -1,5 +0,0 @@ -function iwhois() { - resolver="whois.geek.nz" - tld=`echo ${@: -1} | awk -F "." '{print $NF}'` - whois -h ${tld}.${resolver} "$@" ; -} diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a1c73a184..7deed0ba6 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -51,6 +51,17 @@ EOF end tell end tell EOF + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" to keystroke "t" using command down + end tell + delay 1 + tell application "System Events" + keystroke "${command}" + key code 36 #(presses enter) + end tell +EOF else echo "tab: unsupported terminal app: $the_app" @@ -91,6 +102,19 @@ EOF end tell end tell EOF + + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" + tell menu item "Split Vertically" of menu "Shell" of menu bar 1 + click + end tell + end tell + delay 1 + keystroke "${command} \n" + end tell +EOF else echo "$0: unsupported terminal app: $the_app" >&2 @@ -132,6 +156,19 @@ EOF end tell EOF + elif [[ "$the_app" == 'Hyper' ]]; then + osascript >/dev/null <<EOF + tell application "System Events" + tell process "Hyper" + tell menu item "Split Horizontally" of menu "Shell" of menu bar 1 + click + end tell + end tell + delay 1 + keystroke "${command} \n" + end tell +EOF + else echo "$0: unsupported terminal app: $the_app" >&2 false diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index d7236b02a..5539187e1 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -10,7 +10,7 @@ # "zsh-pip-clear-cache". ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache -ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) +ZSH_PIP_INDEXES=(https://pypi.org/simple/) zsh-pip-clear-cache() { rm $ZSH_PIP_CACHE_FILE @@ -31,7 +31,7 @@ zsh-pip-cache-packages() { tmp_cache=/tmp/zsh_tmp_cache for index in $ZSH_PIP_INDEXES ; do # well... I've already got two problems - curl $index 2>/dev/null | \ + curl -L $index 2>/dev/null | \ zsh-pip-clean-packages \ >> $tmp_cache done diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md index 07ca25651..291458511 100644 --- a/plugins/swiftpm/README.md +++ b/plugins/swiftpm/README.md @@ -2,7 +2,7 @@ ## Description -This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager). +This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0. To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift index bed6e13a7..1366b4d9c 100644 --- a/plugins/swiftpm/_swift +++ b/plugins/swiftpm/_swift @@ -72,16 +72,23 @@ _swift_build() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--build-tests[Build both source and test targets]" "--product[Build the specified product]:Build the specified product: " "--target[Build the specified target]:Build the specified target: " @@ -108,17 +115,26 @@ _swift_run() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--skip-build[Skip building the executable product]" + "--build-tests[Build both source and test targets]" + "--repl[Launch Swift REPL for the package]" ) _arguments $arguments && return } @@ -140,16 +156,23 @@ _swift_package() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" '(-): :->command' '(-)*:: :->arg' ) @@ -158,91 +181,124 @@ _swift_package() { (command) local modes modes=( - 'edit:Put a package in editable mode' - 'clean:Delete build artifacts' - 'init:Initialize a new package' - 'dump-package:Print parsed Package.swift as JSON' + 'update:Update package dependencies' 'describe:Describe the current package' + 'resolve:Resolve package dependencies' + 'tools-version:Manipulate tools version of the current package' 'unedit:Remove a package from editable mode' - 'update:Update package dependencies' + 'show-dependencies:Print the resolved dependency graph' + 'fetch:' + 'dump-package:Print parsed Package.swift as JSON' + 'edit:Put a package in editable mode' + 'config:Manipulate configuration of the package' 'completion-tool:Completion tool (for shell completions)' - 'tools-version:Manipulate tools version of the current package' - 'reset:Reset the complete cache/build directory' - 'resolve:Resolve package dependencies' + 'clean:Delete build artifacts' 'generate-xcodeproj:Generates an Xcode project' - 'fetch:' - 'show-dependencies:Print the resolved dependency graph' + 'reset:Reset the complete cache/build directory' + 'init:Initialize a new package' ) _describe "mode" modes ;; (arg) case ${words[1]} in - (edit) - _swift_package_edit - ;; - (clean) - _swift_package_clean - ;; - (init) - _swift_package_init - ;; - (dump-package) - _swift_package_dump-package + (update) + _swift_package_update ;; (describe) _swift_package_describe ;; + (resolve) + _swift_package_resolve + ;; + (tools-version) + _swift_package_tools-version + ;; (unedit) _swift_package_unedit ;; - (update) - _swift_package_update + (show-dependencies) + _swift_package_show-dependencies ;; - (completion-tool) - _swift_package_completion-tool + (fetch) + _swift_package_fetch ;; - (tools-version) - _swift_package_tools-version + (dump-package) + _swift_package_dump-package ;; - (reset) - _swift_package_reset + (edit) + _swift_package_edit ;; - (resolve) - _swift_package_resolve + (config) + _swift_package_config + ;; + (completion-tool) + _swift_package_completion-tool + ;; + (clean) + _swift_package_clean ;; (generate-xcodeproj) _swift_package_generate-xcodeproj ;; - (fetch) - _swift_package_fetch + (reset) + _swift_package_reset ;; - (show-dependencies) - _swift_package_show-dependencies + (init) + _swift_package_init ;; esac ;; esac } -_swift_package_edit() { +_swift_package_update() { arguments=( - ":The name of the package to edit:_swift_dependency" - "--revision[The revision to edit]:The revision to edit: " - "--branch[The branch to create]:The branch to create: " - "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files" ) _arguments $arguments && return } -_swift_package_clean() { +_swift_package_describe() { arguments=( + "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}" ) _arguments $arguments && return } -_swift_package_init() { +_swift_package_resolve() { + arguments=( + ":The name of the package to resolve:_swift_dependency" + "--version[The version to resolve at]:The version to resolve at: " + "--branch[The branch to resolve at]:The branch to resolve at: " + "--revision[The revision to resolve at]:The revision to resolve at: " + ) + _arguments $arguments && return +} + +_swift_package_tools-version() { + arguments=( + "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " + "--set-current[Set tools version of package to the current tools version in use]" + ) + _arguments $arguments && return +} + +_swift_package_unedit() { + arguments=( + ":The name of the package to unedit:_swift_dependency" + "--force[Unedit the package even if it has uncommited and unpushed changes.]" + ) + _arguments $arguments && return +} + +_swift_package_show-dependencies() { + arguments=( + "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" + ) + _arguments $arguments && return +} + +_swift_package_fetch() { arguments=( - "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" ) _arguments $arguments && return } @@ -253,54 +309,80 @@ _swift_package_dump-package() { _arguments $arguments && return } -_swift_package_describe() { +_swift_package_edit() { arguments=( - "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}" + ":The name of the package to edit:_swift_dependency" + "--revision[The revision to edit]:The revision to edit: " + "--branch[The branch to create]:The branch to create: " + "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files" ) _arguments $arguments && return } -_swift_package_unedit() { +_swift_package_config() { arguments=( - ":The name of the package to unedit:_swift_dependency" - "--force[Unedit the package even if it has uncommited and unpushed changes.]" + '(-): :->command' + '(-)*:: :->arg' ) _arguments $arguments && return + case $state in + (command) + local modes + modes=( + 'unset-mirror:Remove an existing mirror' + 'set-mirror:Set a mirror for a dependency' + 'get-mirror:Print mirror configuration for the given package dependency' + ) + _describe "mode" modes + ;; + (arg) + case ${words[1]} in + (unset-mirror) + _swift_package_config_unset-mirror + ;; + (set-mirror) + _swift_package_config_set-mirror + ;; + (get-mirror) + _swift_package_config_get-mirror + ;; + esac + ;; + esac } -_swift_package_update() { +_swift_package_config_unset-mirror() { arguments=( + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " ) _arguments $arguments && return } -_swift_package_completion-tool() { +_swift_package_config_set-mirror() { arguments=( - ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" + "--package-url[The package dependency url]:The package dependency url: " + "--mirror-url[The mirror url]:The mirror url: " ) _arguments $arguments && return } -_swift_package_tools-version() { +_swift_package_config_get-mirror() { arguments=( - "--set[Set tools version of package to the given value]:Set tools version of package to the given value: " - "--set-current[Set tools version of package to the current tools version in use]" + "--package-url[The package dependency url]:The package dependency url: " ) _arguments $arguments && return } -_swift_package_reset() { +_swift_package_completion-tool() { arguments=( + ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}" ) _arguments $arguments && return } -_swift_package_resolve() { +_swift_package_clean() { arguments=( - ":The name of the package to resolve:_swift_dependency" - "--version[The version to resolve at]:The version to resolve at: " - "--branch[The branch to resolve at]:The branch to resolve at: " - "--revision[The revision to resolve at]:The revision to resolve at: " ) _arguments $arguments && return } @@ -312,19 +394,21 @@ _swift_package_generate-xcodeproj() { "--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files" "--legacy-scheme-generator[Use the legacy scheme generator]" "--watch[Watch for changes to the Package manifest to regenerate the Xcode project]" + "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]" ) _arguments $arguments && return } -_swift_package_fetch() { +_swift_package_reset() { arguments=( ) _arguments $arguments && return } -_swift_package_show-dependencies() { +_swift_package_init() { arguments=( - "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}" + "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}" + "--name[Provide custom package name]:Provide custom package name: " ) _arguments $arguments && return } @@ -346,23 +430,32 @@ _swift_test() { "--build-path[Specify build/cache directory ]:Specify build/cache directory :_files" "(--chdir -C)"{--chdir,-C}"[]: :_files" "--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files" - "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}" + "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}" "--disable-prefetching[]" "--skip-update[Skip updating dependencies from their remote during a resolution]" "--disable-sandbox[Disable using the sandbox when executing subprocesses]" + "--disable-package-manifest-caching[Disable caching Package.swift manifests]" "--version[]" "--destination[]: :_files" "(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]" "--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]" "--static-swift-stdlib[Link Swift stdlib statically]" - "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]" + "--enable-llbuild-library[Enable building with the llbuild library]" + "--force-resolved-versions[]" + "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]" + "--enable-index-store[Enable indexing-while-building feature]" + "--disable-index-store[Disable indexing-while-building feature]" + "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]" + "--enable-parseable-module-interfaces[]" "--skip-build[Skip building the test target]" "(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]" "--generate-linuxmain[Generate LinuxMain.swift entries for the package]" "--parallel[Run the tests in parallel.]" + "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute in parallel.: " "(--specifier -s)"{--specifier,-s}"[]: : " "--xunit-output[]: :_files" "--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: " + "--enable-code-coverage[Test with code coverage enabled]" ) _arguments $arguments && return } diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator index 37032f8d8..9ae25ac38 100644 --- a/plugins/tmuxinator/_tmuxinator +++ b/plugins/tmuxinator/_tmuxinator @@ -1,3 +1,6 @@ +#compdef tmuxinator mux +#autoload + _tmuxinator() { local commands projects commands=(${(f)"$(tmuxinator commands zsh)"}) @@ -17,5 +20,4 @@ _tmuxinator() { return } -compdef _tmuxinator tmuxinator mux -alias mux="tmuxinator" +compdef _tmuxinator tmuxinator diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 93964594b..c1cdd2851 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -28,8 +28,9 @@ bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char bindkey '^w' backward-kill-word -# allow ctrl-r to perform backward search in history +# allow ctrl-r and ctrl-s to search the history bindkey '^r' history-incremental-search-backward +bindkey '^s' history-incremental-search-forward # allow ctrl-a and ctrl-e to move to beginning/end of line bindkey '^a' beginning-of-line |