From 6679619c00c2ca7381f2ed72b29581a2f2750f2c Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Wed, 19 Mar 2025 06:01:14 +0530 Subject: [PATCH 1/3] bash: rewrite prompt after space-tab --- CHANGELOG.md | 6 ++++++ templates/bash.txt | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 419c5ae..d47ae49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ 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 + +### Changed + +- Bash: zoxide will now rewrite the prompt when using Space-Tab completions. + ## [0.9.7] - 2025-02-10 ### Added diff --git a/templates/bash.txt b/templates/bash.txt index 560a050..a4177a8 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -86,8 +86,6 @@ function __zoxide_doctor() { # When using zoxide with --no-cmd, alias these internal functions as desired. # -__zoxide_z_prefix='z#' - # Jump to a directory using only keywords. function __zoxide_z() { __zoxide_doctor @@ -101,10 +99,6 @@ function __zoxide_z() { __zoxide_cd "$1" elif [[ $# -eq 2 && $1 == '--' ]]; then __zoxide_cd "$2" - elif [[ ${@: -1} == "${__zoxide_z_prefix}"?* ]]; then - # shellcheck disable=SC2124 - \builtin local result="${@: -1}" - __zoxide_cd "{{ "${result:${#__zoxide_z_prefix}}" }}" else \builtin local result # shellcheck disable=SC2312 @@ -144,8 +138,11 @@ function {{cmd}}i() { # - Completions don't work on `dumb` terminals. if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VERSINFO[0]:-0} -ge 5 ]] && [[ :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} != 'dumb' ]]; then - # Use `printf '\e[5n'` to redraw line after fzf closes. - \builtin bind '"\e[0n": redraw-current-line' &>/dev/null + + function __zoxide_z_complete_helper() { + READLINE_LINE="{{ cmd }} ${__zoxide_result@Q}" + READLINE_POINT={{ "${#READLINE_LINE}" }} + } function __zoxide_z_complete() { # Only show completions when the cursor is at the end of the line. @@ -157,12 +154,15 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER \builtin compgen -A directory -- "${COMP_WORDS[-1]}" || \builtin true ) # If there is a space after the last word, use interactive selection. - elif [[ -z ${COMP_WORDS[-1]} ]] && [[ ${COMP_WORDS[-2]} != "${__zoxide_z_prefix}"?* ]]; then - \builtin local result + elif [[ -z ${COMP_WORDS[-1]} ]]; then # shellcheck disable=SC2312 - result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" && - COMPREPLY=("${__zoxide_z_prefix}${result}/") - \builtin printf '\e[5n' + __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" && { + \builtin bind '"\e[0n": redraw-current-line' + \builtin printf '\e[5n' + + \builtin bind -x '"\e[0n": __zoxide_z_complete_helper "${result}"' + \builtin printf '\e[5n' + } fi } From 8118af567c49a3b14a7ed150e08d7a562569f415 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Thu, 20 Mar 2025 11:46:13 +0530 Subject: [PATCH 2/3] Update integrations --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0893a2..3c7f043 100644 --- a/README.md +++ b/README.md @@ -461,14 +461,17 @@ Environment variables[^2] can be used for configuration. They must be set before | [lf] | File manager | See the [wiki][lf-wiki] | | [nnn] | File manager | [nnn-autojump] | | [ranger] | File manager | [ranger-zoxide] | +| [rfm] | File manager | Natively supported | +| [sesh] | `tmux` session manager | Natively supported | | [telescope.nvim] | Fuzzy finder for Neovim | [telescope-zoxide] | -| [t] | `tmux` session manager | Natively supported | | [tmux-session-wizard] | `tmux` session manager | Natively supported | +| [tmux-sessionx] | `tmux` session manager | Natively supported | | [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 | +| [zesh] | `zellij` session manager | Natively supported | | [zsh-autocomplete] | Realtime completions for zsh | Natively supported | [^1]: @@ -528,15 +531,17 @@ Environment variables[^2] can be used for configuration. They must be set before [ranger]: https://github.com/ranger/ranger [raspbian packages]: https://archive.raspbian.org/raspbian/pool/main/r/rust-zoxide/ [releases]: https://github.com/ajeetdsouza/zoxide/releases +[rfm]: https://github.com/dsxmachina/rfm [scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json +[sesh]: https://github.com/joshmedeski/sesh [slackbuilds]: https://slackbuilds.org/repository/15.0/system/zoxide/ [slackbuilds-howto]: https://slackbuilds.org/howto/ [solus packages]: https://github.com/getsolus/packages/tree/main/packages/z/zoxide/ -[t]: https://github.com/joshmedeski/t-smart-tmux-session-manager [telescope-zoxide]: https://github.com/jvgrootveld/telescope-zoxide [telescope.nvim]: https://github.com/nvim-telescope/telescope.nvim [termux]: https://github.com/termux/termux-packages/tree/master/packages/zoxide [tmux-session-wizard]: https://github.com/27medkamal/tmux-session-wizard +[tmux-sessionx]: https://github.com/omerxx/tmux-sessionx [tutorial]: contrib/tutorial.webp [ubuntu packages]: https://packages.ubuntu.com/jammy/zoxide [vim]: https://github.com/vim/vim @@ -547,6 +552,7 @@ Environment variables[^2] can be used for configuration. They must be set before [xxh]: https://github.com/xxh/xxh [yazi]: https://github.com/sxyazi/yazi [zabb]: https://github.com/Mellbourn/zabb +[zesh]: https://github.com/roberte777/zesh [zoxide.el]: https://gitlab.com/Vonfry/zoxide.el [zoxide.vim]: https://github.com/nanotee/zoxide.vim [zoxide.xplr]: https://github.com/sayanarijit/zoxide.xplr From 2480ed085304b452f0fb4771d87c232998e48bbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 11:47:18 +0530 Subject: [PATCH 3/3] Bump cachix/cachix-action from 15 to 16 (#1018) Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 15 to 16. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v15...v16) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c044cba..6370409 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: if: ${{ matrix.os != 'windows-latest' }} with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v15 + - uses: cachix/cachix-action@v16 if: ${{ matrix.os != 'windows-latest' && env.CACHIX_AUTH_TOKEN != '' }} with: authToken: ${{ env.CACHIX_AUTH_TOKEN }}