zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

Is it possible to simplify the directory completion?

Open azone opened this issue 1 year ago • 7 comments

Currently, if I want to cd to any directory, I need to input z keyword<space><tab> to show the list, Is it possible to change to z keyword<tab> or z keyword to show the completions directly?

azone avatar Jul 05 '23 08:07 azone

yeah this happens on fish shell also. strange. I would also expect z keyword<tab>

chapmanjacobd avatar Jul 09 '23 17:07 chapmanjacobd

Agreed, z keyword<tab> would be more convenient.

xfzv avatar Aug 16 '23 18:08 xfzv

Now that I think about it, z keyword<space><tab> makes more sense.

Let's say you're in your $HOME directory. z .<tab> will trigger auto-suggestions for directories starting with a ., like cd .<tab>. If you have a directory named dotfiles, z dot<tab> will trigger auto-completion -> z dotfiles.

This allows to use z instead of cd with auto-completions/suggestions in the current directory.

I guess that's why z keyword<space><tab> is used to query the Zoxide database. It avoids overriding this behavior.

Thoughts?

xfzv avatar Aug 29 '23 19:08 xfzv

I would still prefer to not mix both and to not add the <SPACE> before pressing <TAB> because most other completions I am aware of behave that way.

To me cd and z are different enough that I do not want to use z as a cd replacement.

kontrafiktion avatar Aug 31 '23 15:08 kontrafiktion

I think zlua had this from the beginning, it's a completly essential feature, at least in my workflow.

ivankovnatsky avatar Sep 04 '23 06:09 ivankovnatsky

I would also like this to be at least configurable

hanoii avatar Oct 14 '23 22:10 hanoii

Hello, I would also like to have z tabor z keywordtab rather than spacetab

Also, would like that zienter didn't require enter

In these dotfiles by @sobolevn you can find his solution to this issue, however, it does not work for me, but maybe it'll help someone here and aid the discussion.

external

# === z ===
# https://github.com/ajeetdsouza/zoxide

# `zoxide` has an option to use `fzf` to provide completions natively,
# but it works only for `z NAME<SPACE><TAB>`,
# it does not work for `z NAME<TAB>`.
# So, I have this usecase as a custom completion defined in `.completions`.
eval "$(zoxide init zsh --no-cmd)"

z () {
  # I need this function to setup custom code completion for `zoxide`.
  \__zoxide_z "$@"
}

completions

# complete `zoxide`
_z () {
  # I have a custom completion, because I like `z NAME<TAB>`
  # and not `z NAME<SPACE><TAB>`
  local args
  args="$(zoxide query -a -l)"
  _arguments "1:paths:($args)"
}

compdef _z z

adriangalilea avatar Jul 30 '24 11:07 adriangalilea