This commit is contained in:
pull[bot] 2024-04-26 14:14:33 +00:00 committed by GitHub
commit 623ea8bd5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 47 additions and 24 deletions

View File

@ -33,7 +33,7 @@ jobs:
components: rustfmt
profile: minimal
toolchain: nightly
- uses: cachix/install-nix-action@v25
- uses: cachix/install-nix-action@v26
if: ${{ matrix.os != 'windows-latest' }}
with:
nix_path: nixpkgs=channel:nixos-unstable

View File

@ -96,7 +96,7 @@ jobs:
- name: Create release
if: |
github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)')
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
files: |

View File

@ -7,6 +7,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- zsh: Space-Tab completion repeating output multiple times when matching single
directory
- fish: detect infinite loop when using `alias cd=z`.
- fish / Nushell / PowerShell: handle queries that look like args (e.g. `z -x`).
## [0.9.4] - 2024-02-21
### Changed

View File

@ -99,8 +99,9 @@ zoxide can be installed in 4 easy steps:
> | CentOS 7+ | [Copr] | `dnf copr enable atim/zoxide` <br /> `dnf install zoxide` |
> | ~Debian 11+~[^1] | ~[Debian Packages]~ | ~`apt install zoxide`~ |
> | Devuan 4.0+ | [Devuan Packages] | `apt install zoxide` |
> | Exherbo Linux | [Exherbo packages] | `cave resolve -x repository/rust` <br /> `cave resolve -x zoxide` |
> | Fedora 32+ | [Fedora Packages] | `dnf install zoxide` |
> | Gentoo | [GURU Overlay] | `eselect repository enable guru` <br /> `emerge --sync guru` <br /> `emerge app-shells/zoxide` |
> | Gentoo | [Gentoo Packages] | `emerge app-shells/zoxide` |
> | Manjaro | | `pacman -S zoxide` |
> | openSUSE Tumbleweed | [openSUSE Factory] | `zypper install zoxide` |
> | ~Parrot OS~[^1] | | ~`apt install zoxide`~ |
@ -196,7 +197,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Bash</summary>
> Add this to the **end** of your config file (usually `~/.bashrc`):
> Add this to the <ins>**end**</ins> of your config file (usually `~/.bashrc`):
>
> ```sh
> eval "$(zoxide init bash)"
@ -207,7 +208,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Elvish</summary>
> Add this to the **end** of your config file (usually `~/.elvish/rc.elv`):
> Add this to the <ins>**end**</ins> of your config file (usually `~/.elvish/rc.elv`):
>
> ```sh
> eval (zoxide init elvish | slurp)
@ -221,7 +222,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Fish</summary>
> Add this to the **end** of your config file (usually
> Add this to the <ins>**end**</ins> of your config file (usually
> `~/.config/fish/config.fish`):
>
> ```fish
@ -233,14 +234,14 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Nushell</summary>
> Add this to the **end** of your env file (find it by running `$nu.env-path`
> Add this to the <ins>**end**</ins> of your env file (find it by running `$nu.env-path`
> in Nushell):
>
> ```sh
> zoxide init nushell | save -f ~/.zoxide.nu
> ```
>
> Now, add this to the **end** of your config file (find it by running
> Now, add this to the <ins>**end**</ins> of your config file (find it by running
> `$nu.config-path` in Nushell):
>
> ```sh
@ -255,7 +256,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>PowerShell</summary>
> Add this to the **end** of your config file (find it by running
> Add this to the <ins>**end**</ins> of your config file (find it by running
> `echo $profile` in PowerShell):
>
> ```powershell
@ -267,7 +268,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Xonsh</summary>
> Add this to the **end** of your config file (usually `~/.xonshrc`):
> Add this to the <ins>**end**</ins> of your config file (usually `~/.xonshrc`):
>
> ```python
> execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')
@ -278,7 +279,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Zsh</summary>
> Add this to the **end** of your config file (usually `~/.zshrc`):
> Add this to the <ins>**end**</ins> of your config file (usually `~/.zshrc`):
>
> ```sh
> eval "$(zoxide init zsh)"
@ -293,7 +294,7 @@ zoxide can be installed in 4 easy steps:
<details>
<summary>Any POSIX shell</summary>
> Add this to the **end** of your config file:
> Add this to the <ins>**end**</ins> of your config file:
>
> ```sh
> eval "$(zoxide init posix --hook prompt)"
@ -444,6 +445,7 @@ Environment variables[^2] can be used for configuration. They must be set before
| [vim] / [neovim] | Text editor | [zoxide.vim] |
| [xplr] | File manager | [zoxide.xplr] |
| [xxh] | Transports shell configuration over SSH | [xxh-plugin-prerun-zoxide] |
| [yazi] | File manager | Natively supported |
| [zabb] | Finds the shortest possible query for a path | Natively supported |
| [zsh-autocomplete] | Realtime completions for zsh | Natively supported |
@ -471,6 +473,7 @@ Environment variables[^2] can be used for configuration. They must be set before
[crates.io-badge]: https://img.shields.io/crates/v/zoxide?logo=rust&logoColor=white&style=flat-square
[crates.io]: https://crates.io/crates/zoxide
[debian packages]: https://packages.debian.org/stable/admin/zoxide
[exherbo packages]: https://gitlab.exherbo.org/exherbo/rust/-/tree/master/packages/sys-apps/zoxide
[devuan packages]: https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=zoxide
[downloads-badge]: https://img.shields.io/github/downloads/ajeetdsouza/zoxide/total?logo=github&logoColor=white&style=flat-square
[dports]: https://github.com/DragonFlyBSD/DPorts/tree/master/sysutils/zoxide
@ -481,9 +484,9 @@ Environment variables[^2] can be used for configuration. They must be set before
[fzf-installation]: https://github.com/junegunn/fzf#installation
[fzf-man]: https://manpages.ubuntu.com/manpages/en/man1/fzf.1.html
[fzf]: https://github.com/junegunn/fzf
[gentoo packages]: https://packages.gentoo.org/packages/app-shells/zoxide
[glob]: https://man7.org/linux/man-pages/man7/glob.7.html
[guix]: https://packages.guix.gnu.org/packages/zoxide/
[guru overlay]: https://github.com/gentoo-mirror/guru
[homebrew]: https://formulae.brew.sh/formula/zoxide
[issues]: https://github.com/ajeetdsouza/zoxide/issues/new
[joshuto]: https://github.com/kamiyaa/joshuto
@ -519,6 +522,7 @@ Environment variables[^2] can be used for configuration. They must be set before
[xplr]: https://github.com/sayanarijit/xplr
[xxh-plugin-prerun-zoxide]: https://github.com/xxh/xxh-plugin-prerun-zoxide
[xxh]: https://github.com/xxh/xxh
[yazi]: https://github.com/sxyazi/yazi
[zabb]: https://github.com/Mellbourn/zabb
[zoxide.el]: https://gitlab.com/Vonfry/zoxide.el
[zoxide.vim]: https://github.com/nanotee/zoxide.vim

View File

@ -28,10 +28,16 @@ end
# cd + custom logic based on the value of _ZO_ECHO.
function __zoxide_cd
if set -q __zoxide_loop
builtin echo "zoxide: infinite loop detected"
builtin echo "Avoid aliasing `cd` to `z` directly, use `zoxide init --cmd=cd fish` instead"
return 1
end
{%- if cfg!(windows) %}
__zoxide_cd_internal (cygpath -u $argv)
__zoxide_loop=1 __zoxide_cd_internal (cygpath -u $argv)
{%- else %}
__zoxide_cd_internal $argv
__zoxide_loop=1 __zoxide_cd_internal $argv
{%- endif %}
{%- if echo %}
and __zoxide_pwd
@ -76,7 +82,7 @@ function __zoxide_z
__zoxide_cd -
else if test $argc -eq 1 -a -d $argv[1]
__zoxide_cd $argv[1]
else if set -l result (string replace --regex $__zoxide_z_prefix_regex '' $argv[-1]); and test -n $result
else if set -l result (string replace --regex -- $__zoxide_z_prefix_regex '' $argv[-1]); and test -n $result
__zoxide_cd $result
else
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv)

View File

@ -39,7 +39,7 @@ if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) {
#
# Jump to a directory using only keywords.
def --env __zoxide_z [...rest:string] {
def --env --wrapped __zoxide_z [...rest:string] {
let arg0 = ($rest | append '~').0
let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($arg0 | path expand | path type) == dir) {
$arg0
@ -53,7 +53,7 @@ def --env __zoxide_z [...rest:string] {
}
# Jump to a directory using interactive search.
def --env __zoxide_zi [...rest:string] {
def --env --wrapped __zoxide_zi [...rest:string] {
cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
{%- if echo %}
echo $env.PWD

View File

@ -62,7 +62,7 @@ function global:__zoxide_cd($dir, $literal) {
function global:__zoxide_hook {
$result = __zoxide_pwd
if ($null -ne $result) {
zoxide add -- $result
zoxide add "--" $result
}
}
{%- else if hook == InitHook::Pwd -%}
@ -72,7 +72,7 @@ function global:__zoxide_hook {
$result = __zoxide_pwd
if ($result -ne $global:__zoxide_oldpwd) {
if ($null -ne $result) {
zoxide add -- $result
zoxide add "--" $result
}
$global:__zoxide_oldpwd = $result
}
@ -112,10 +112,10 @@ function global:__zoxide_z {
else {
$result = __zoxide_pwd
if ($null -ne $result) {
$result = __zoxide_bin query --exclude $result -- @args
$result = __zoxide_bin query --exclude $result "--" @args
}
else {
$result = __zoxide_bin query -- @args
$result = __zoxide_bin query "--" @args
}
if ($LASTEXITCODE -eq 0) {
__zoxide_cd $result $true
@ -125,7 +125,7 @@ function global:__zoxide_z {
# Jump to a directory using interactive search.
function global:__zoxide_zi {
$result = __zoxide_bin query -i -- @args
$result = __zoxide_bin query -i "--" @args
if ($LASTEXITCODE -eq 0) {
__zoxide_cd $result $true
}

View File

@ -104,9 +104,12 @@ if [[ -o zle ]]; then
# shellcheck disable=SC2086
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]})" || __zoxide_result=''
# Set a result to ensure completion doesn't re-run
compadd -Q ""
# Bind '\e[0n' to helper function.
\builtin bindkey '\e[0n' '__zoxide_z_complete_helper'
# Send '\e[0n' to console input.
# Sends query device status code, which results in a '\e[0n' being sent to console input.
\builtin printf '\e[5n'
fi
@ -119,6 +122,7 @@ if [[ -o zle ]]; then
if [[ -n "${__zoxide_result}" ]]; then
# shellcheck disable=SC2034,SC2296
BUFFER="{{ cmd }} ${(q-)__zoxide_result}"
__zoxide_result=''
\builtin zle reset-prompt
\builtin zle accept-line
else