ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
20.33k stars 519 forks source link

Interactive mode (space + tab) doesn't appear to be working on macOS #778

Closed ThijmenDam closed 2 months ago

ThijmenDam commented 3 months ago

I have trouble getting the interactive mode to work using the space + tab keyboard shortcut.

For instance, consider the command z <some-dir> followed by a tab. Instead of going into interactive mode, my terminal shows the files/directories under the z <some-dir> command as if I had typed the ls command:

z <some-dir>
dir1 dir2 dir3

I have installed zoxide and fzf according to their installation instructions, i.e. my ~/.zshrc file ends with the following two lines:

eval "$(fzf --zsh)"
eval "$(zoxide init zsh)"

I use a fresh install of macOS 14.4.1.

Does anybody else experience this issue?

ashleybartlett commented 2 months ago

I had also reported this, and think i've found the fix https://github.com/ajeetdsouza/zoxide/pull/785

ajeetdsouza commented 2 months ago

For instance, consider the command z followed by a tab.

z foo<Tab> will give you local directory completions. z foo<Space><Tab> will pull up interactive completions. Are you adding a <Space>?

Also, have you called compinit before initializing zoxide?

ThijmenDam commented 2 months ago

Are you adding a space?

Yes, I use z foo<Space><Tab>

Also, have you called compinit before initializing zoxide?

Should I explicitly call this command in my ~/.zshrc file? Currently, the file looks like this:

eval "$(starship init zsh)"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(zoxide init zsh)"

Do you need any other information?

ajeetdsouza commented 2 months ago

Should I explicitly call this command in my ~/.zshrc file?

Yup. Add this right at the start of your zshrc file:

autoload -Uz compinit
compinit
ThijmenDam commented 2 months ago

Yup. Add this right at the start of your zshrc file:

autoload -Uz compinit
compinit

This has resolved the issue. Thank you very much for the support @ajeetdsouza!

HaskellZhangSong commented 3 days ago

Same issue here, I just use normal oh my zsh, is it possible to use this SPC TAB trick? May I ask what your shell config is? @ThijmenDam

ThijmenDam commented 3 days ago

@HaskellZhangSong output of cat ~/.zshrc:

# necessary for z <path><space><tab> to work
autoload -Uz compinit
compinit

# Pytthon
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init --path)"
fi

# ll command
alias ll='ls -la'

# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

eval "$(starship init zsh)"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(zoxide init zsh)"