Merge branch 'ohmyzsh:master' into master

This commit is contained in:
Jorge Francisco Varela Gutiérrez 2025-06-02 13:15:07 -06:00 committed by GitHub
commit 6d97234f3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
360 changed files with 8613 additions and 5675 deletions

View file

@ -1,9 +1,15 @@
# Do nothing if op is not installed
(( ${+commands[op]} )) || return
# Load op completion
eval "$(op completion zsh)"
compdef _op op
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `op`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
typeset -g -A _comps
autoload -Uz _op
_comps[op]=_op
fi
op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
# Load opswd function
autoload -Uz opswd

View file

@ -27,7 +27,7 @@ function opswd() {
local password
# Copy the password to the clipboard
if ! password=$(op item get "$service" --fields password 2>/dev/null); then
if ! password=$(op item get "$service" --reveal --fields password 2>/dev/null); then
echo "error: could not obtain password for $service"
return 1
fi

View file

@ -1,8 +0,0 @@
# adb autocomplete plugin
* Adds autocomplete options for all adb commands.
* Add autocomplete for `adb -s`
## Requirements
In order to make this work, you will need to have the Android adb tools set up in your path.

View file

@ -1,67 +0,0 @@
#compdef adb
#autoload
# in order to make this work, you will need to have the android adb tools
# adb zsh completion, based on homebrew completion
local -a _1st_arguments
_1st_arguments=(
'bugreport:return all information from the device that should be included in a bug report.'
'connect:connect to a device via TCP/IP Port 5555 is default.'
'devices:list all connected devices'
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
'emu:run emulator console command'
'forward:forward socket connections'
'get-devpath:print the device path'
'get-serialno:print the serial number of the device'
'get-state:print the current state of the device: offline | bootloader | device'
'help:show the help message'
'install:push this package file to the device and install it'
'jdwp:list PIDs of processes hosting a JDWP transport'
'keygen:generate adb public/private key'
'kill-server:kill the server if it is running'
'logcat:view device log'
'pull:copy file/dir from device'
'push:copy file/dir to device'
'reboot:reboots the device, optionally into the bootloader or recovery program'
'reboot-bootloader:reboots the device into the bootloader'
'remount:remounts the partitions on the device read-write'
'root:restarts the adbd daemon with root permissions'
'sideload:push a ZIP to device and install it'
'shell:run remote shell interactively'
'sync:copy host->device only if changed (-l means list but dont copy)'
'start-server:ensure that there is a server running'
'tcpip:restart host adb in tcpip mode'
'uninstall:remove this app package from the device'
'usb:restart the adbd daemon listing on USB'
'version:show version num'
'wait-for-device:block until device is online'
)
local expl
local -a pkgs installed_pkgs
_arguments \
'-s[devices]:specify device:->specify_device' \
'*:: :->subcmds' && return 0
case "$state" in
specify_device)
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
{sub(/ +/," ",$0); \
gsub(":","\\:",$1); \
for(i=1;i<=NF;i++) {
if($i ~ /model:/) { split($i,m,":") } \
else if($i ~ /product:/) { split($i,p,":") } } \
printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
return
;;
esac
if (( CURRENT == 1 )); then
_describe -t commands "adb subcommand" _1st_arguments
return
fi
_files

View file

@ -1,13 +0,0 @@
# The Silver Searcher
This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
To use it, add ag to the plugins array in your zshrc file.
```zsh
plugins=(... ag)
```
## INSTALLATION NOTES
Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.

View file

@ -1,66 +0,0 @@
#compdef ag
#autoload
typeset -A opt_args
# Took the liberty of not listing every option… specially aliases and -D
_ag () {
local -a _1st_arguments
_1st_arguments=(
'--ackmate:Print results in AckMate-parseable format'
{'-A','--after'}':[LINES] Print lines after match (Default: 2)'
{'-B','--before'}':[LINES] Print lines before match (Default: 2)'
'--break:Print newlines between matches in different files'
'--nobreak:Do not print newlines between matches in different files'
{'-c','--count'}':Only print the number of matches in each file'
'--color:Print color codes in results (Default: On)'
'--nocolor:Do not print color codes in results'
'--color-line-number:Color codes for line numbers (Default: 1;33)'
'--color-match:Color codes for result match numbers (Default: 30;43)'
'--color-path:Color codes for path names (Default: 1;32)'
'--column:Print column numbers in results'
{'-H','--heading'}':Print file names (On unless searching a single file)'
'--noheading:Do not print file names (On unless searching a single file)'
'--line-numbers:Print line numbers even for streams'
{'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
'-g:[PATTERN] Print filenames matching PATTERN'
{'-l','--files-with-matches'}':Only print filenames that contain matches'
{'-L','--files-without-matches'}':Only print filenames that do not contain matches'
'--no-numbers:Do not print line numbers'
{'-o','--only-matching'}':Prints only the matching part of the lines'
'--print-long-lines:Print matches on very long lines (Default: 2k characters)'
'--passthrough:When searching a stream, print all lines even if they do not match'
'--silent:Suppress all log messages, including errors'
'--stats:Print stats (files scanned, time taken, etc.)'
'--vimgrep:Print results like vim :vimgrep /pattern/g would'
{'-0','--null'}':Separate filenames with null (for "xargs -0")'
{'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
'--depth:[NUM] Search up to NUM directories deep (Default: 25)'
{'-f','--follow'}':Follow symlinks'
{'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
'--hidden:Search hidden files (obeys .*ignore files)'
{'-i','--ignore-case'}':Match case insensitively'
'--ignore:[PATTERN] Ignore files/directories matching PATTERN'
{'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
{'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
{'-Q','--literal'}':Do not parse PATTERN as a regular expression'
{'-s','--case-sensitive'}':Match case'
{'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
'--search-binary:Search binary files for matches'
{'-t','--all-text'}':Search all text files (Hidden files not included)'
{'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
{'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
{'-v','--invert-match'}':Invert match'
{'-w','--word-regexp'}':Only match whole words'
{'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
'--list-file-types:list of supported file types'
)
if [[ $words[-1] =~ "^-" ]]; then
_describe -t commands "ag options" _1st_arguments && ret=0
else
_files && ret=0
fi
}

View file

@ -2,7 +2,7 @@
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
## Usage
## Setup
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
```
@ -22,6 +22,41 @@ zstyle ':omz:plugins:alias-finder' cheaper yes # disabled by default
As you can see, options are also available with zstyle.
## Usage
When you execute a command alias finder will look at your defined aliases and suggest shorter aliases you could have used, for example:
Running the un-aliased `git status` command:
```sh
╭─tim@fox ~/repo/gitopolis main
╰─$ git status
gst='git status' # <=== shorter suggestion from alias-finder
On branch main
Your branch is up-to-date with 'origin/main'.
nothing to commit, working tree clean
```
Running a shorter `git st` alias from `.gitconfig` that it suggested :
```sh
╭─tim@fox ~/repo/gitopolis main
╰─$ git st
gs='git st' # <=== shorter suggestion from alias-finder
## main...origin/main
```
Running the shortest `gs` shell alias that it found:
```sh
╭─tim@fox ~/repo/gitopolis main
╰─$ gs
# <=== no suggestions alias-finder because this is the shortest
## main...origin/main
```
![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b)
### Options
> In order to clarify, let's say `alias a=abc` has source 'abc' and destination 'a'.

View file

@ -36,14 +36,18 @@ alias-finder() {
# make filter to find only shorter results than current cmd
if [[ $cheaper == true ]]; then
cmdLen=$(echo -n "$cmd" | wc -c)
filter="^'{0,1}.{0,$((cmdLen - 1))}="
if [[ $cmdLen -le 1 ]]; then
return
fi
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
fi
alias | grep -E "$filter" | grep -E "=$finder"
if [[ $exact == true ]]; then
break # because exact case is only one
elif [[ $longer = true ]]; then
elif [[ $longer == true ]]; then
break # because above grep command already found every longer aliases during first cycle
fi

View file

@ -1,7 +1,5 @@
# Aliases cheatsheet
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
that are currently available based on the plugins you have enabled.
@ -13,6 +11,8 @@ plugins=(aliases)
Requirements: Python needs to be installed.
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
## Usage
- `als`: show all aliases by group

View file

@ -1,7 +1,5 @@
# ansible plugin
## Introduction
The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
To use it, add `ansible` to the plugins array of your zshrc file:
@ -21,7 +19,6 @@ plugins=(... ansible)
| `acon` | command `ansible-console` |
| `ainv` | command `ansible-inventory` |
| `aplaybook` | command `ansible-playbook` |
| `ainv` | command `ansible-inventory` |
| `adoc` | command `ansible-doc` |
| `agal` | command `ansible-galaxy` |
| `apull` | command `ansible-pull` |
@ -29,6 +26,6 @@ plugins=(... ansible)
## Maintainer
### [Deepankumar](https://github.com/deepan10)
### [Deepankumar](https://github.com/deepan10)
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)

View file

@ -178,26 +178,27 @@ fi
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
function upgrade() {
sudo pacman -Sy
echo ":: Checking Arch Linux PGP Keyring..."
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
if [ $installedver != $currentver ]; then
echo " Arch Linux PGP Keyring is out of date."
echo " Updating before full system upgrade."
sudo pacman -Sy --needed --noconfirm archlinux-keyring
sudo pacman -S --needed --noconfirm archlinux-keyring
else
echo " Arch Linux PGP Keyring is up to date."
echo " Proceeding with full system upgrade."
fi
if (( $+commands[yay] )); then
yay -Syu
yay -Su
elif (( $+commands[trizen] )); then
trizen -Syu
trizen -Su
elif (( $+commands[pacaur] )); then
pacaur -Syu
pacaur -Su
elif (( $+commands[aura] )); then
sudo aura -Syu
sudo aura -Su
else
sudo pacman -Syu
sudo pacman -Su
fi
}

View file

@ -0,0 +1,9 @@
# Arduino CLI plugin
This plugin adds completion for the [arduino-cli](https://github.com/arduino/arduino-cli) tool.
To use it, add `arduino-cli` to the plugins array in your zshrc file:
```zsh
plugins=(... arduino-cli)
```

View file

@ -0,0 +1,14 @@
if (( ! $+commands[arduino-cli] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `arduino-cli`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_arduino-cli" ]]; then
typeset -g -A _comps
autoload -Uz _arduino-cli
_comps[arduino-cli]=_arduino-cli
fi
# Generate and load arduino-cli completion
arduino-cli completion zsh >! "$ZSH_CACHE_DIR/completions/_arduino-cli" &|

View file

@ -1,30 +1,48 @@
## asdf
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
# asdf
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
### Installation
## Installation
1. [Download asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) by running the following:
```
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
```
2. [Enable asdf](https://asdf-vm.com/guide/getting-started.html#_3-install-asdf) by adding it to your `plugins` definition in `~/.zshrc`.
```
plugins=(asdf)
```
### Usage
See the [asdf documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to use asdf:
1. [Install](https://asdf-vm.com/guide/getting-started.html#_1-install-asdf) asdf and ensure that's it's discoverable on `$PATH`;
2. Enable it by adding it to your `plugins` definition in `~/.zshrc`:
```sh
plugins=(asdf)
```
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
## Usage
Refer to the [asdf plugin documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to add a plugin and install the many runtime versions for it.
Example for installing the nodejs plugin and the many runtimes for it:
```sh
# Add plugin to asdf
asdf plugin add nodejs
# Install the latest available version
asdf install nodejs latest
asdf global nodejs latest
asdf local nodejs latest
# Uninstall the latest version
asdf uninstall nodejs latest
# Install a specific version
asdf install nodejs 16.5.0
# Set the latest version in .tool-versions of the `current directory`
asdf set nodejs latest
# Set a specific version in the `parent directory`
asdf set -p nodejs 16.5.0 # -p is shorthand for --parent
# Set a global version under `$HOME`
asdf set -u nodejs 16.5.0 # -u is shorthand for --home
```
For more commands, run `asdf help` or refer to the
[asdf CLI documentation](https://asdf-vm.com/manage/commands.html#all-commands).
## Maintainer
- [@RobLoach](https://github.com/RobLoach)

View file

@ -1,30 +1,13 @@
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
(( ! $+commands[asdf] )) && return
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
ASDF_DIR="/opt/asdf-vm"
ASDF_COMPLETIONS="$ASDF_DIR"
# If not found, check for Homebrew package
elif (( $+commands[brew] )); then
_ASDF_PREFIX="$(brew --prefix asdf)"
ASDF_DIR="${_ASDF_PREFIX}/libexec"
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
unset _ASDF_PREFIX
else
return
fi
fi
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
path=("$ASDF_DATA_DIR/shims" $path)
# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
source "$ASDF_DIR/asdf.sh"
# Load completions
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
fpath+=("$ASDF_COMPLETIONS")
autoload -Uz _asdf
compdef _asdf asdf # compdef is already loaded before loading plugins
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `asdf`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
typeset -g -A _comps
autoload -Uz _asdf
_comps[asdf]=_asdf
fi
asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|

View file

@ -1,18 +1,22 @@
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
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
$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
/etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
$PREFIX/share/autojump/autojump.zsh # Termux package
/etc/profile.d/autojump.zsh # manual installation
/etc/profile.d/autojump.sh # Gentoo installation
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
/nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
)
for file in $autojump_paths; do

View file

@ -47,6 +47,11 @@ plugins=(... aws)
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
see the AWS profile/region prompt.
* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
This option might slow down your shell startup time.
By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
You can control the state file path using the `AWS_STATE_FILE` environment variable.
## Theme
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays

View file

@ -6,10 +6,26 @@ function agr() {
echo $AWS_REGION
}
# Update state file if enabled
function _aws_update_state() {
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
fi
}
function _aws_clear_state() {
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
echo -n > "${AWS_STATE_FILE}"
fi
}
# AWS profile selection
function asp() {
if [[ -z "$1" ]]; then
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
_aws_clear_state
echo AWS profile cleared.
return
fi
@ -28,6 +44,8 @@ function asp() {
export AWS_PROFILE_REGION=$(aws configure get region)
_aws_update_state
if [[ "$2" == "login" ]]; then
if [[ -n "$3" ]]; then
aws sso login --sso-session $3
@ -43,6 +61,7 @@ function asp() {
function asr() {
if [[ -z "$1" ]]; then
unset AWS_DEFAULT_REGION AWS_REGION
_aws_update_state
echo AWS region cleared.
return
fi
@ -56,6 +75,7 @@ function asr() {
export AWS_REGION=$1
export AWS_DEFAULT_REGION=$1
_aws_update_state
}
# AWS profile switch
@ -202,8 +222,17 @@ function aws_change_access_key() {
}
function aws_regions() {
local region
if [[ $AWS_DEFAULT_REGION ]];then
region="$AWS_DEFAULT_REGION"
elif [[ $AWS_REGION ]];then
region="$AWS_REGION"
else
region="us-west-1"
fi
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
else
echo "You must specify a AWS profile."
fi
@ -246,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
fi
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
test -s "${AWS_STATE_FILE}" || return
aws_state=($(cat $AWS_STATE_FILE))
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
export AWS_DEFAULT_REGION="$AWS_REGION"
fi
# Load awscli completions
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back

View file

@ -12,6 +12,13 @@ Then, add the `battery_pct_prompt` function to your custom theme. For example:
RPROMPT='$(battery_pct_prompt) ...'
```
Also, you set the `BATTERY_CHARGING` variable to your favor.
For example:
```zsh
BATTERY_CHARGING="⚡️"
```
## Requirements
- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.

View file

@ -58,7 +58,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
fi
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
else
echo ""
echo "${BATTERY_CHARGING-⚡️}"
fi
}

View file

@ -1,7 +1,7 @@
# Bazel plugin
This plugin adds completion for [bazel](https://bazel.build), an open-source build and
test tool that scalably supports multi-language and multi-platform projects.
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool
that scalably supports multi-language and multi-platform projects.
To use it, add `bazel` to the plugins array in your zshrc file:
@ -12,3 +12,18 @@ plugins=(... bazel)
The plugin has a copy of [the completion script from the git repository][1].
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
## Aliases
| Alias | Command | Description |
| ----- | ------------- | ------------------------- |
| bzb | `bazel build` | The `bazel build` command |
| bzt | `bazel test` | The `bazel test` command |
| bzr | `bazel run` | The `bazel run` command |
| bzq | `bazel query` | The `bazel query` command |
## Functions
| Function | Description |
| -------- | -------------------------------- |
| sri-hash | Generate SRI hash used by bzlmod |

View file

@ -0,0 +1,9 @@
# Aliases for bazel
alias bzb='bazel build'
alias bzt='bazel test'
alias bzr='bazel run'
alias bzq='bazel query'
sri-hash() {
openssl dgst -sha256 -binary $1 | openssl base64 -A | sed 's/^/sha256-/'
}

View file

@ -47,7 +47,7 @@ case $state in
"random[Generate random intervals in a genome.]" \
"reldist[Calculate the distribution of relative distances b/w two files.]" \
"sample[Sample random records from file using reservoir sampling.]" \
"shuffle[Randomly redistrubute intervals in a genome.]" \
"shuffle[Randomly redistribute intervals in a genome.]" \
"slop[Adjust the size of intervals.]" \
"sort[Order the intervals in a file.]" \
"subtract[Remove intervals based on overlaps b/w two files.]" \

View file

@ -38,6 +38,7 @@ One can configure a few things:
- `bgnotify_bell` enabled or disables the terminal bell (default true)
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
Use these by adding a function definition before the your call to source. Example:

View file

@ -62,7 +62,7 @@ function bgnotify_formatted {
function bgnotify_appid {
if (( ${+commands[osascript]} )); then
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
local app_id=$(bgnotify_find_sway_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
@ -117,15 +117,15 @@ function bgnotify {
local icon="$3"
if (( ${+commands[terminal-notifier]} )); then # macOS
local term_id=$(bgnotify_programid)
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
elif (( ${+commands[growlnotify]} )); then # macOS growl
growlnotify -m "$title" "$message"
growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
elif (( ${+commands[notify-send]} )); then
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
elif (( ${+commands[kdialog]} )); then # KDE
kdialog --title "$title" --passivepopup "$message" 5
kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
elif (( ${+commands[notifu]} )); then # cygwin
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
fi
}

View file

@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
```

View file

@ -8,7 +8,7 @@ function branch_prompt_info() {
while [[ "$dir" != '/' ]]; do
# Found .git directory
if [[ -d "${dir}/.git" ]]; then
branch="${"$(<"${dir}/.git/HEAD")"##*/}"
branch="${"$(<"${dir}/.git/HEAD")"##ref: refs/heads/}"
echo '±' "${branch:gs/%/%%}"
return
fi

View file

@ -19,19 +19,38 @@ the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environmen
## Aliases
| Alias | Command | Description |
| -------- | --------------------------------------- | ------------------------------------------------------------------- |
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bubu` | `bubo && bubc` | Do the last two operations above. |
| `bfu` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
| Alias | Command | Description |
| -------- | --------------------------------------- | --------------------------------------------------------------------- |
| `ba` | `brew autoremove` | Uninstall unnecessary formulae. |
| `bci` | `brew info --cask` | Display information about the given cask. |
| `bcin` | `brew install --cask` | Install the given cask. |
| `bcl` | `brew list --cask` | List installed casks. |
| `bcn` | `brew cleanup` | Run cleanup. |
| `bco` | `brew outdated --cask` | Report all outdated casks. |
| `bcrin` | `brew reinstall --cask` | Reinstall the given cask. |
| `bcubc` | `brew upgrade --cask && brew cleanup` | Upgrade outdated casks, then run cleanup. |
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
| `bcup` | `brew upgrade --cask` | Upgrade all outdated casks. |
| `bfu` | `brew upgrade --formula` | Upgrade only formulae (not casks). |
| `bi` | `brew install` | Install a formula. |
| `bl` | `brew list` | List all installed formulae. |
| `bo` | `brew outdated` | List installed formulae that have an updated version available. |
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
| `bsl` | `brew services list` | List all running services. |
| `bsoff` | `brew services stop` | Stop the service and unregister it from launching at login (or boot). |
| `bsoffa` | `bsoff --all` | Stop all started services. |
| `bson` | `brew services start` | Start the service and register it to launch at login (or boot). |
| `bsona` | `bson --all` | Start all stopped services. |
| `bsr` | `brew services run` | Run the service without registering to launch at login (or boot). |
| `bsra` | `bsr --all` | Run all stopped services. |
| `bu` | `brew update` | Update brew and all installed formulae. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bubu` | `bubo && bup` | Do the last two operations above. |
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
## Completion

View file

@ -24,7 +24,7 @@ if (( ! $+commands[brew] )); then
fi
if [[ -z "$HOMEBREW_PREFIX" ]]; then
# Maintain compatability with potential custom user profiles, where we had
# Maintain compatibility with potential custom user profiles, where we had
# previously relied on always sourcing shellenv. OMZ plugins should not rely
# on this to be defined due to out of order processing.
export HOMEBREW_PREFIX="$(brew --prefix)"
@ -34,17 +34,35 @@ if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
fi
alias ba='brew autoremove'
alias bci='brew info --cask'
alias bcin='brew install --cask'
alias bcl='brew list --cask'
alias bcn='brew cleanup'
alias bco='brew outdated --cask'
alias bcrin='brew reinstall --cask'
alias bcubc='brew upgrade --cask && brew cleanup'
alias bcubo='brew update && brew outdated --cask'
alias bcubc='brew upgrade --cask && brew cleanup'
alias bcup='brew upgrade --cask'
alias bfu='brew upgrade --formula'
alias bi='brew install'
alias bl='brew list'
alias bo='brew outdated'
alias brewp='brew pin'
alias brewsp='brew list --pinned'
alias bubc='brew upgrade && brew cleanup'
alias bugbc='brew upgrade --greedy && brew cleanup'
alias bsl='brew services list'
alias bsoff='brew services stop'
alias bsoffa='bsoff --all'
alias bson='brew services start'
alias bsona='bson --all'
alias bsr='brew services run'
alias bsra='bsr --all'
alias bu='brew update'
alias bubo='brew update && brew outdated'
alias bubu='bubo && bubc'
alias bubu='bubo && bup'
alias bubug='bubo && bugbc'
alias bfu='brew upgrade --formula'
alias bugbc='brew upgrade --greedy && brew cleanup'
alias bup='brew upgrade'
alias buz='brew uninstall --zap'
function brews() {

9
plugins/buf/README.md Normal file
View file

@ -0,0 +1,9 @@
# Buf plugin
This plugin adds completion for [Buf CLI](https://github.com/bufbuild/buf), a tool working with Protocol Buffers.
To use it, add `buf` to the plugins array in your zshrc file:
```zsh
plugins=(... buf)
```

View file

@ -0,0 +1,14 @@
# Autocompletion for the Buf CLI (buf).
if (( !$+commands[buf] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `buf`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
typeset -g -A _comps
autoload -Uz _buf
_comps[buf]=_buf
fi
# Generate and load buf completion
buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|

View file

@ -11,4 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
_comps[bun]=_bun
fi
bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
SHELL=zsh bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|

View file

@ -1,4 +1,4 @@
#compdef bundle
#compdef bundle bundler
local curcontext="$curcontext" state line _gems _opts ret=1

View file

@ -1,6 +1,7 @@
# catimg
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
Plugin for displaying images on the terminal using the `catimg.sh` script provided by
[posva](https://github.com/posva/catimg)
To use it, add `catimg` to the plugins array in your zshrc file:
@ -10,7 +11,7 @@ plugins=(... catimg)
## Requirements
- `convert` (ImageMagick)
- `magick convert` (ImageMagick)
## Functions

View file

@ -9,9 +9,11 @@
function catimg() {
if [[ -x `which convert` ]]; then
zsh $ZSH/plugins/catimg/catimg.sh $@
if (( $+commands[magick] )); then
CONVERT_CMD="magick" zsh $ZSH/plugins/catimg/catimg.sh $@
elif (( $+commands[convert] )); then
CONVERT_CMD="convert" zsh $ZSH/plugins/catimg/catimg.sh $@
else
echo "catimg need convert (ImageMagick) to work)"
echo "catimg need magick/convert (ImageMagick) to work)"
fi
}

View file

@ -7,6 +7,10 @@
# GitHub: https://github.com/posva/catimg #
################################################################################
# this should come from outside, either `magick` or `convert`
# from imagemagick v7 and ahead `convert` is deprecated
: ${CONVERT_CMD:=convert}
function help() {
echo "Usage catimg [-h] [-w width] [-c char] img"
echo "By default char is \" \" and w is the terminal width"
@ -43,23 +47,23 @@ if [ ! "$WIDTH" ]; then
else
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
fi
WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
WIDTH=$($CONVERT_CMD "$IMG" -print "%w\n" /dev/null)
if [ "$WIDTH" -gt "$COLS" ]; then
WIDTH=$COLS
fi
REMAP=""
if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
if $CONVERT_CMD "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
REMAP="-remap $COLOR_FILE"
else
echo "The version of convert is too old, don't expect good results :(" >&2
#convert "$IMG" -colors 256 PNG8:tmp.png
#IMG="tmp.png"
# $CONVERT_CMD "$IMG" -colors 256 PNG8:tmp.png
# IMG="tmp.png"
fi
# Display the image
I=0
convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
$CONVERT_CMD "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
while read R G B f; do
if [ ! "$R" = "NO" ]; then

11
plugins/chezmoi/README.md Normal file
View file

@ -0,0 +1,11 @@
# chezmoi Plugin
## Introduction
This `chezmoi` plugin sets up completion for [chezmoi](https://chezmoi.io).
To use it, add `chezmoi` to the plugins array of your zshrc file:
```bash
plugins=(... chezmoi)
```

View file

@ -0,0 +1,14 @@
# COMPLETION FUNCTION
if (( ! $+commands[chezmoi] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `chezmoi`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
typeset -g -A _comps
autoload -Uz _chezmoi
_comps[chezmoi]=_chezmoi
fi
chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|

View file

@ -2,7 +2,7 @@
_source-from-omz-settings() {
local _chruby_path _chruby_auto
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
@ -22,8 +22,10 @@ _source-from-homebrew() {
# check default brew prefix
if [[ -h /usr/local/opt/chruby ]];then
_brew_prefix="/usr/local/opt/chruby"
elif [[ -h /opt/homebrew/opt/chruby ]]; then
_brew_prefix="/opt/homebrew/opt/chruby"
else
# ok , it is not default prefix
# ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi

View file

@ -1,6 +1,6 @@
# chucknorris
Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD.
Fortunes plugin for Chuck Norris for Oh My Zsh. Perfectly suitable as MOTD.
To use it add `chucknorris` to the plugins array in you zshrc file.
@ -36,3 +36,10 @@ Last login: Fri Jan 30 23:12:26 on ttys001
- `cowsay` if using `chuck_cow`
Available via homebrew, apt, ...
> [!NOTE]
> In addition to installing `fortune`, it may be necessary to run:
>
> `strfile $ZSH/plugins/chucknorris/fortunes/chucknorris\n`
>
> (include the "\n" literally) to write the fortune data to the proper directory.

View file

@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
## Contributors
Contributed to `oh_my_zsh` by [benwilcock][2].
Contributed to `oh_my_zsh` by [benwilcock][2].
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
[2]: https://github.com/benwilcock

View file

@ -24,7 +24,7 @@ Also provides the following aliases:
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
to run the code in a JS console.
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
to compile large/multi-line snippets
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the

View file

@ -42,12 +42,12 @@ colorize_cat() {
ZSH_COLORIZE_STYLE="emacs"
fi
# Use stdin if no arguments have been passed.
if [ $# -eq 0 ]; then
# Use stdin if stdin is not attached to a terminal.
if [ ! -t 0 ]; then
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@"
fi
return $?
fi

View file

@ -30,5 +30,6 @@ It works out of the box with the command-not-found packages for:
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
- [Termux](https://github.com/termux/command-not-found)
- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)
- [Gentoo](https://github.com/AndrewAmmerlaan/command-not-found-gentoo/tree/main)
You can add support for other platforms by submitting a Pull Request.

View file

@ -7,7 +7,7 @@
if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}"
local setup="${prefix}/share/compleat-1.0/compleat_setup"
local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then
@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
bashcompinit -i
fi
source "$setup"
source "$setup"
fi
fi

View file

@ -0,0 +1,44 @@
# conda-env
The plugin displays information of the created virtual container of conda and allows background theming.
To use it, add `conda-env` to the plugins array of your zshrc file:
```
plugins=(... conda-env)
```
The plugin creates a `conda_prompt_info` function that you can use in your theme, which displays the
basename of the current `$CONDA_DEFAULT_ENV`.
You can use this prompt function in your themes, by adding it to the `PROMPT` or `RPROMPT` variables. See [Example](#example) for more information.
## Settings
It uses two variables to control how the information is shown:
- `ZSH_THEME_CONDA_PREFIX`: sets the prefix of the CONDA_DEFAULT_ENV.
Defaults to `[`.
- `ZSH_THEME_CONDA_SUFFIX`: sets the suffix of the CONDA_DEFAULT_ENV.
Defaults to `]`.
## Example
```sh
ZSH_THEME_CONDA_PREFIX='conda:%F{green}'
ZSH_THEME_CONDA_SUFFIX='%f'
RPROMPT='$(conda_prompt_info)'
```
## `CONDA_CHANGEPS1`
This plugin also automatically sets the `CONDA_CHANGEPS1` variable to `false` to avoid conda changing the prompt
automatically. This has the same effect as running `conda config --set changeps1 false`.
You can override this behavior by adding `unset CONDA_CHANGEPS1` in your `.zshrc` file, after Oh My Zsh has been
sourced.
References:
- https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
- https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence

View file

@ -0,0 +1,9 @@
function conda_prompt_info(){
[[ -n ${CONDA_DEFAULT_ENV} ]] || return
echo "${ZSH_THEME_CONDA_PREFIX=[}${CONDA_DEFAULT_ENV:t:gs/%/%%}${ZSH_THEME_CONDA_SUFFIX=]}"
}
# Has the same effect as `conda config --set changeps1 false`
# - https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
# - https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence
export CONDA_CHANGEPS1=false

37
plugins/conda/README.md Normal file
View file

@ -0,0 +1,37 @@
# conda plugin
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
To use it, add `conda` to the plugins array in your zshrc file:
```zsh
plugins=(... conda)
```
## Aliases
| Alias | Command | Description |
| :------- | :-------------------------------------- | :------------------------------------------------------------------------------ |
| `cna` | `conda activate` | Activate the specified conda environment |
| `cnab` | `conda activate base` | Activate the base conda environment |
| `cncf` | `conda env create -f` | Create a new conda environment from a YAML file |
| `cncn` | `conda create -y -n` | Create a new conda environment with the given name |
| `cnconf` | `conda config` | View or modify conda configuration |
| `cncp` | `conda create -y -p` | Create a new conda environment with the given prefix |
| `cncr` | `conda create -n` | Create new virtual environment with given name |
| `cncss` | `conda config --show-source` | Show the locations of conda configuration sources |
| `cnde` | `conda deactivate` | Deactivate the current conda environment |
| `cnel` | `conda env list` | List all available conda environments |
| `cni` | `conda install` | Install given package |
| `cniy` | `conda install -y` | Install given package without confirmation |
| `cnl` | `conda list` | List installed packages in the current environment |
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
| `cnr` | `conda remove` | Remove given package |
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
| `cnry` | `conda remove -y` | Remove given package without confirmation |
| `cnsr` | `conda search` | Search conda repositories for package |
| `cnu` | `conda update` | Update conda package manager |
| `cnua` | `conda update --all` | Update all installed packages |
| `cnuc` | `conda update conda` | Update conda package manager |

View file

@ -0,0 +1,23 @@
alias cna='conda activate'
alias cnab='conda activate base'
alias cncf='conda env create -f'
alias cncn='conda create -y -n'
alias cnconf='conda config'
alias cncp='conda create -y -p'
alias cncr='conda create -n'
alias cncss='conda config --show-source'
alias cnde='conda deactivate'
alias cnel='conda env list'
alias cni='conda install'
alias cniy='conda install -y'
alias cnl='conda list'
alias cnle='conda list --export'
alias cnles='conda list --explicit > spec-file.txt'
alias cnr='conda remove'
alias cnrn='conda remove -y --all -n'
alias cnrp='conda remove -y --all -p'
alias cnry='conda remove -y'
alias cnsr='conda search'
alias cnu='conda update'
alias cnua='conda update --all'
alias cnuc='conda update conda'

View file

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

View file

@ -19,7 +19,7 @@ dash
- Query for something in dash app: `dash query`
```
dash golang
dash golang
```
- You can optionally provide a keyword: `dash [keyword:]query`

View file

@ -1,5 +1,5 @@
# Usage: dash [keyword:]query
dash() { open -a Dash.app dash://"$*" }
dash() { open -a Dash.app "dash://$(omz_urlencode -r $*)" }
compdef _dash dash
_dash() {

View file

@ -1,13 +1,11 @@
# dbt plugin
## Introduction
The `dbt plugin` adds several aliases for useful [dbt](https://docs.getdbt.com/) commands and
[aliases](#aliases).
To use it, add `dbt` to the plugins array of your zshrc file:
```
```zsh
plugins=(... dbt)
```
@ -26,4 +24,4 @@ plugins=(... dbt)
## Maintainer
### [msempere](https://github.com/msempere)
- [msempere](https://github.com/msempere)

View file

@ -83,9 +83,9 @@ else
}
alias ac="su -ls '$apt_pref clean' root"
alias ad="su -lc '$apt_pref update' root"
alias adg="su -lc '$apt_pref update && aptitude $apt_upgr' root"
alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
alias afu="su -lc '$apt-file update'"
alias adg="su -lc '$apt_pref update && $apt_pref $apt_upgr' root"
alias adu="su -lc '$apt_pref update && $apt_pref dist-upgrade' root"
alias afu="su -lc 'apt-file update'"
alias au="su -lc '$apt_pref $apt_upgr' root"
function ai() {
cmd="su -lc '$apt_pref install $@' root"

View file

@ -37,13 +37,13 @@ Say you opened these directories on the terminal:
3 ~
```
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$PWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$PWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
Here's a example history table with the same accessed directories like above:
| Current `$CWD` | Key press | New `$CWD` |
| Current `$PWD` | Key press | New `$PWD` |
| --------------- | ----------------------------------------------------- | --------------- |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
@ -53,7 +53,7 @@ Here's a example history table with the same accessed directories like above:
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$PWD`, it will change back to the first known `$PWD`, which in the example is `~`.
Here's an asciinema cast demonstrating the example above:
@ -61,18 +61,22 @@ Here's an asciinema cast demonstrating the example above:
## Functions
| Function | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
| Function | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `insert-cycledleft` | Change `$PWD` to the previous known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
| `insert-cycledright` | Change `$PWD` to the next known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
| `insert-cycledup` | Change `$PWD` to the parent folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Up</kbd> |
| `insert-cycleddown` | Change `$PWD` to the first alphabetical child folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Down</kbd> |
## Rebinding keys
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>key</kbd> in `xterm-256color`:
```zsh
bindkey '^[[1;4D' insert-cycledleft
bindkey '^[[1;4C' insert-cycledright
bindkey "\e[1;4A" insert-cycledup
bindkey "\e[1;4B" insert-cycleddown
```
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.

View file

@ -8,7 +8,16 @@
# pushd +N: start counting from left of `dirs' output
# pushd -N: start counting from right of `dirs' output
# Either switch to a directory from dirstack, using +N or -N syntax
# or switch to a directory by path, using `switch-to-dir -- <path>`
switch-to-dir () {
# If $1 is --, then treat $2 as a directory path
if [[ $1 == -- ]]; then
# We use `-q` because we don't want chpwd to run, we'll do it manually
[[ -d "$2" ]] && builtin pushd -q "$2" &>/dev/null
return $?
fi
setopt localoptions nopushdminus
[[ ${#dirstack} -eq 0 ]] && return 1
@ -22,10 +31,10 @@ switch-to-dir () {
}
insert-cycledleft () {
switch-to-dir +1 || return
switch-to-dir +1 || return $?
local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
@ -33,22 +42,46 @@ insert-cycledleft () {
zle -N insert-cycledleft
insert-cycledright () {
switch-to-dir -0 || return
switch-to-dir -0 || return $?
local fn
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycledright
insert-cycledup () {
switch-to-dir -- .. || return $?
local fn
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycledup
insert-cycleddown () {
switch-to-dir -- "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return $?
local fn
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycleddown
# These sequences work for xterm, Apple Terminal.app, and probably others.
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
# from plain Shift-Arrow, at least by default.
#
# iTerm2 does not have these key combinations defined by default; you will need
# to add them under "Keys" in your profile if you want to use this. You can do
# this conveniently by loading the "xterm with Numeric Keypad" preset.
bindkey "\e[1;6D" insert-cycledleft
bindkey "\e[1;6C" insert-cycledright
bindkey "\e[1;6D" insert-cycledleft # Ctrl+Shift+Left
bindkey "\e[1;6C" insert-cycledright # Ctrl+Shift+Right
bindkey "\e[1;6A" insert-cycledup # Ctrl+Shift+Up
bindkey "\e[1;6B" insert-cycleddown # Ctrl+Shift+Down

View file

@ -1,5 +1,8 @@
# Don't continue if direnv is not found
command -v direnv &>/dev/null || return
# If direnv is not found, don't continue and print a warning
if (( ! $+commands[direnv] )); then
echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin."
return
fi
_direnv_hook() {
trap -- '' SIGINT;

View file

@ -60,3 +60,46 @@ to `/usr` again.
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
you to the root folder (`/`).
### cde
This plugin also provides a `cde` alias that allows you to change to a directory without clearing the next directory stack.
This changes the default behavior of `dirhistory`, which is to clear the next directory stack when changing directories.
For example, if the shell was started, and the following commands were entered:
```shell
cd ~
cd /usr
cd share
cd doc
# <Alt + Left>
# <Alt + Left>
```
The directory stack would look like this:
```sh
➜ /usr typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr )
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
```
This means that pressing <kbd>Alt</kbd> + <kbd>Right</kbd>, you'd go to `/usr/share` and `/usr/share/doc` (the "future" directories).
If you run `cd /usr/bin`, the "future" directories will be removed, and you won't be able to access them with <kbd>Alt</kbd> + <kbd>Right</kbd>:
```sh
➜ /u/bin typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr )
typeset -ax dirhistory_future=( /usr/bin )
```
If you instead run `cde /usr/bin`, the "future" directories will be preserved:
```sh
➜ /u/bin typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr /usr/bin )
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
```

View file

@ -11,9 +11,10 @@ dirhistory_past=($PWD)
dirhistory_future=()
export dirhistory_past
export dirhistory_future
export DIRHISTORY_SIZE=30
alias cde='dirhistory_cd'
# Pop the last element of dirhistory_past.
# Pass the name of the variable to return the result in.
# Returns the element if the array was not empty,
@ -136,7 +137,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # ghostty
iTerm.app)
bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
;;
esac
if (( ${+terminfo[kcub1]} )); then
@ -151,7 +156,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # ghostty
iTerm.app)
bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
;;
esac
if (( ${+terminfo[kcuf1]} )); then
@ -200,6 +209,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
ghostty) bindkey -M $keymap "^[[1;3A" dirhistory_zle_dirhistory_up ;; # ghostty
esac
if (( ${+terminfo[kcuu1]} )); then
@ -215,6 +225,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
ghostty) bindkey -M $keymap "^[[1;3B" dirhistory_zle_dirhistory_down ;; # ghostty
esac
if (( ${+terminfo[kcud1]} )); then

570
plugins/dnf/_dnf5 Normal file
View file

@ -0,0 +1,570 @@
#compdef dnf5
# based on dnf-5.2.6.2
# utility functions
_dnf5_helper() {
_call_program specs $service "${(q-)@}" "${(q-)PREFIX}\*" \
-qC --assumeno --nogpgcheck 2>/dev/null </dev/null
}
_dnf5_repositories() {
# required option: -T (all|disabled|enabled)
local selected expl
zparseopts -D -E - T:=selected
selected=$selected[2]
_wanted $selected-repositories expl "$selected repository" \
compadd "$@" - "${(@)${(f)$(_dnf5_helper repo list --$selected)}[2,-1]%% *}"
}
_dnf5_packages() {
# required option: -T (all|available|installed|upgradable)
local selected opt expl
zparseopts -D -E - T:=selected
selected=$selected[2]
case $selected in
all) opt='' ;; # option --all does not exist
upgradable) opt='--upgrades' ;;
*) opt="--$selected" ;;
esac
_wanted $selected-packages expl "$selected package" \
compadd "$@" - $(_dnf5_helper repoquery $opt --qf='%{name} ')
}
_dnf5_rpm_files() {
local expl
_wanted rpm-files expl 'rpm file' _files -g '(#i)*.rpm(-.)'
}
_dnf5_packages_or_rpms() {
if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
_dnf5_rpm_files
else
_dnf5_packages "$@"
fi
}
_dnf5_groups() {
# optional option: -T (available|installed)
local update_policy selected line pat groups
zparseopts -D -E - T:=selected
selected=$selected[2]
if [[ -z $selected ]]; then
selected=all
opt= # option --all does not exist
else
opt=--$selected
fi
# XXX hidden groups are not included
for line in ${${(f)"$(_dnf5_helper group list $opt)"}[2,-1]}; do
line=( ${(z)line} )
groups+=( "$line[1]:$line[2,-2]" )
done
_describe -t $selected-groups "$selected group" groups
}
_dnf5_environments() {
local line envs
for line in ${${(f)"$(_dnf5_helper environment list)"}[2,-1]}; do
line=( ${(z)line} )
envs+=( "$line[1]:$line[2,-2]" )
done
_describe -t environments 'environment' envs
}
# completers for (several) dnf commands
_dnf5-advisory () {
_arguments : \
$advisory_opts \
'--contains-pkgs=[only show advisories containing specified packages]: : _sequence _dnf5_packages -T installed' \
+ '(with)' \
'--with-cve[show only advisories referencing CVE ticket]' \
'--with-bz[show only advisories referencing Bugzilla ticket]' \
+ '(type)' \
'--all[show all advisories]' \
'--available[show advisories containing newer versions of installed packages (default)]' \
'--installed[show advisories containing equal and older version of installed packages]' \
'--updates[show advisories containing upgradable packages]' \
+ args \
':subcommand:(list info summary)' '*:advisory spec:'
}
_dnf5-group() {
local -a tmp
if (( CURRENT == 2 )); then
tmp=(
'list:list all matching groups'
'info:print detailed information about groups'
'install:install packages from specified groups'
'remove:remove removable packages in specified groups'
'upgrade:upgrade specified groups and packages in them'
)
_describe -t subcommands 'subcommand' tmp
else
case $words[2] in
list|info)
tmp=(
'(--installed)--available[show only available groups]'
'(--available)--installed[show only installed groups]'
'--hidden[show also hidden groups]'
'--contains-pkgs=[show only groups containing specified packages]: : _sequence _dnf5_packages -T all'
'*: : _dnf5_groups'
)
;;
install)
tmp=( $common_opts
'--with-optional[include optional packages from the groups]'
'*: : _dnf5_groups -T available' )
;|
upgrade)
tmp=( ${common_opts:#--skip-broken*}
'*: : _dnf5_groups -T installed' )
;|
remove)
tmp=( $offline_opts
'*: : _dnf5_groups -T installed' )
;|
install|remove)
tmp+=( '--no-packages[operate on groups only, not manipulate any packages]' )
;|
install|upgrade)
tmp+=( $downgrade_opts )
;;
esac
_arguments : $tmp
fi
}
_dnf5-history() {
local -a tmp
if (( CURRENT == 2 )); then
tmp=(
'list:list info about recorded transactions'
'info:print detailed about specific transactions'
'undo:revert all actions from the specified transaction'
'redo:repeat the specified transaction'
'rollback:undo all transactions performed after the specified transaction'
'store:store the transaction into a directory'
)
_describe -t subcommands 'subcommand' tmp
else
case $words[2] in
list|info)
tmp=( '--reverse[reverse the order of transactions in output]' )
;;
undo|rollback|redo)
tmp=( '--skip-unavailable[allow skipping impossible actions]' )
;|
undo|rollback)
tmp+=( $replay_opts )
;;
store)
tmp=( {-o,--output=}'[directory for storing the transaction (default ./transaction)]: : _directories')
esac
_arguments : $tmp '2:transaction:( )'
fi
}
_dnf5-mark() {
local -a tmp
if (( CURRENT == 2 )); then
tmp=(
'user:mark the package as user-installed'
'dependency:mark the package as a dependency'
'weak:mark the package as a weak dependency'
'group:mark the package as installed by the specified group'
)
_describe -t subcommands 'subcommand' tmp
else
tmp=(
'--skip-unavailable[skip packages not installed on the system]'
'--store=[store the transaction in specified directory]: : _directories'
)
if [[ $words[2] = group ]]; then
tmp+=( '2:group-id: _dnf5_groups -T installed' )
fi
_arguments : $tmp '*: : _dnf5_packages -T installed'
fi
}
_dnf5-module() {
local -a tmp
if (( CURRENT == 2 )); then
tmp=(
'list:list module streams'
'info:print details about module streams'
'enable:enable module streams'
'disable:disable modules including all their streams'
"reset:reset module state so it's no longer enabled or disabled"
)
_describe -t subcommands 'subcommand' tmp
elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then
case $words[2] in
list|info) tmp=( --enabled --disabled ) ;;
enable) tmp=( --skip-broken --skip-unavailable ) ;;
*) tmp=( --skip-unavailable ) ;;
esac
_wanted options expl 'option' compadd -a tmp
else
_message 'module spec'
fi
}
_dnf5-offline() { # also used by the 'system-upgrade' command
local -a tmp
if (( CURRENT == 2 )); then
tmp=(
'clean:remove any stored offline transactions and cached packages'
'log:list boots during which offline transaction was attempted'
'reboot:prepare the system for offline transaction and reboot'
)
if [[ $cmd = offline ]]; then
tmp+=( 'status:show status of the current offline transaction' )
else
tmp+=( 'download:download all packages needed for upgrade' )
fi
_describe -t subcommands 'subcommand' tmp && ret=0
else
case $words[2] in
download)
_arguments : \
'--releasever=[the version to upgrade to]:version number:' \
'--no-downgrade:do not install packages older than currently installed' '*: :' && ret=0
;;
log)
_arguments : \
'--number=[show log of transaction specified by number]:transaction number:' '*: :' && ret=0
;;
reboot)
_wanted options expl 'option' compadd -- --poweroff && ret=0
;;
esac
fi
}
_dnf5-repoquery() {
local v
local -a opts=(
$advisory_opts
'--arch=[limit results to specified architectures]:list of archs: '
'--available[limit results to available packages]'
'--disable-modular-filtering[include packages of inactive module streams]'
'--duplicates[limit to installed duplicate packages]'
'--exactdeps[limit to packages that require capability specified by ==what{requires,depends}]'
'--extras[limit to installed packages that are not present in any available repository]'
'--file=[limit results to packages which own specified file]:list of files: _sequence _files'
'--installed[query installed packages]'
'--installonly[limit to installed installonly packages]'
'--latest-limit=[limit to latest packages of specified number]:number:'
'--leaves[limit to groups of installed packages not required by other installed packages]'
'--providers-of=[select packages that provide specified attribute]:attribute:(conflicts depends enhances obsoletes provides recommends requires requires_pre suggests supplement)'
'--recent[limit to only recently changed packages]'
'--recursive[make --whatrequires/--providers-of work recursively]'
'--security[limit to packages in security advisories]'
'--srpm[use the corresponding source RPM]'
'--unneeded[limit to unneeded installed packages]'
'--upgrades[limit to available packages that provide upgrade for installed packages]'
'--userinstalled[limit to packages that are not installed as dependencies]'
'--whatdepends=[limit to packages that require, enhance, recommend, suggest of supplement specified capability]:list of capability:'
'--whatconflicts=[limit to packages that conflicts with specified capabilities]:list of capability: '
)
for v in enhance obsolete provide recommend require suggest supplement; do
opts+=( "--what${v}s=[limit to packages that $v specified capabilities]:list of capability: ")
done
# mutually exclusive formating options
opts+=(
+ '(format)'
'--conflicts[display capabilities that the package conflicts with]'
'--depends[display capabilities that the package depends on, enables, recommends, suggests or supplements]'
'--files[show files in the package]'
'--requires-pre[display capabilities required to run pre/post scripts of the package]'
'--sourcerpm[display source RPM of the package]'
'--location[display location of the package]'
'--info[show detailed information about the package]'
'--changelogs[print the package changelogs]'
'(- *)--querytags[list tags recognized by --queryformat]'
'--queryformat=[specify output format]:format:'
)
for v in enhance obsolete provide recommend require suggest supplement; do
opts+=( "--${v}s[display capabilities ${v}ed by the package]" )
done
_arguments : '*: : _dnf5_packages -T all' $opts
}
# dnf commands
_dnf5_commands() {
local -a dnf_cmds=(
'advisory:manage advisories'
'autoremove:remove unneeded packages'
'check:check for problems in package database'
'check-upgrade:check for available package upgrades'
'clean:remove or invalidate cached data'
'distro-sync:up/downgrade installed packages to the latest available'
'downgrade:downgrade packages'
'download:download packages'
'environment:manage comps environments'
'group:manage comps groups'
'history:manage transaction history'
'info:provide detailed information about packages'
'install:install packages'
'leaves:list groups of leaf packages'
'list:list installed or available packages'
'makecache:generate the metadata cache'
'mark:change the reason of an installed package'
'module:manage modules'
'offline:manage offline transactions'
'provides:find what package provides the given value'
'reinstall:reinstall packages'
'remove:remove packages'
'replay:replay stored transactions'
'repo:manage repositories'
'repoquery:search for packages in repositories'
'search:search for packages using keywords'
'swap:remove software and install another in the single transaction'
'system-upgrade:upgrade the system to a new major release'
'upgrade:upgrade packages'
'versionlock:protect packages from updates to newer versions'
)
_describe -t dnf-commands 'dnf command' dnf_cmds
}
# subcommands and options
_dnf5_subcmds_opts() {
local cur=$words[CURRENT] cmd=$words[1] expl ret=1
local -a tmp
# common options
local -a offline_opts=(
'(--store)--offline[store the transaction to be performed offline]'
'(--offline)--store=[store the transaction in specified directory]: : _directories'
)
local -a common_opts=(
$offline_opts
'--allowerasing[allow erasing of installed packages]'
'--skip-broken[resolve dependency problems by skipping problematic packages]'
"--skip-unavailable[skip packages that can't be synchronized]"
'--downloadonly[download packages without executing transaction]'
)
local -a advisory_opts=(
'--advisories=[consider only specified advisories]:list of advisories:'
'--advisory-severities=[limit to advisories with specified severity]:severity:_sequence compadd - critical important moderate low none'
'--bzs=[limit to advisories that fix specified Bugzilla ID]:list of Bugzilla ID:'
'--cves=[limit to advisories that fix specified CVE ID]:list of CVD ID]:'
'--security[limit to security advisories]'
'--bugfix[limit to bugfix advisories]'
'--enhancement[limit to enhancement advisories]'
'--newpackage[limit to newpackage advisories]'
)
local -a downgrade_opts=(
'(--no-allow-downgrade)--allow-downgrade[enable downgrade of dependencies]'
'(--allow-downgrade)--no-allow-downgrade[disable downgrade of dependencies]'
)
local -a replay_opts=(
'--ignore-extras[not consider extra packages]'
'--ignore-installed[mismatches between installed and stored transaction are not errors]'
)
# Deal with some aliases (not comprehensive)
case $cmd in
check-updgrade) cmd=check-update;;
dg) cmd=downgrade;;
dsync) cmd=distro-sync;;
grp) cmd=group;;
if) cmd=info;;
in) cmd=install;;
ls) cmd=list;;
mc) cmd=makecache;;
rei) cmd=reinstall;;
rm) cmd=remove ;;
rq) cmd=repoquery;;
se) cmd=search;;
update|up) cmd=upgrade;;
esac
local curcontext="${curcontext%:*:*}:dnf-${cmd}:"
case $cmd in
advisory|group|history|mark|module|offline|repoquery)
_dnf5-$cmd && ret=0
;;
system-upgrade)
_dnf5-offline && ret=0
;;
autoremove)
_arguments : $offline_opts && ret=0
;;
check)
_arguments : \
'--dependencies[show missing dependencies and conflicts]' \
'--duplicates[show duplicated packages]' \
'--obsoleted[show obsoleted packages]' && ret=0
;;
check-upgrade)
_arguments : \
$advisory_opts \
'--changelogs[print package changelogs]' \
'--minimal[reports the lowest versions of packages that fix advisories]' \
'*: : _dnf5_packages -T installed' && ret=0
;;
clean)
tmp=(
'dbcache:remove cache files generated from the repository metadata'
'expire-cache:mark the repository metadata expired'
'metadata:remove the repository metadata'
'packages:remove any cached packages'
'all:clean all'
)
_describe -t cache-types 'cache type' tmp && ret=0
;;
distro-sync)
_arguments : $common_opts '*: : _dnf5_packages -T installed' && ret=0
;;
downgrade)
_arguments : \
$common_opts $downgrade_opts \
'*: : _dnf5_packages -T installed' && ret=0
;;
download)
_arguments : \
'--arch=[limit to packages of specified architecture]:list of architectures:' \
'--resolve[resolve and download needed dependencies]' \
'--alldeps[with --resolve, also download already installed dependencies]' \
'--destdir=[download to the specified directory]: : _directories' \
'--srpm[download the source rpm]' \
'--url[print the list of URLs where the rpms can be downloaded]' \
'*--urlprotocol=[with --url, limit to specified protocols]:protocol:_sequence compadd - http https ftp file' \
'*: : _dnf5_packages -T all' && ret=0
;;
environment)
_arguments : \
'--available[show only available environments]' \
'--installed[show only installed environments]' \
':subcommand:(list info)' \
'*: : _dnf5_environments' && ret=0
;;
info|list)
_arguments : \
'--showduplicates[show all versions of the packages]' \
'*: : _dnf5_packages -T all' \
+ '(type)' \
'--installed[list only installed packages]:*: : _dnf5_packages -T installed' \
'--available[list only available packages]:*: : _dnf5_packages -T available' \
'--extras[list only extras]' \
'--obsoletes[list only installed but obsoleted packages]:*: : _dnf5_packages -T installed' \
'--recent[list only recently added packages]' \
'--upgrades[list only available upgrades of installed packages]:*: : _dnf5_packages -T upgradable' \
'--autoremove[list only packages that will be autoremoved]:*: : _dnf5_packages -T installed' &&ret=0
;;
install)
_arguments : \
$common_opts $downgrade_opts $advisory_opts \
'*: : _dnf5_packages_or_rpms -T available' && ret=0
;;
leaves|makecache)
# nothing to complete
;;
provides)
_files && ret=0
;;
reinstall)
_arguments : \
$common_opts $downgrade_opts \
'*: : _dnf5_packages_or_rpms -T installed' && ret=0
;;
remove)
_arguments : \
$offline_opts \
'--no-autoremove[not remove dependencies that are no longer used]' \
'*: : _dnf5_packages -T installed' && ret=0
;;
replay)
_arguments : \
$replay_opts \
':transaction path:_directories' && ret=0
;;
repo)
_arguments : \
'--all[show info about all repositories]' \
'--enabled[show info only about enabled repositories]' \
'--disabled[show info only about disabled repositories]' \
':subcommand:(list info)' && ret=0
;;
search)
_arguments : \
'--all[search patterns also inside description and URL fields]' \
'--showduplicates[show all versions of packages, not only the latest ones]' \
'*:search pattern:' && ret=0
;;
swap)
_arguments : \
$offline_opts \
'--allowerasing[allow erasing of installed packages]' \
': : _dnf5_packages -T installed' \
': : _dnf5_packages -T available' && ret=0
;;
upgrade)
_arguments : \
${common_opts:#--skip-broken*} $downgrade_opts $advisory_opts \
'--minimal[upgrade only to the lowest available versions that fix advisories]' \
'--destdir=[specify directory into which downloading packages]: : _directories' \
'*: : _dnf5_packages_or_rpms -T upgradable' && ret=0
;;
versionlock)
_arguments : \
':subcommand:(add exclude clear delete list)' \
'*: : _dnf5_packages -T all' && ret=0
;;
esac
return ret
}
# main completer
_dnf5() {
local curcontext="$curcontext" state state_descr line ret=1
typeset -A opt_args
local -a opts=(
'(-y --assumeyes)--assumeno[answer no for all questions]'
'--best[try the best available package version]'
'(-C --cacheonly)'{-C,--cacheonly}"[run entirely from system cache, don't update cache]"
'--comment=[add comment to transaction history]:comment:'
'(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
'--debugsolver[dump detailed solving results in file ./debugdata]'
'*--disable-plugin=[disable specified plugins]:list of plugin names:'
'(--repo)*--disable-repo=[disable specified repos]: : _sequence _dnf5_repositories -T enabled'
'--dump-main-config[print main configuration values to stdout]'
'*--dump-repo-config=[print repository configuration values to stdout]:repi id'
'--dump-variables[print variable values to stdout]'
'*--enable-plugin=[enable specified plugins]:list of plugin names:'
'*--enable-repo=[enable additional repos]: : _sequence _dnf5_repositories -T disabled'
'--forcearch=[force the use of the specified arch]:arch:'
'(-)'{-h,--help}'[show the help message]'
'--installroot=[set install root]: : _directories'
'--no-best[do not limit transactions to best candidates]'
'--no-docs[do not install documentation]'
'--no-gpgcheck[skip checking GPG signatures on packages]'
'--no-plugins[disable all plugins]'
'(-q --quiet)'{-q,--quiet}'[show just the relevant content]'
'--refresh[force refreshing metadata before running the command]'
'--releasever=[override distribution release in config files]:release ver:'
'(--disablerepo)*--repo=[enable just the specified repo]: : _sequence _dnf5_repositories -T all'
'*--repofrompath=[specify additional repos]:repository_label,path_or_url: '
'*--setopt=[override option in config file]:repoid.option=value:'
'*--setvar=[override DNF5 variable value]'
'--show-new-leaves[show newly installed leaf packages]'
'--use-host-config[use config files and variables from host system]'
'(- *)--version[show dnf version]'
'(-y --assumeyes --assumeno)'{-y,--assumeyes}'[answer yes for all questions]'
'*'{-x+,--exclude=}'[exclude specified packages from transaction]: : _sequence _dnf5_packages -T all'
)
_arguments -C -s : $opts ': :->command' '*:: :->cmd_args' && ret=0
case $state in
command) _dnf5_commands && ret=0 ;;
cmd_args) _dnf5_subcmds_opts && ret=0 ;;
esac
return ret
}
_dnf5 "$@"

View file

@ -128,7 +128,7 @@ __docker-compose_subcommand() {
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
'--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
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
;;
(create)
_arguments \

View file

@ -1,5 +1,8 @@
# support Compose v2 as docker CLI plugin
(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose'
# Support Compose v2 as docker CLI plugin
#
# This tests that the (old) docker-compose command is in $PATH and that
# it resolves to an existing executable file if it's a symlink.
[[ -x "${commands[docker-compose]:A}" ]] && dccmd='docker-compose' || dccmd='docker compose'
alias dco="$dccmd"
alias dcb="$dccmd build"

View file

@ -1,19 +0,0 @@
# docker-machine plugin for oh my zsh
### Usage
#### docker-vm
Will create a docker-machine with the name "dev" (required only once)
To create a second machine call "docker-vm foobar" or pass any other name
#### docker-up
This will start your "dev" docker-machine (if necessary) and set it as the active one
To start a named machine use "docker-up foobar"
#### docker-switch dev
Use this to activate a running docker-machine (or to switch between multiple machines)
You need to call either this or docker-up when opening a new terminal
#### docker-stop
This will stop your "dev" docker-machine
To stop a named machine use "docker-stop foobar"

View file

@ -1,359 +0,0 @@
#compdef docker-machine
# Description
# -----------
# zsh completion for docker-machine
# https://github.com/leonhartX/docker-machine-zsh-completion
# -------------------------------------------------------------------------
# Version
# -------
# 0.1.1
# -------------------------------------------------------------------------
# Authors
# -------
# * Ke Xu <leonhartx.k@gmail.com>
# -------------------------------------------------------------------------
# Inspiration
# -----------
# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
# * @ilkka _docker-machine
__docker-machine_get_hosts() {
[[ $PREFIX = -* ]] && return 1
local state
declare -a hosts
state=$1; shift
if [[ $state != all ]]; then
hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
else
hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
fi
_describe 'host' hosts "$@" && ret=0
return ret
}
__docker-machine_hosts_with_state() {
declare -a hosts
hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
_describe 'host' hosts
}
__docker-machine_hosts_all() {
__docker-machine_get_hosts all "$@"
}
__docker-machine_hosts_running() {
__docker-machine_get_hosts Running "$@"
}
__docker-machine_get_swarm() {
declare -a swarms
swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
_describe 'swarm' swarms
}
__docker-machine_hosts_and_files() {
_alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
}
__docker-machine_filters() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
(driver)
_describe -t driver-filter-opts "driver filter" opts_driver && ret=0
;;
(swarm)
__docker-machine_get_swarm && ret=0
;;
(state)
opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
_describe -t state-filter-opts "state filter" opts_state && ret=0
;;
(name)
__docker-machine_hosts_all && ret=0
;;
(label)
_message 'label' && ret=0
;;
*)
_message 'value' && ret=0
;;
esac
else
opts=('driver' 'swarm' 'state' 'name' 'label')
_describe -t filter-opts "filter" opts -qS "=" && ret=0
fi
return ret
}
__get_swarm_discovery() {
declare -a masters services
local service
services=()
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
for master in $masters; do
service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
services=($services $service)
done
_describe -t services "swarm service" services && ret=0
return ret
}
__get_create_argument() {
typeset -g docker_machine_driver
if [[ CURRENT -le 2 ]]; then
docker_machine_driver="none"
elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
docker_machine_driver=$words[CURRENT-1]
elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
docker_machine_driver=${${words[CURRENT-1]}/*=/}
fi
local driver_opt_cmd
local -a opts_provider opts_common opts_read_argument
opts_read_argument=(
": :->argument"
)
opts_common=(
$opts_help \
'(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
'--engine-install-url=[Custom URL to use for engine installation]:url' \
'*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
'*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
'*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
'*--engine-label=[Specify labels for the created engine]:label' \
'--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
'*--engine-env=[Specify environment variables to set in the engine]:environment' \
'--swarm[Configure Machine with Swarm]' \
'--swarm-image=[Specify Docker image to use for Swarm]:image' \
'--swarm-master[Configure Machine to be a Swarm master]' \
'--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
'--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
'*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
'*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
'--swarm-host=[ip/socket to listen on for Swarm master]:host' \
'--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
'--swarm-experimental[Enable Swarm experimental features]' \
'*--tls-san=[Support extra SANs for TLS certs]:option'
)
driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
if [[ $docker_machine_driver != "none" ]]; then
opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
_arguments \
$opts_provider \
$opts_read_argument \
$opts_common && ret=0
else
_arguments $opts_common && ret=0
fi
case $state in
(driver-option)
_describe -t driver-option "driver" opts_driver && ret=0
;;
(storage-driver-option)
_describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
;;
(swarm-service)
__get_swarm_discovery && ret=0
;;
(argument)
ret=0
;;
esac
return ret
}
__docker-machine_subcommand() {
local -a opts_help
opts_help=("(- :)--help[Print usage]")
local -a opts_only_host opts_driver opts_storage_driver opts_state
opts_only_host=(
"$opts_help"
"*:host:__docker-machine_hosts_all"
)
opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
integer ret=1
case "$words[1]" in
(active)
_arguments \
$opts_help \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
;;
(config)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
"*:host:__docker-machine_hosts_all" && ret=0
;;
(create)
__get_create_argument
;;
(env)
_arguments \
$opts_help \
'--swarm[Display the Swarm config instead of the Docker daemon]' \
'--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
'(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
'--no-proxy[Add machine IP to NO_PROXY environment variable]' \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(help)
_arguments ':subcommand:__docker-machine_commands' && ret=0
;;
(inspect)
_arguments \
$opts_help \
'(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(ip)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(kill)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(ls)
_arguments \
$opts_help \
'(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
'*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
'(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
case $state in
(filter-options)
__docker-machine_filters && ret=0
;;
esac
;;
(provision)
_arguments $opts_only_host && ret=0
;;
(regenerate-certs)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
'*:host:__docker-machine_hosts_all' && ret=0
;;
(restart)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(rm)
_arguments \
$opts_help \
'(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
'-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(scp)
_arguments \
$opts_help \
'(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
'*:files:__docker-machine_hosts_and_files' && ret=0
;;
(ssh)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
(start)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(status)
_arguments $opts_only_host && ret=0
;;
(stop)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_with_state' && ret=0
;;
(upgrade)
_arguments $opts_only_host && ret=0
;;
(url)
_arguments \
$opts_help \
'*:host:__docker-machine_hosts_running' && ret=0
;;
esac
return ret
}
__docker-machine_commands() {
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
fi
if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
&& ! _retrieve_cache docker_machine_subcommands;
then
local -a lines
lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
_docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
(( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
fi
_describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
}
__docker-machine_caching_policy() {
oldp=( "$1"(Nmh+1) )
(( $#oldp ))
}
_docker-machine() {
if [[ $service != docker-machine ]]; then
_call_function - _$service
return
fi
local curcontext="$curcontext" state line
integer ret=1
typeset -A opt_args
_arguments -C \
"(- :)"{-h,--help}"[Show help]" \
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
'(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
'--tls-ca-key[Private key to generate certificates]:file:_files' \
'--tls-client-cert[Client cert to use for TLS]:file:_files' \
'--tls-client-key[Private key used in client TLS auth]:file:_files' \
'--github-api-token[Token to use for requests to the GitHub API]' \
'--native-ssh[Use the native (Go-based) SSH implementation.]' \
'--bugsnag-api-token[Bugsnag API token for crash reporting]' \
'(- :)'{-v,--version}'[Print the version]' \
"(-): :->command" \
"(-)*:: :->option-or-argument" && ret=0
case $state in
(command)
__docker-machine_commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
__docker-machine_subcommand && ret=0
ret=0
;;
esac
return ret
}
_docker-machine "$@"

View file

@ -1,33 +0,0 @@
DEFAULT_MACHINE="default"
docker-up() {
if [ -z "$1" ]
then
docker-machine start "${DEFAULT_MACHINE}"
eval $(docker-machine env "${DEFAULT_MACHINE}")
else
docker-machine start $1
eval $(docker-machine env $1)
fi
echo $DOCKER_HOST
}
docker-stop() {
if [ -z "$1" ]
then
docker-machine stop "${DEFAULT_MACHINE}"
else
docker-machine stop $1
fi
}
docker-switch() {
eval $(docker-machine env $1)
echo $DOCKER_HOST
}
docker-vm() {
if [ -z "$1" ]
then
docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 "${DEFAULT_MACHINE}"
else
docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 $1
fi
}

View file

@ -39,6 +39,10 @@ following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more
zstyle ':omz:plugins:docker' legacy-completion yes
```
### For Podman's Docker wrapper users
If you use Podman's Docker wrapper, you need to enable legacy completion. See above section.
## Aliases
| Alias | Command | Description |
@ -51,6 +55,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| dii | `docker image inspect` | Display detailed information on one or more images |
| dils | `docker image ls` | List docker images |
| dipu | `docker image push` | Push an image or repository to a remote registry |
| dipru | `docker image prune -a` | Remove all images not referenced by any container |
| dirm | `docker image rm` | Remove one or more images |
| dit | `docker image tag` | Add a name and tag to a particular image |
| dlo | `docker container logs` | Fetch the logs of a docker container |
@ -61,6 +66,8 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts |
| dnrm | `docker network rm` | Remove one or more networks |
| dpo | `docker container port` | List port mappings or a specific mapping for the container |
| dps | `docker ps` | List all the running docker containers |
| dpsa | `docker ps -a` | List all running and stopped containers |
| dpu | `docker pull` | Pull an image or a repository from a registry |
| dr | `docker container run` | Create a new container and start it using the specified command |
| drit | `docker container run -it` | Create a new container and start it in an interactive shell |
@ -70,6 +77,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| drs | `docker container restart` | Restart one or more containers |
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
| dstp | `docker container stop` | Stop one or more running containers |
| dsts | `docker stats` | Display real-time streaming statistics for containers |
| dtop | `docker top` | Display the running processes of a container |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dvls | `docker volume ls` | List all the volumes known to docker |

View file

@ -6,6 +6,7 @@ alias dib='docker image build'
alias dii='docker image inspect'
alias dils='docker image ls'
alias dipu='docker image push'
alias dipru='docker image prune -a'
alias dirm='docker image rm'
alias dit='docker image tag'
alias dlo='docker container logs'
@ -16,6 +17,8 @@ alias dni='docker network inspect'
alias dnls='docker network ls'
alias dnrm='docker network rm'
alias dpo='docker container port'
alias dps='docker ps'
alias dpsa='docker ps -a'
alias dpu='docker pull'
alias dr='docker container run'
alias drit='docker container run -it'
@ -25,6 +28,7 @@ alias dst='docker container start'
alias drs='docker container restart'
alias dsta='docker stop $(docker ps -q)'
alias dstp='docker container stop'
alias dsts='docker stats'
alias dtop='docker top'
alias dvi='docker volume inspect'
alias dvls='docker volume ls'
@ -36,7 +40,7 @@ if (( ! $+commands[docker] )); then
return
fi
# Standarized $0 handling
# Standardized $0 handling
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
@ -57,6 +61,6 @@ fi
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
fi
} &|

View file

@ -23,3 +23,4 @@ plugins=(... dotnet)
| dp | dotnet pack | Create a NuGet package. |
| dng | dotnet nuget | Provides additional NuGet commands. |
| db | dotnet build | Build a .NET project |
| dres | dotnet restore | Restore dependencies and project-specific tools for a project. |

View file

@ -11,7 +11,7 @@ _dotnet_completion() {
compdef _dotnet_completion dotnet
# Aliases bellow are here for backwards compatibility
# added by Shaun Tabone (https://github.com/xontab)
# added by Shaun Tabone (https://github.com/xontab)
alias dn='dotnet new'
alias dr='dotnet run'
@ -24,3 +24,4 @@ alias da='dotnet add'
alias dp='dotnet pack'
alias dng='dotnet nuget'
alias db='dotnet build'
alias dres='dotnet restore'

View file

@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer |
| ecd | - | Print the directory of the file open in the the current buffer |
| ecd | - | Print the directory of the file open in the current buffer |

View file

@ -35,7 +35,7 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking
if [[ -n "$INSIDE_EMACS" ]]; then
if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then
chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username
@ -60,7 +60,7 @@ function efile {
}
# Write to standard output the directory of the file
# opened in the the current buffer
# opened in the current buffer
function ecd {
local file
file="$(efile)" || return $?

View file

@ -29,5 +29,5 @@ plugins=(... ember-cli)
- [BilalBudhani](https://github.com/BilalBudhani)
- [eubenesa](https://github.com/eubenesa)
- [scottkidder](https://github.com/scottkidder]
- [scottkidder](https://github.com/scottkidder)
- [t-sauer](https://www.github.com/t-sauer)

View file

@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
# This is a combining character that can be placed after any other character to surround
# it in a "keycap" symbol.
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
# It's unclear whether this should be in the $emoji array, because those characters are all ones
# which can be displayed on their own.
@ -63,9 +63,9 @@ function random_emoji() {
[[ $list_size -eq 0 ]] && return 1
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
local name=${names[$random_index]}
if [[ "$group" == "flags" ]]; then
if [[ "$group" == "flags" ]]; then
echo ${emoji_flags[$name]}
else
else
echo ${emoji[$name]}
fi
}
@ -86,22 +86,22 @@ function display_emoji() {
# terminals treat these emoji chars as single-width.
local counter=1
for i in $names; do
if [[ "$group" == "flags" ]]; then
if [[ "$group" == "flags" ]]; then
printf '%s ' "$emoji_flags[$i]"
else
printf '%s ' "$emoji[$i]"
else
printf '%s ' "$emoji[$i]"
fi
# New line every 20 emoji, to avoid weirdnesses
if (($counter % 20 == 0)); then
printf "\n"
printf "\n"
fi
let counter=$counter+1
done
print
for i in $names; do
if [[ "$group" == "flags" ]]; then
if [[ "$group" == "flags" ]]; then
echo "${emoji_flags[$i]} = $i"
else
else
echo "${emoji[$i]} = $i"
fi
done

View file

@ -1,6 +1,6 @@
"""
Update Emoji.py
Refeshes OMZ emoji database based on the latest Unicode spec
Refreshes OMZ emoji database based on the latest Unicode spec
"""
import re
import json
@ -95,7 +95,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
shortname = snake_case(_name)
# Special treatment by status
# Enables us to have every emoji combination,
# even the one that are not officially sanctionned
# even the one that are not officially sanctioned
# and are implemented by, say, only one vendor
if _status == "unqualified":
shortname += "_unqualified"

View file

@ -4,7 +4,7 @@
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# DEPENDS: emoji plugin
#
#
# There are different sets of emoji characters available, to choose a different
# set export emotty_set to the name of the set you would like to use, e.g.:
# % export emotty_set=nature

View file

@ -40,7 +40,7 @@ plugins=(... encode64)
### Encoding a file
Encode a file's contents to base64 and save output to text file.
Encode a file's contents to base64 and save output to text file.
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
- From parameter

View file

@ -10,7 +10,7 @@ encodefile64() {
if [[ $# -eq 0 ]]; then
echo "You must provide a filename"
else
base64 -i $1 -o $1.txt
base64 $1 > $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
fi
}

View file

@ -52,6 +52,7 @@ plugins=(... extract)
| `tlz` | Tarball with lzma compression |
| `txz` | Tarball with lzma2 compression |
| `tzst` | Tarball with zstd compression |
| `vsix` | VS Code extension zip file |
| `war` | Web Application archive (Java-based) |
| `whl` | Python wheel file |
| `xpi` | Mozilla XPI module file |

View file

@ -1,7 +1,54 @@
#compdef extract
#autoload
local -a exts=(
7z
aar
apk
bz2
cab
cpio
crx
deb
ear
gz
ipa
ipsw
jar
lrz
lz4
lzma
obscpio
rar
rpm
sublime-package
tar
tar.bz2
tar.gz
tar.lrz
tar.lz
tar.lz4
tar.xz
tar.zma
tar.zst
tbz
tbz2
tgz
tlz
txz
tzst
vsix
war
whl
xpi
xz
Z
zip
zpaq
zst
)
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|obscpio|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
"*::archive file:_files -g '(#i)*.(${(j:|:)exts})(-.)'" \
&& return 0

View file

@ -70,24 +70,24 @@ EOF
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
(*.bz2) bunzip2 "$full_path" ;;
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
(*.xz) unxz "$full_path" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;;
(*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$full_path" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$full_path" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx) unzip "$full_path" ;;
(*.rar) unrar x -ad "$full_path" ;;
(*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z) 7za x "$full_path" ;;
(*.7z | *.7z.[0-9]*) 7za x "$full_path" ;;
(*.deb)
command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;;
(*.zst) unzstd "$full_path" ;;
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
(*.zpaq) zpaq x "$full_path" ;;

144
plugins/eza/README.md Normal file
View file

@ -0,0 +1,144 @@
# eza plugin
This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
To use it add `eza` to the plugins array in your zshrc file:
```zsh
plugins=(... eza)
```
## Configuration
All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
changing the `zstyle` won't have any effect.
### `dirs-first`
```zsh
zstyle ':omz:plugins:eza' 'dirs-first' yes|no
```
If `yes`, directories will be grouped first.
Default: `no`
### `git-status`
```zsh
zstyle ':omz:plugins:eza' 'git-status' yes|no
```
If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
Default: `no`
### `header`
```zsh
zstyle ':omz:plugins:eza' 'header' yes|no
```
If `yes`, always add `-h` flag to add a header row for each column.
Default: `no`
### `show-group`
```zsh
zstyle ':omz:plugins:eza' 'show-group' yes|no
```
If `yes` (default), always add `-g` flag to show the group ownership.
Default: `yes`
### `icons`
```zsh
zstyle ':omz:plugins:eza' 'icons' yes|no
```
If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders.
Default: `no`
### `color-scale`
```zsh
zstyle ':omz:plugins:eza' 'color-scale' all|age|size
```
Highlight levels of field(s) distinctly. Use comma(,) separated list of `all`, `age`, `size`
Default: `none`
### `color-scale-mode`
```zsh
zstyle ':omz:plugins:eza' 'color-scale-mode' gradient|fixed
```
Choose the mode for highlighting:
- `gradient` (default) -- gradient coloring
- `fixed` -- fixed coloring
Default: `gradient`
### `size-prefix`
```zsh
zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
```
Choose the prefix to be used in displaying file size:
- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
so on
- `none` -- don't use any prefix, show size in bytes
- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
Default: `si`
### `time-style`
```zsh
zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
```
Sets the `--time-style` option of `eza`. (See `man eza` for the options)
Default: Not set, which means the default behavior of `eza` will take place.
### `hyperlink`
```zsh
zstyle ':omz:plugins:eza' 'hyperlink' yes|no
```
If `yes`, always add `--hyperlink` flag to create hyperlink with escape codes.
Default: `no`
## Aliases
**Notes:**
- Aliases may be modified by Configuration
- The term "files" without "only" qualifier means both files & directories
| Alias | Command | Description |
| ------ | ----------------- | -------------------------------------------------------------------------- |
| `la` | `eza -la` | List all files (except . and ..) as a long list |
| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
| `ll` | `eza -l` | List files as a long list |
| `ls` | `eza` | Plain eza call |
| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |

View file

@ -0,0 +1,76 @@
if ! (( $+commands[eza] )); then
print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
return 1
fi
typeset -a _EZA_HEAD
typeset -a _EZA_TAIL
function _configure_eza() {
local _val
# Get the head flags
if zstyle -T ':omz:plugins:eza' 'show-group'; then
_EZA_HEAD+=("g")
fi
if zstyle -t ':omz:plugins:eza' 'header'; then
_EZA_HEAD+=("h")
fi
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
case "${_val:l}" in
binary)
_EZA_HEAD+=("b")
;;
none)
_EZA_HEAD+=("B")
;;
esac
# Get the tail long-options
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
_EZA_TAIL+=("--group-directories-first")
fi
if zstyle -t ':omz:plugins:eza' 'git-status'; then
_EZA_TAIL+=("--git")
fi
if zstyle -t ':omz:plugins:eza' 'icons'; then
_EZA_TAIL+=("--icons=auto")
fi
zstyle -s ':omz:plugins:eza' 'color-scale' _val
if [[ $_val ]]; then
_EZA_TAIL+=("--color-scale=$_val")
fi
zstyle -s ':omz:plugins:eza' 'color-scale-mode' _val
if [[ $_val == (gradient|fixed) ]]; then
_EZA_TAIL+=("--color-scale-mode=$_val")
fi
zstyle -s ':omz:plugins:eza' 'time-style' _val
if [[ $_val ]]; then
_EZA_TAIL+=("--time-style='$_val'")
fi
if zstyle -t ":omz:plugins:eza" "hyperlink"; then
_EZA_TAIL+=("--hyperlink")
fi
}
_configure_eza
function _alias_eza() {
local _head="${(j::)_EZA_HEAD}$2"
local _tail="${(j: :)_EZA_TAIL}"
alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
}
_alias_eza la la
_alias_eza ldot ld ".*"
_alias_eza lD lD
_alias_eza lDD lDa
_alias_eza ll l
_alias_eza ls
_alias_eza lsd d
_alias_eza lsdl dl
_alias_eza lS "l -ssize"
_alias_eza lT "l -snewest"
unfunction _alias_eza
unfunction _configure_eza
unset _EZA_HEAD
unset _EZA_TAIL

View file

@ -1,14 +1,24 @@
# Use Ctrl-Z to switch back to Vim
# fancy-ctrl-z
I frequently need to execute random commands in my shell. To achieve it I pause
Allows pressing Ctrl-Z again to switch back to a background job.
To use it, add `fancy-ctrl-z` to the plugins array in your zshrc file:
```zsh
plugins=(... fancy-ctrl-z)
```
## Motivation
I frequently need to execute random commands in my shell. To achieve it I pause
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
to Vim. I could not find a solution, so I developed one on my own that
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
to Vim. I could not find a solution, so I developed one on my own that
works wonderfully with ZSH.
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
Credits:
Credits:
- original idea by @sheerun
- added to OMZ by @mbologna

View file

@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
For example: `fastfile_var_prefix='@'`.
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
created global aliases.
created global aliases.
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
or using `⌥ Option`+`6` in macOS.
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
with a trailing slash.
with a trailing slash.
**Default:** `$HOME/.fastfile/`.
## Author

View file

@ -5,8 +5,8 @@
# If they are not set yet, they will be
# overwritten with their default values
default fastfile_dir "${HOME}/.fastfile"
default fastfile_var_prefix "
fastfile_dir="${fastfile_dir:-${HOME}/.fastfile}"
fastfile_var_prefix="${fastfile_var_prefix:-§}"
###########################
# Impl

View file

@ -1,9 +0,0 @@
# fd
This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`.
To use it, add `fd` to the plugins array in your zshrc file:
```zsh
plugins=(... fd)
```

View file

@ -1,273 +0,0 @@
#compdef fd
##
# zsh completion function for fd
#
# Based on ripgrep completion function.
# Originally based on code from the zsh-users project — see copyright notice
# below.
autoload -U is-at-least
_fd() {
local curcontext="$curcontext" no='!' ret=1
local -a context line state state_descr _arguments_options fd_types fd_args
local -A opt_args
if is-at-least 5.2; then
_arguments_options=( -s -S )
else
_arguments_options=( -s )
fi
fd_types=(
{f,file}'\:"regular files"'
{d,directory}'\:"directories"'
{l,symlink}'\:"symbolic links"'
{e,empty}'\:"empty files or directories"'
{x,executable}'\:"executable (files)"'
{s,socket}'\:"sockets"'
{p,pipe}'\:"named pipes (FIFOs)"'
)
# Do not complete rare options unless either the current prefix
# matches one of those options or the user has the `complete-all`
# style set. Note that this prefix check has to be updated manually to account
# for all of the potential negation options listed below!
if
# (--[bpsu]* => match all options marked with '$no')
[[ $PREFIX$SUFFIX == --[bopsu]* ]] ||
zstyle -t ":complete:$curcontext:*" complete-all
then
no=
fi
# We make heavy use of argument groups here to prevent the option specs from
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
# them out below if necessary. This makes the exclusions inaccurate on those
# older versions, but oh well — it's not that big a deal
fd_args=(
+ '(hidden)' # hidden files
{-H,--hidden}'[search hidden files/directories]'
+ '(no-ignore-full)' # all ignore files
'(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]"
$no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]'
+ no-ignore-partial # some ignore files
"(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]"
"!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]"
$no'(no-ignore-full --no-ignore-parent)--no-ignore-parent[]'
+ '(case)' # case-sensitivity
{-s,--case-sensitive}'[perform a case-sensitive search]'
{-i,--ignore-case}'[perform a case-insensitive search]'
+ '(regex-pattern)' # regex-based search pattern
'(no-regex-pattern)--regex[perform a regex-based search (default)]'
+ '(no-regex-pattern)' # non-regex-based search pattern
{-g,--glob}'[perform a glob-based search]'
{-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
+ '(match-full)' # match against full path
{-p,--full-path}'[match the pattern against the full path instead of the basename]'
+ '(follow)' # follow symlinks
{-L,--follow}'[follow symbolic links to directories]'
+ '(abs-path)' # show absolute paths
'(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]'
+ '(null-sep)' # use null separator for output
'(long-listing)'{-0,--print0}'[separate search results by the null character]'
+ '(long-listing)' # long-listing output
'(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]'
+ '(max-results)' # max number of results
'(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count'
'(long-listing exec-cmds)-1[limit to a single search result and quit]'
+ '(fs-errors)' # file-system errors
$no'--show-errors[enable the display of filesystem errors]'
+ '(fs-traversal)' # file-system traversal
$no"--one-file-system[don't descend into directories on other file systems]"
'!--mount'
'!--xdev'
+ dir-depth # directory depth
'(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth'
'!(--exact-depth -d --max-depth)--maxdepth:depth'
'(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth'
'(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth'
+ prune # pruning
"--prune[don't traverse into matching directories]"
+ filter-misc # filter search
'*'{-t+,--type=}"[filter search by type]:type:(($fd_types))"
'*'{-e+,--extension=}'[filter search by file extension]:extension'
'*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern'
'*'{-S+,--size=}'[limit search by file size]:size limit:->size'
'(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner'
+ ignore-file # extra ignore files
'*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files'
+ '(filter-mtime-newer)' # filter by files modified after than
'--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
'!--change-newer-than=:date/duration'
'!--newer=:date/duration'
+ '(filter-mtime-older)' # filter by files modified before than
'--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration'
'!--change-older-than=:date/duration'
'!--older=:date/duration'
+ '(color)' # colorize output
{-c+,--color=}'[declare when to colorize search results]:when to colorize:((
auto\:"show colors if the output goes to an interactive console (default)"
never\:"do not use colorized output"
always\:"always use colorized output"
))'
+ '(threads)'
{-j+,--threads=}'[set the number of threads for searching and executing]:number of threads'
+ '(exec-cmds)' # execute command
'(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'
'(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'
'(long-listing max-results)--batch-size=[max number of args for each -X call]:size'
+ other
'!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'
+ '(about)' # about flags
'(: * -)'{-h,--help}'[display help message]'
'(: * -)'{-v,--version}'[display version information]'
+ path-sep # set path separator for output
$no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator'
+ search-path
$no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/'
$no'(*)*--search-path=[set search path (instead of positional <path> arguments)]:directory:_files -/'
+ strip-cwd-prefix
$no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]'
+ args # positional arguments
'1: :_guard "^-*" pattern'
'(--search-path)*:directory:_files -/'
)
# Strip out argument groups where unsupported (see above)
is-at-least 5.4 ||
fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
_arguments $_arguments_options : $fd_args && ret=0
case ${state} in
owner)
compset -P '(\\|)\!'
if compset -P '*:'; then
_groups && ret=0
else
if
compset -S ':*' ||
# Do not add the colon suffix when completing "!user<TAB>
# (with a starting double-quote) otherwise pressing tab again
# after the inserted colon "!user:<TAB> will complete history modifiers
[[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]]
then
_users && ret=0
else
local q
# Since quotes are needed when using the negation prefix !,
# automatically remove the colon suffix also when closing the quote
if [[ $QIPREFIX == [\'\"]* ]]; then
q=${QIPREFIX:0:1}
fi
_users -r ": \t\n\-$q" -S : && ret=0
fi
fi
;;
size)
if compset -P '[-+][0-9]##'; then
local -a suff=(
'B:bytes'
'K:kilobytes (10^3 = 1000 bytes)'
'M:megabytes (10^6 = 1000^2 bytes)'
'G:gigabytes (10^9 = 1000^3 bytes)'
'T:terabytes (10^12 = 1000^4 bytes)'
'Ki:kibibytes ( 2^10 = 1024 bytes)'
'Mi:mebibytes ( 2^20 = 1024^2 bytes)'
'Gi:gigibytes ( 2^30 = 1024^3 bytes)'
'Ti:tebibytes ( 2^40 = 1024^4 bytes)'
)
_describe -t units 'size limit units' suff -V 'units'
elif compset -P '[-+]'; then
_message -e 'size limit number (full format: <+-><number><unit>)'
else
_values 'size limit prefix (full format: <prefix><number><unit>)' \
'\+[file size must be greater or equal to]'\
'-[file size must be less than or equal to]' && ret=0
fi
;;
esac
return ret
}
_fd "$@"
# ------------------------------------------------------------------------------
# Copyright (c) 2011 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 fd
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * smancill (https://github.com/smancill)
#
# ------------------------------------------------------------------------------
# Local Variables:
# mode: shell-script
# coding: utf-8-unix
# indent-tabs-mode: nil
# sh-indentation: 2
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

35
plugins/foot/README.md Normal file
View file

@ -0,0 +1,35 @@
# foot
This plugin adds shell integration for [foot, a fast, lightweight and
minimalistic Wayland terminal emulator](https://codeberg.org/dnkl/foot).
To use, add `foot` to the list of plugins in your `.zshrc` file:
```zsh
plugins=(... foot)
```
## Spawning new terminal instances in the current working directory
When spawning a new terminal instance (with `ctrl+shift+n` by default), the new
instance will start in the current working directory.
## Jumping between prompts
Foot can move the current viewport to focus prompts of already executed
commands (bound to ctrl+shift+z/x by default).
## Piping last command's output
The key binding `pipe-command-output` can pipe the last command's output to an
application of your choice (similar to the other `pipe-*` key bindings):
```
[key-bindings]
pipe-command-output=[sh -c "f=$(mktemp); cat - > $f; footclient emacsclient -nw $f; rm $f"] Control+Shift+g
```
When pressing ctrl+shift+g, the last command's output is written to a
temporary file, then an emacsclient is started in a new footclient instance.
The temporary file is removed after the footclient instance has closed.

View file

@ -0,0 +1,10 @@
function precmd {
print -Pn "\e]133;A\e\\"
if ! builtin zle; then
print -n "\e]133;D\e\\"
fi
}
function preexec {
print -n "\e]133;C\e\\"
}

View file

@ -2,6 +2,7 @@
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# Updated to support ForkLift from Setapp by Paul Rudkin
# Updated to support ForkLift 4 by Michal Szymanski (misiektoja)
#
# Usage:
# fl [<folder>]
@ -58,7 +59,7 @@ function fl {
tell application forkLiftSetapp
activate
set forkLiftVersion to version
end tell
end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3
activate
@ -84,7 +85,7 @@ function fl {
else if forkLift is not null then
set appName to forkLift
end if
tell application appName
activate
set forkLiftVersion to version
@ -110,6 +111,11 @@ function fl {
tell pop over of list of group of splitter group of splitter group of topWindow
set value of text field 1 to "$PWD"
end tell
else if forkLiftVersion starts with "4" then
tell pop over of list of group of splitter group of splitter group of topWindow
keystroke "$PWD"
delay 0.1
end tell
else
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"

View file

@ -1,3 +1,16 @@
function fzf_setup_using_fzf() {
(( ${+commands[fzf]} )) || return 1
# we remove "fzf " prefix, this fixes really old fzf versions behaviour
# see https://github.com/ohmyzsh/ohmyzsh/issues/12387
local fzf_ver=${"$(fzf --version)"#fzf }
autoload -Uz is-at-least
is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
eval "$(fzf --zsh)"
}
function fzf_setup_using_base_dir() {
local fzf_base fzf_shell fzfdirs dir
@ -8,6 +21,7 @@ function fzf_setup_using_base_dir() {
"${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
"${MSYSTEM_PREFIX}/share/fzf"
"/usr/local/opt/fzf"
"/opt/homebrew/opt/fzf"
"/usr/share/fzf"
@ -61,7 +75,7 @@ function fzf_setup_using_base_dir() {
function fzf_setup_using_debian() {
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
# Not a debian based distro
# Not a debian based distro
return 1
fi
@ -134,6 +148,27 @@ function fzf_setup_using_opensuse() {
return 0
}
function fzf_setup_using_fedora() {
(( $+commands[fzf] )) || return 1
local completions="/usr/share/zsh/site-functions/fzf"
local key_bindings="/usr/share/fzf/shell/key-bindings.zsh"
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
return 1
fi
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
}
function fzf_setup_using_openbsd() {
# openBSD installs fzf in /usr/local/bin/fzf
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
@ -216,9 +251,11 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
EOF
}
fzf_setup_using_openbsd \
fzf_setup_using_fzf \
|| fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
|| fzf_setup_using_fedora \
|| fzf_setup_using_cygwin \
|| fzf_setup_using_macports \
|| fzf_setup_using_base_dir \

View file

@ -1,6 +1,6 @@
# gatsby autocomplete plugin
* Adds autocomplete options for all gatsby commands.
Adds autocomplete options for all gatsby commands.
## Requirements

View file

@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/usr/local/share/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/share/google-cloud-sdk"
"/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current"
"/snap/google-cloud-cli/current"
@ -17,6 +18,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/google-cloud-sdk"
"/opt/google-cloud-cli"
"/opt/local/libexec/google-cloud-sdk"
"$HOME/.asdf/installs/gcloud/*/"
)
for gcloud_sdk_location in $search_locations; do

View file

@ -4,4 +4,29 @@ alias gemp="gem push *.gem"
# gemy GEM 0.0.0 = gem yank GEM -v 0.0.0
function gemy {
gem yank $1 -v $2
}
}
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `gem`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_gem" ]]; then
typeset -g -A _comps
autoload -Uz _gem
_comps[gem]=_gem
fi
# zsh 5.5 already provides completion for `_gem`. With this we ensure that
# our provided completion (which is not optimal but is enough in most cases)
# is used for older versions
autoload -Uz is-at-least
if is-at-least 5.5; then
return 0
fi
{
# Standardized $0 handling
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
command cp -f "${0:h}/completions/_gem" "$ZSH_CACHE_DIR/completions/_gem"
} &|

View file

@ -18,7 +18,7 @@ You can change the fetch interval in your .zshrc:
GIT_AUTO_FETCH_INTERVAL=1200 # in seconds
```
A log of `git fetch --all` will be saved in `.git/FETCH_LOG`.
A log of `git-fetch-all` will be saved in `.git/FETCH_LOG`.
## Toggle auto-fetch per folder

View file

@ -1,6 +1,8 @@
# git-commit plugin
The git-commit plugin adds several [git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
The git-commit plugin adds several
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
To use it, add `git-commit` to the plugins array in your zshrc file:
@ -11,11 +13,9 @@ plugins=(... git-commit)
## Syntax
```zsh
git <type> [(-s, --scope) "<scope>"] "<message>"
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
```
> ⚠️ Single/Double quotes around the scope and message are required
Where `type` is one of the following:
- `build`
@ -29,14 +29,19 @@ Where `type` is one of the following:
- `rev`
- `style`
- `test`
- `wip`
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
> It will still generate a commit message in the format `revert: <message>`
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
> care!
## Examples
| Git alias | Command |
| --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
| `git wip "work in progress"` | `git commit -m "work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |

View file

@ -1,3 +1,9 @@
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
return
fi
git config --global oh-my-zsh.git-commit-alias "$_rev"
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
@ -11,21 +17,42 @@ _git_commit_aliases=(
'revert'
'style'
'test'
'wip'
)
local alias type
for type in "${_git_commit_aliases[@]}"; do
local _alias _type
for _type in "${_git_commit_aliases[@]}"; do
# an alias can't be named "revert" because the git command takes precedence
# https://stackoverflow.com/a/3538791
case "$type" in
revert) alias=rev ;;
*) alias=$type ;;
case "$_type" in
revert) _alias=rev ;;
*) _alias=$_type ;;
esac
local func='!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$type'(${scope}): ${@}"; else git commit -m "'$type': ${@}"; fi }; a'
if ! git config --global --get-all alias.${alias} >/dev/null 2>&1; then
git config --global alias.${alias} "$func"
fi
local _func='!a() {
local _scope _attention _message
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z $2 ]; then
echo "Missing scope!"
return 1
fi
_scope="$2"
shift 2
;;
-a | --attention )
_attention="!"
shift 1
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
}; a'
unset _git_commit_aliases alias type func
git config --global alias.$_alias "$_func"
done

View file

@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
plugins=(... git-prompt)
```
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
to change the way the prompt is built. See the
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements

View file

@ -23,9 +23,10 @@ def get_tagname_or_hash():
return hash_
return None
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stash count
# Use `--git-common-dir` to avoid problems with git worktrees, which don't have individual stashes
def get_stash():
cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
cmd = Popen(['git', 'rev-parse', '--git-common-dir'], stdout=PIPE, stderr=PIPE)
so, se = cmd.communicate()
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
@ -35,7 +36,6 @@ def get_stash():
except IOError:
return 0
# `git status --porcelain --branch` can collect all information
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)

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