Compare commits

...

42 Commits

Author SHA1 Message Date
Vigneshwar Ravichandar c45a648dd0
Merge 1e7692b094 into 6e9cda3d30 2025-01-22 09:12:52 +00:00
dependabot[bot] 6e9cda3d30
chore(deps): bump semver in /.github/workflows/dependencies (#12924)
Bumps [semver](https://github.com/python-semver/python-semver) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/python-semver/python-semver/releases)
- [Changelog](https://github.com/python-semver/python-semver/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/python-semver/python-semver/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-19 23:30:40 +01:00
ohmyzsh[bot] d689aa289e
feat(gitfast): update to version v2.2 (#12923)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2025-01-19 11:20:14 +01:00
Felipe Contreras 8c5b71b2f4
ci(deps): update `gitfast` to its new structure (#12922)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2025-01-19 11:18:37 +01:00
Abhijeet Vashistha 028d653632
fix(sonicradish): reset color typo (#12912) 2025-01-15 17:03:32 +01:00
Nico Just 04cba220f7
feat(eza): add color-scale options (#12841) 2025-01-15 12:40:52 +01:00
Michele Bologna 7a3695aadf
fix(grc): add linuxbrew path (#12903) 2025-01-12 14:25:00 +01:00
Thomas cae2e45193
fix(rust): call `rustc` through `rustup run` (#12901) 2025-01-10 14:17:49 +01:00
Carlo Sala 276e540eed
fix(cli): ensure `ksharrays` is unset
Closes #12900
2025-01-10 14:11:33 +01:00
Bhanu 5c17bcd21f
feat(web-search): add perplexity.ai (#12815) 2025-01-08 09:34:00 +01:00
Kalle Ahlström d82669199b
fix(af-magic): add logic for virtualenv separator (#12875) 2024-12-30 10:15:05 +01:00
dependabot[bot] 9c8afcc3ee
chore(deps): bump charset-normalizer in /.github/workflows/dependencies (#12874)
Bumps [charset-normalizer](https://github.com/jawah/charset_normalizer) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.4.0...3.4.1)

---
updated-dependencies:
- dependency-name: charset-normalizer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-29 13:22:49 +01:00
dependabot[bot] f733dc340b
chore(deps): bump urllib3 from 2.2.3 to 2.3.0 in /.github/workflows/dependencies (#12863)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-22 16:19:12 +01:00
ohmyzsh[bot] 048e166c9e
feat(z): update to dd94ef04 (#12862)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2024-12-22 11:46:24 +01:00
Federico François b9e73b4481
docs(per-directory-history): add variable docs (#12844) 2024-12-15 23:40:09 +01:00
dependabot[bot] 62e3e0b2fd
chore(deps): bump certifi from 2024.8.30 to 2024.12.14 in /.github/workflows/dependencies (#12848)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-15 23:38:56 +01:00
Jonathan Stacks 69a6359f7c
feat(ngrok): add completion plugin (#12826) 2024-11-28 09:57:21 +01:00
ohmyzsh[bot] 366d254352
feat(wd): update to v0.9.2 (#12820)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2024-11-24 13:25:13 +01:00
Bin Chang ccbe504f22
chore: fix some typos (#12818) 2024-11-21 09:01:48 +01:00
Chris Texe 6c91a5e389
feat(laravel): add alias for `optimize:clear` (#12793)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-11-20 10:04:46 +01:00
Markus Hofbauer 9991822f8c
feat(bazel): add bzlmod integrity gen function (#12797)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-11-19 21:20:58 +01:00
Matheus Pimenta 1b9d6e5c82
feat(timoni): add completion plugin (#12802) 2024-11-19 21:11:51 +01:00
Marc Cornellà 2e8d2d7401
fix(pipenv): fix auto-shell functionality when cd-ing out (#12813)
Co-authored-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
2024-11-19 21:05:34 +01:00
nervo 9ad764d80c
feat(vault): re-introduce vault plugin (#12753)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-11-19 20:47:20 +01:00
Hu Yufan e636eeb696
fix(tailscale): load completion when `tailscale` is an alias (#12726)
This makes it work when Tailscale is installed via App Store:
https://tailscale.com/kb/1080/cli?tab=macos.

Co-authored-by: Marc Cornellà <marc@mcornella.com>
2024-11-19 20:34:28 +01:00
Olivier Mehani 081d704f32
feat(pyenv): add prompt customization (#12738)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-11-19 20:32:01 +01:00
Marc Cornellà b5d52682ca
fix(dash): urlencode special parameters like `:` in query (#12811)
In macOS, using queries such as `dash php:enum` does not open Dash.app,
possibly due to colon character being interpreted as a port.

URL-encoding the parameter (: -> %3A) makes this work again.

Fixes https://discord.com/channels/642496866407284746/809850042575093760/1308076125456437300
2024-11-19 15:43:04 +01:00
Kate Sullivan ca5471fe49
fix(poetry-env): switch venv between poetry dirs (#12804)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2024-11-14 09:00:48 +01:00
Vigneshwar Ravichandar 1e7692b094
Merge branch 'ohmyzsh:master' into master 2022-01-26 22:31:23 +05:30
Vigneshwar Ravichandar bd72dd8bea
Merge branch 'ohmyzsh:master' into master 2021-11-19 13:40:12 +05:30
Vigneshwar Ravichandar 1d11c6eef6
Merge branch 'ohmyzsh:master' into master 2021-11-13 19:50:36 +05:30
Vigneshwar Ravichandar 4b8733a278
Merge branch 'ohmyzsh:master' into master 2021-10-02 11:41:04 +05:30
Vigneshwar Ravichandar be561bc027
Merge branch 'ohmyzsh:master' into master 2021-09-10 15:12:39 +05:30
Vigneshwar Ravichandar 182c893834
Merge branch 'ohmyzsh:master' into master 2021-07-28 10:42:06 +05:30
Vigneshwar Ravichandar 6cc5aef3ab
Merge branch 'ohmyzsh:master' into master 2021-07-25 16:00:36 +05:30
ToastCoder 08aa4b5bc3 Used python3 -m pip instead of pip3 in pypi-check alias 2021-06-26 21:08:42 +05:30
Vigneshwar Ravichandar a35d2c19fc
Added list of aliases in pypi plugin 2021-06-26 16:38:20 +05:30
Moulishankar10 f965e9a58b Added the plugin description in README.md 2021-06-26 16:13:46 +05:30
Moulishankar10 2372c8dfee Added alias for pypi-ltest in pypi plugin 2021-06-26 14:15:57 +05:30
Moulishankar10 40ab2e14d3 Added alias for pypi-tupload 2021-06-26 14:15:00 +05:30
ToastCoder dd71441529 Added pypi-upload alias in pypi plugin and minor correction in pypi-check alias 2021-06-26 13:51:46 +05:30
ToastCoder 9c54986ad1 Added pypi-check alias in pypi plugin 2021-06-26 13:48:49 +05:30
40 changed files with 297 additions and 91 deletions

View File

@ -2,11 +2,13 @@ dependencies:
plugins/gitfast:
repo: felipec/git-completion
branch: master
version: tag:v2.1
version: tag:v2.2
postcopy: |
set -e
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
test -e git-completion.zsh && mv -f git-completion.zsh _git
rm -rf git-completion.plugin.zsh Makefile t tools
mv README.adoc MANUAL.adoc
mv -f src/* .
rmdir src
plugins/gradle:
repo: gradle/gradle-completion
branch: master
@ -28,7 +30,7 @@ dependencies:
plugins/wd:
repo: mfaerevaag/wd
branch: master
version: tag:v0.9.1
version: tag:v0.9.2
precopy: |
set -e
rm -r test
@ -36,7 +38,7 @@ dependencies:
plugins/z:
branch: master
repo: agkozak/zsh-z
version: afaf2965b41fdc6ca66066e09382726aa0b6aa04
version: dd94ef04acc41748ba171eb219971cb455e0040b
precopy: |
set -e
test -e README.md && mv -f README.md MANUAL.md

View File

@ -1,7 +1,7 @@
certifi==2024.8.30
charset-normalizer==3.4.0
certifi==2024.12.14
charset-normalizer==3.4.1
idna==3.10
PyYAML==6.0.2
requests==2.32.3
semver==3.0.2
urllib3==2.2.3
semver==3.0.3
urllib3==2.3.0

View File

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
function omz {
setopt localoptions noksharrays
[[ $# -gt 0 ]] || {
_omz::help
return 1

View File

@ -19,7 +19,7 @@ setopt multios # enable redirect to multiple streams: echo >file1 >
setopt long_list_jobs # show long list format job notifications
setopt interactivecomments # recognize comments
# define pager dependant on what is available (less or more)
# define pager depending on what is available (less or more)
if (( ${+commands[less]} )); then
env_default 'PAGER' 'less'
env_default 'LESS' '-R'

View File

@ -1,6 +1,7 @@
# Bazel plugin
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.
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:
@ -14,9 +15,15 @@ The plugin has a copy of [the completion script from the git repository][1].
## 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 |
| 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

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

@ -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

@ -65,6 +65,29 @@ 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

View File

@ -34,6 +34,14 @@ function _configure_eza() {
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'")

View File

@ -0,0 +1,40 @@
This project is a friendly fork of the official Git completion
(`contrib/completion`) and prompt scripts for Bash, Zsh, and possibly other
shells.
Most Git developers use the Bash shell, for which the completion scripts work
rather well, however, Zsh is typically neglected. I've sent many patches to fix
the issues, many have been merged, but many have been ignored, thus the need for
a canonical location of a good, working Zsh completion.
There are advantages for Bash users too. Currently the scripts under `contrib` are tied to the
specific Git version, for example the completion scripts of version v2.40
(https://git.kernel.org/pub/scm/git/git.git/plain/contrib/completion/git-completion.bash?h=v2.40.0[git-completion.bash])
have issues with older versions of Git (e.g. v2.33); the ones in
this project don't.
With `git-completion` you can be sure you are using the latest completion that
works in both shells, and any Git version.
This is a sister project of the
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast[Oh My Zsh
gitfast] plugin (that I also maintain), which has similar needs.
== Installation ==
* https://github.com/felipec/git-completion/wiki/Bash[Bash instructions]
* https://github.com/felipec/git-completion/wiki/Zsh[Zsh instructions]
== Improvements from upstream ==
This is a short list of the benefits you get:
* Easier installation
* Tons of bug fixes
* Works with older versions of git
* Zsh: much more options
* Zsh: quoting works properly
* Zsh: automatic suffix removal
For a full list of all the patches on top of upstream git check
https://github.com/felipec/git-completion/wiki/Patches[Patches].

View File

@ -2,23 +2,11 @@
# zsh completion wrapper for git
#
# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com>
# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
#
# The recommended way to install this script is to make a copy of it as a
# file named '_git' inside any directory in your fpath.
# The recommended way to use this script is to prepend its location to your $fpath:
#
# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git',
# and then add the following to your ~/.zshrc file:
#
# fpath=(~/.zsh $fpath)
#
# You need git's bash completion script installed. By default bash-completion's
# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
#
# If your bash completion script is somewhere else, you can specify the
# location in your ~/.zshrc:
#
# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
# fpath=($git_completion_srcdir $fpath)
#
zstyle -T ':completion:*:*:git:*' tag-order && \

View File

@ -1,6 +1,8 @@
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
#
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#

View File

@ -5,6 +5,7 @@ files=(
/etc/grc.zsh # default
/usr/local/etc/grc.zsh # homebrew darwin-x64
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
/home/linuxbrew/.linuxbrew/etc/grc.zsh # linuxbrew
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
)

View File

@ -49,6 +49,7 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` |
| `paopc` | `php artisan optimize:clear` |
## Queues

View File

@ -36,6 +36,7 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear'
alias paopc='php artisan optimize:clear'
# queues
alias paqf='php artisan queue:failed'

View File

@ -16,7 +16,7 @@ plugins=(... macports)
| pc | `sudo port clean --all installed` | Clean up intermediate installation files for installed ports |
| pi | `sudo port install` | Install package given as argument |
| pli | `port livecheck installed` | Check for updates for installed ports |
| plm | `port-livecheck-maintainer` | Check for updates of ports mainained by the specified users |
| plm | `port-livecheck-maintainer` | Check for updates of ports maintained by the specified users |
| psu | `sudo port selfupdate` | Update ports tree with MacPorts repository |
| puni | `sudo port uninstall inactive` | Uninstall inactive ports |
| puo | `sudo port upgrade outdated` | Upgrade ports with newer versions available |

20
plugins/ngrok/README.md Normal file
View File

@ -0,0 +1,20 @@
# ngrok plugin
This plugin adds completion for the [ngrok](https://ngrok.com) CLI.
To use it, add `ngrok` to the plugins array in your zshrc file:
```zsh
plugins=(... ngrok)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE/completions/_ngrok` completions script

View File

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

View File

@ -40,7 +40,7 @@ plugins=(... opentofu)
- `tofu_prompt_info`: shows the current workspace when in an OpenTofu project directory.
- `tofu_version_prompt_info`: shows the current version of the `tofu` commmand.
- `tofu_version_prompt_info`: shows the current version of the `tofu` command.
To use them, add them to a `PROMPT` variable in your theme or `.zshrc` file:

View File

@ -35,6 +35,7 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
function above (default `^G`)
* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
the current mode is printed to the screen following a mode change (default `true`)
* `HISTORY_START_WITH_GLOBAL` is a global variable that defines how to start the plugin: global or local (default `false`)
## History

View File

@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ ! -f "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
exit
unset PIPENV_ACTIVE pipfile_dir
deactivate
fi
fi
fi
@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
source "$(pipenv --venv)/bin/activate"
export PIPENV_ACTIVE=1
fi
fi
}

View File

@ -6,8 +6,7 @@ _togglePoetryShell() {
fi
# Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
if [[ $poetry_active -eq 1 ]] && [[ $in_poetry_dir -eq 0 ]] \
&& [[ "$PWD" != "$poetry_dir"* ]]; then
if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] || [[ "$PWD" != "$poetry_dir"* ]]; }; then
export poetry_active=0
unset poetry_dir
(( $+functions[deactivate] )) && deactivate

View File

@ -26,6 +26,14 @@ eval "$(pyenv init --path)"
- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
when it finds it.
- `ZSH_THEME_PYENV_NO_SYSTEM`: if set to `true`, the plugin will not show the system or
default Python version when it finds it.
- `ZSH_THEME_PYENV_PREFIX`: the prefix to display before the Python version in
the prompt.
- `ZSH_THEME_PYENV_SUFFIX`: the prefix to display after the Python version in
the prompt.
## Functions
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python

View File

@ -88,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() {
local version="$(pyenv version-name)"
echo "${version:gs/%/%%}"
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]] && [[ "${version}" == "system" ]]; then
return
fi
echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
else
# Fall back to system python
function pyenv_prompt_info() {
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then
return
fi
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
echo "system: ${version:gs/%/%%}"
echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
fi

17
plugins/pypi/README.md Normal file
View File

@ -0,0 +1,17 @@
# pypi plugin
A plugin which contains quick memorable aliases for the commands available while uploading own packages in [pypi](https://pypi.org/)
To access this plugin, add the parameter `pypi` to the plugins array of your zshrc file:
```
plugins=(... pypi)
```
## Aliases
| Alias Command | Original Command | Description |
|------------------------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| `pypi-check` | `pip3 install twine setuptools` | Used to check the required libraries to upload a package in pypi |
| `pypi-ltest` | `python3 setup.py sdist && python3 -m pip install dist/*` | Used to install setup.py file to local machine for testing before uploading into pypi. |
| `pypi-tupload` | `python3 setup.py sdist && twine upload --repository testpypi dist/*` | Used to upload a python package to testpypi for testing |
| `pypi-upload` | `python3 setup.py sdist && twine upload dist/*` | Used to upload a python package to pypi. |

View File

@ -0,0 +1,6 @@
alias pypi-check='python3 -m pip install twine setuptools'
alias pypi-ltest='python3 setup.py sdist && python3 -m pip install dist/*'
alias pypi-tupload='python3 setup.py sdist && twine upload --repository testpypi dist/*'
alias pypi-upload='python3 setup.py sdist && twine upload dist/*'

View File

@ -22,5 +22,5 @@ fi
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo
source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
EOF

View File

@ -1,4 +1,4 @@
if (( ! $+commands[tailscale] )); then
if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then
return
fi
@ -7,7 +7,12 @@ fi
if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
typeset -g -A _comps
autoload -Uz _tailscale
_comps[tailscale]=_tailscale
if (( $+commands[tailscale] )); then
_comps[tailscale]=_tailscale
elif (( $+aliases[tailscale] )); then
_comps[${aliases[tailscale]:t}]=_tailscale
fi
fi
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|

9
plugins/timoni/README.md Normal file
View File

@ -0,0 +1,9 @@
# Timoni plugin
This plugin adds completion for [Timoni](https://timoni.sh), a package manager for Kubernetes, powered by CUE and inspired by Helm.
To use it, add `timoni` to the plugins array in your zshrc file:
```zsh
plugins=(... timoni)
```

View File

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

9
plugins/vault/README.md Normal file
View File

@ -0,0 +1,9 @@
# Vault plugin
This plugin adds completion for [Vault](https://www.vaultproject.io/), the secrets and sensitive data manager.
To use it, add `vault` to the plugins array in your zshrc file:
```zsh
plugins=(... vault)
```

View File

@ -0,0 +1,7 @@
# Completion
if (( ! $+commands[vault] )); then
return
fi
autoload -Uz bashcompinit && bashcompinit
complete -o nospace -C vault vault

View File

@ -8,7 +8,7 @@
# @github.com/mfaerevaag/wd
# version
readonly WD_VERSION=0.9.1
readonly WD_VERSION=0.9.2
# colors
readonly WD_BLUE="\033[96m"
@ -145,14 +145,17 @@ wd_warp()
else
(( n = $#1 - 1 ))
cd -$n > /dev/null
WD_EXIT_CODE=$?
fi
elif [[ ${points[$point]} != "" ]]
then
if [[ $sub != "" ]]
then
cd ${points[$point]/#\~/$HOME}/$sub
WD_EXIT_CODE=$?
else
cd ${points[$point]/#\~/$HOME}
WD_EXIT_CODE=$?
fi
else
wd_exit_fail "Unknown warp point '${point}'"
@ -185,11 +188,11 @@ wd_add()
elif [[ ${points[$point]} == "" ]] || [ ! -z "$force" ]
then
wd_remove "$point" > /dev/null
printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> "$WD_CONFIG"
printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> "$wd_config_file"
if (whence sort >/dev/null); then
local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
# use 'cat' below to ensure we respect $WD_CONFIG as a symlink
command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" >| "$WD_CONFIG" && command rm "${config_tmp}"
# use 'cat' below to ensure we respect $wd_config_file as a symlink
command sort -o "${config_tmp}" "$wd_config_file" && command cat "${config_tmp}" >| "$wd_config_file" && command rm "${config_tmp}"
fi
wd_export_static_named_directories
@ -240,7 +243,7 @@ wd_remove()
then
local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
# Copy and delete in two steps in order to preserve symlinks
if sed -n "/^${point_name}:.*$/!p" "$WD_CONFIG" >| "$config_tmp" && command cp "$config_tmp" "$WD_CONFIG" && command rm "$config_tmp"
if sed -n "/^${point_name}:.*$/!p" "$wd_config_file" >| "$config_tmp" && command cp "$config_tmp" "$wd_config_file" && command rm "$config_tmp"
then
wd_print_msg "$WD_GREEN" "Warp point removed"
else
@ -257,7 +260,7 @@ wd_browse() {
echo "This functionality requires fzf. Please install fzf first."
return 1
fi
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$WD_CONFIG" | awk -F ':' '{print $1 " -> " $2}')}")
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$wd_config_file" | awk -F ':' '{print $1 " -> " $2}')}")
local script_path="${${(%):-%x}:h}"
local wd_remove_output=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
entries=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
@ -275,7 +278,7 @@ wd_browse() {
}
wd_browse_widget() {
if [[ -e $WD_CONFIG ]]; then
if [[ -e $wd_config_file ]]; then
wd_browse
saved_buffer=$BUFFER
saved_cursor=$CURSOR
@ -298,7 +301,7 @@ wd_list_all()
{
wd_print_msg "$WD_BLUE" "All warp points:"
entries=$(sed "s:${HOME}:~:g" "$WD_CONFIG")
entries=$(sed "s:${HOME}:~:g" "$wd_config_file")
max_warp_point_length=0
while IFS= read -r line
@ -398,7 +401,7 @@ wd_clean() {
count=$((count+1))
fi
fi
done < "$WD_CONFIG"
done < "$wd_config_file"
if [[ $count -eq 0 ]]
then
@ -406,7 +409,7 @@ wd_clean() {
else
if [ ! -z "$force" ] || wd_yesorno "Removing ${count} warp points. Continue? (y/n)"
then
echo "$wd_tmp" >! "$WD_CONFIG"
echo "$wd_tmp" >! "$wd_config_file"
wd_print_msg "$WD_GREEN" "Cleanup complete. ${count} warp point(s) removed"
else
wd_print_msg "$WD_BLUE" "Cleanup aborted"
@ -417,7 +420,7 @@ wd_clean() {
wd_export_static_named_directories() {
if [[ ! -z $WD_EXPORT ]]
then
command grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read -r warpdir ; do
command grep '^[0-9a-zA-Z_-]\+:' "$wd_config_file" | sed -e "s,~,$HOME," -e 's/:/=/' | while read -r warpdir ; do
hash -d "$warpdir"
done
fi
@ -442,16 +445,19 @@ then
echo "wd version $WD_VERSION"
fi
# set the config file from variable or default
typeset wd_config_file=${WD_CONFIG:-$HOME/.warprc}
if [[ ! -z $wd_alt_config ]]
then
WD_CONFIG=$wd_alt_config[2]
# prefer the flag if provided
wd_config_file=$wd_alt_config[2]
fi
# check if config file exists
if [ ! -e "$WD_CONFIG" ]
if [ ! -e "$wd_config_file" ]
then
# if not, create config file
touch "$WD_CONFIG"
touch "$wd_config_file"
else
wd_export_static_named_directories
fi
@ -473,7 +479,7 @@ do
val=${(j,:,)arr[2,-1]}
points[$key]=$val
done < "$WD_CONFIG"
done < "$wd_config_file"
# get opts
args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,path:,help,show -- $*)
@ -484,11 +490,11 @@ then
wd_print_usage
# check if config file is writeable
elif [ ! -w "$WD_CONFIG" ]
elif [ ! -w "$wd_config_file" ]
then
# do nothing
# can't run `exit`, as this would exit the executing shell
wd_exit_fail "\'$WD_CONFIG\' is not writeable."
wd_exit_fail "\'$wd_config_file\' is not writeable."
else
# parse rest of options
@ -572,8 +578,10 @@ unset wd_print_msg
unset wd_yesorno
unset wd_print_usage
unset wd_alt_config
unset wd_config_file
unset wd_quiet_mode
unset wd_print_version
unset wd_force_mode
unset wd_export_static_named_directories
unset wd_o

View File

@ -52,6 +52,7 @@ Available search contexts are:
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
| `chatgpt` | `https://chatgpt.com/?q=` |
| `reddit` | `https://www.reddit.com/search/?q=` |
| `ppai` | `https://www.perplexity.ai/search/new?q=` |
Also there are aliases for bang-searching DuckDuckGo:

View File

@ -33,6 +33,7 @@ function web_search() {
gopkg "https://pkg.go.dev/search?m=package&q="
chatgpt "https://chatgpt.com/?q="
reddit "https://www.reddit.com/search/?q="
ppai "https://www.perplexity.ai/search/new?q="
)
# check whether the search engine is supported
@ -87,6 +88,7 @@ alias packagist='web_search packagist'
alias gopkg='web_search gopkg'
alias chatgpt='web_search chatgpt'
alias reddit='web_search reddit'
alias ppai='web_search ppai'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018-2023 Alexandros Kozak
Copyright (c) 2018-2024 Alexandros Kozak
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -6,15 +6,15 @@
![Zsh-z demo](img/demo.gif)
Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using `cd`.
Zsh-z is a command-line tool that allows you to jump quickly to directories that you have visited frequently or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. Based on this data, it predicts where you want to go when you type a partial string. For example, `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how long you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need to if you were using `cd`.
Zsh-z is a native Zsh port of [rupa/z](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
Zsh-z is a native Zsh port of [`rupa/z`](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. `rupa/z` was my most used command-line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
There is a noteworthy stability increase as well. Race conditions have always been a problem with `rupa/z`, and users of that utility will occasionally lose their `.z` databases. By having Zsh-z only use Zsh (`rupa/z` uses a hybrid shell code that works on `bash` as well), I have been able to implement a `zsh/system`-based file-locking mechanism similar to [the one @mafredri once proposed for `rupa/z`](https://github.com/rupa/z/pull/199). It is now nearly impossible to crash the database, even through extreme testing.
There is also a significant stability improvement. Race conditions have always been a problem with `rupa/z`, and users of that utility occasionally lose their `~/.z` databases. By having Zsh-z only use Zsh (`rupa/z` uses a hybrid shell code standard that works on `bash` as well), I have been able to implement a `zsh/system`-based file-locking mechanism similar to [the one @mafredri once proposed for `rupa/z`](https://github.com/rupa/z/pull/199). It is now nearly impossible to crash the database.
There are other, smaller improvements which I try to document in [Improvements and Fixes](#improvements-and-fixes). These include the new default behavior of sorting your tab completions by frecency rather than just letting Zsh sort the raw results alphabetically (a behavior which can be restored if you like it -- [see below](#settings)).
There are other, smaller improvements which I document below in [Improvements and Fixes](#improvements-and-fixes). For instance, tab completions are now sorted by frecency by default rather than alphabetically (the latter behavior can be restored if you like it -- [see below](#settings)).
Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same database (`~/.z`), so you can go on using `rupa/z` when you launch `bash`.
Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same database (`~/.z`, or whatever database file you specify), so you can go on using `rupa/z` when you launch `bash`.
## Table of Contents
- [News](#news)
@ -37,13 +37,13 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- August 24, 2023
+ Zsh-z will now run when `setopt NO_UNSET` has been enabled (props @ntninja).
- August 23, 2023
+ Better logic for loading `zsh/files` (props @z0rc)
+ Better logic for loading `zsh/files` (props @z0rc).
- August 2, 2023
+ Zsh-z still uses the `zsh/files` module when possible, but will fall back on the standard `chown`, `mv`, and `rm` commands in its absence.
+ Zsh-z still uses the `zsh/files` module when possible but will fall back on the standard `chown`, `mv`, and `rm` commands in its absence.
- April 27, 2023
+ Zsh-z now allows the user to specify the directory-changing command using the `ZSHZ_CD` environment variable (default: `builtin cd`; props @basnijholt).
- January 27, 2023
+ If the datafile directory specified by `ZSHZ_DATA` or `_Z_DATA` does not already exist, create it (props @mattmc3).
+ If the database file directory specified by `ZSHZ_DATA` or `_Z_DATA` does not already exist, create it (props @mattmc3).
- June 29, 2022
+ Zsh-z is less likely to leave temporary files sitting around (props @mafredri).
- June 27, 2022
@ -69,7 +69,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
+ Fixed the explanation string printed during completion so that it may be formatted with `zstyle`.
+ Zsh-z now declares `ZSHZ_EXCLUDE_DIRS` as an array with unique elements so that you do not have to.
- July 29, 2021
+ Temporarily disabling use of `print -v`, which seems to be mangling CJK multibyte strings.
+ Temporarily disabling the use of `print -v`, which was mangling CJK multibyte strings.
- July 27, 2021
+ Internal escaping of path names now works with older versions of ZSH.
+ Zsh-z now detects and discards any incomplete or incorrectly formatted database entries.
@ -102,7 +102,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- December 22, 2020
+ `ZSHZ_CASE`: when set to `ignore`, pattern matching is case-insensitive; when set to `smart`, patterns are matched case-insensitively when they are all lowercase and case-sensitively when they have uppercase characters in them (a behavior very much like Vim's `smartcase` setting).
+ `ZSHZ_KEEP_DIRS` is an array of directory names that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted).
+ Symlinked datafiles were having their symlinks overwritten; this bug has been fixed.
+ Symlinked database files were having their symlinks overwritten; this bug has been fixed.
</details>
@ -118,7 +118,7 @@ For tab completion to work, `_zshz` *must* be in the same directory as `zsh-z.pl
autoload -U compinit; compinit
in your .zshrc somewhere below where you source `zsh-z.plugin.zsh`.
in your `.zshrc` somewhere below where you source `zsh-z.plugin.zsh`.
If you add
@ -188,7 +188,7 @@ Add a backslash to the end of the last line add `'zsh-z'` to the list, e.g.,
Then relaunch `zsh`.
### For [zcomet](https://github.com/agkozak/zcomet) users
Simply add
zcomet load agkozak/zsh-z
@ -228,7 +228,7 @@ Add the line
to your `.zshrc`.
`zsh-z` supports `zinit`'s `unload` feature; just run `zinit unload agkozak/zshz` to restore the shell to its state before `zsh-z` was loaded.
Zsh-z supports `zinit`'s `unload` feature; just run `zinit unload agkozak/zsh-z` to restore the shell to its state before Zsh-z was loaded.
### For [Znap](https://github.com/marlonrichert/zsh-snap) users
@ -249,7 +249,7 @@ somewhere above the line that says `zplug load`. Then run
zplug install
zplug load
to install `zsh-z`.
to install Zsh-z.
## Command Line Options
@ -263,9 +263,9 @@ to install `zsh-z`.
- `-x` Remove a directory (by default, the current directory) from the database
- `-xR` Remove a directory (by default, the current directory) and its subdirectories from the database
# Settings
## Settings
Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its behavior if you set them; you can also keep your old ones if you have been using `rupa/z` (they begin with `_Z_`).
Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its behavior if you set them. You can also keep your old ones if you have been using `rupa/z` (whose environment variables begin with `_Z_`).
* `ZSHZ_CMD` changes the command name (default: `z`)
* `ZSHZ_CD` specifies the default directory-changing command (default: `builtin cd`)
@ -324,19 +324,18 @@ A good example might involve a directory tree that has Git repositories within i
(As a Zsh user, I tend to use `**` instead of `find`, but it is good to see how deep your directory trees go before doing that.)
## Other Improvements and Fixes
* `z -x` works, with the help of `chpwd_functions`.
* Zsh-z works on Solaris.
* Zsh-z is compatible with Solaris.
* Zsh-z uses the "new" `zshcompsys` completion system instead of the old `compctl` one.
* There is no error message when the database file has not yet been created.
* There is support for special characters (e.g., `[`) in directory names.
* If `z -l` only returns one match, a common root is not printed.
* Exit status codes increasingly make sense.
* Completions work with options `-c`, `-r`, and `-t`.
* If `~/foo` and `~/foob` are matches, `~/foo` is *not* the common root. Only a common parent directory can be a common root.
* `z -x` and the new, recursive `z -xR` can take an argument so that you can remove directories other than `PWD` from the database.
* No error message is displayed when the database file has not yet been created.
* Special characters (e.g., `[`) in directory names are now supported.
* If `z -l` returns only one match, a common root is not printed.
* Exit status codes are more logical.
* Completions now work with options `-c`, `-r`, and `-t`.
* If `~/foo` and `~/foob` are matches, `~/foo` is no longer considered the common root. Only a common parent directory can be a common root.
* `z -x` and the new, recursive `z -xR` can now accept an argument so that you can remove directories other than `PWD` from the database.
## Migrating from Other Tools
@ -358,7 +357,7 @@ the line
That will re-bind `z` or the command of your choice to the underlying Zsh-z function.
## Known Bugs
## Known Bug
It is possible to run a completion on a string with spaces in it, e.g., `z us bi<TAB>` might take you to `/usr/local/bin`. This works, but as things stand, after the completion the command line reads
z us /usr/local/bin.

View File

@ -4,7 +4,7 @@
#
# https://github.com/agkozak/zsh-z
#
# Copyright (c) 2018-2023 Alexandros Kozak
# Copyright (c) 2018-2024 Alexandros Kozak
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -120,7 +120,6 @@ fi
[[ ${builtins[zf_mv]-} == 'defined' ]] && ZSHZ[MV]='zf_mv'
[[ ${builtins[zf_rm]-} == 'defined' ]] && ZSHZ[RM]='zf_rm'
# Load zsh/system, if necessary
[[ ${modules[zsh/system]-} == 'loaded' ]] || zmodload zsh/system &> /dev/null

View File

@ -13,6 +13,8 @@ function afmagic_dashes {
# the prompt, account for it when returning the number of dashes
if [[ -n "$python_env" && "$PS1" = *\(${python_env}\)* ]]; then
echo $(( COLUMNS - ${#python_env} - 3 ))
elif [[ -n "$VIRTUAL_ENV_PROMPT" && "$PS1" = *${VIRTUAL_ENV_PROMPT}* ]]; then
echo $(( COLUMNS - ${#VIRTUAL_ENV_PROMPT} ))
else
echo $COLUMNS
fi

View File

@ -29,7 +29,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}"
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}"