zoxide
zoxide copied to clipboard
Is it possible to simplify the directory completion?
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?
yeah this happens on fish shell also. strange. I would also expect z keyword<tab>
Agreed, z keyword<tab>
would be more convenient.
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?
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.
I think zlua had this from the beginning, it's a completly essential feature, at least in my workflow.
I would also like this to be at least configurable
Hello, I would also like to have z
tabor z keyword
tab rather than spacetab
Also, would like that zi
enter 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