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

Ordinary completion with TAB in addition to custom one from SPACE+TAB #484

Closed
alecandido opened this issue Nov 13, 2022 · 4 comments
Closed

Comments

@alecandido
Copy link

alecandido commented Nov 13, 2022

I'm already using fzf-tab for interactive completion, so I appreciate that you do not overwrite with zoxide native interactive completion, keeping it on <SPACE><TAB>.

Still, I would like the same completion list that is available to <SPACE><TAB> to be provided to ordinary ZSH completion if I press just <TAB>.
In this way, I'd be able to use just <TAB> to get interactive completion, in a consistent way with all the other commands (as it was working for fasd, that I was using before).

@alecandido alecandido changed the title Ordinary completion on ZSH Completing with TAB instead of SPACE+TAB Jan 6, 2023
@alecandido alecandido changed the title Completing with TAB instead of SPACE+TAB Ordinary completion with TAB in addition to custom one from SPACE+TAB Jan 6, 2023
@y1rn
Copy link

y1rn commented Jan 14, 2023

I prefer use <TAB> to open query and press <ENTER> cd to dir directly. Is there any setup guide?

@y1rn
Copy link

y1rn commented May 11, 2023

I'm using fzf-tab with follow configuration, looks good:

eval "$(zoxide init zsh --cmd cd)"

__zoxide_z_complete () {
  args=$(zoxide query -l)
  _arguments "1:profiles:($args)"
}
#fzf-tab config
zstyle ':completion:*:__zoxide_z:*' sort false

@ajeetdsouza
Copy link
Owner

@alecandido the good thing about Space+Tab (on the latest zoxide) is that it performs the cd directly instead of simply completing the command.

The way z is designed to be used is:

  • Within a directory, it is a drop-in replacement for the cd command. Early on in this project, I programmed z just to jump, and used cd otherwise - but I found that it was hard to build muscle memory for this. Every time I changed directories, I would have to remind myself to "jump" there. The benefit of a single command to do both is that you quickly learn to always use z.
  • Mostly, when jumping, just a couple of characters tend to be good enough. However, by nature of the tool, queries are ambiguous - so I added a Space+Tab feature so that people could review the list of options before jumping. On the latest version of zoxide, this is a faster workflow than fzf-tab - because fzf doesn't "complete" the command - it directly jumps to the selected directory.

I'd strongly encourage you to try this out on the latest version of zoxide. If you'd still like to program your own completions, you can get them using zoxide query --list <keywords>.

@alecandido
Copy link
Author

In the meanwhile, I started using carapace for the completion, it gave exactly what I wanted (tab completion, and no direct cd on completion selection).

I acknowledge it doesn't have to be necessarily this way, it is highly personal. Thank you very much for your kind reply :)

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

3 participants