Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to simplify the directory completion? #589

Open
azone opened this issue Jul 5, 2023 · 7 comments
Open

Is it possible to simplify the directory completion? #589

azone opened this issue Jul 5, 2023 · 7 comments

Comments

@azone
Copy link

azone commented Jul 5, 2023

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?

@chapmanjacobd
Copy link

chapmanjacobd commented Jul 9, 2023

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

@xfzv
Copy link
Contributor

xfzv commented Aug 16, 2023

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

@xfzv
Copy link
Contributor

xfzv commented Aug 29, 2023

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?

@kontrafiktion
Copy link

kontrafiktion commented Aug 31, 2023

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.

@ivankovnatsky
Copy link

ivankovnatsky commented Sep 4, 2023

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

@hanoii
Copy link

hanoii commented Oct 14, 2023

I would also like this to be at least configurable

@adriangalilea
Copy link

adriangalilea commented Jul 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants