Repository: marlonrichert/zsh-autocomplete

Issue #432: recent-dirs autocomplete with default settings (cdr) not working out-of-the-box as expected
Created: 2022-04-22T22:57:53Z
Environment

apple darwin21.0 /bin/zsh -zsh zsh-5.8-0-g77d203f
/Users/ecereto/src/znap/zsh-snap/functions/.znap.source:26
/Users/ecereto/src/znap/zsh-snap/functions/znap:42
/Users/ecereto/.zshrc:18
d6a0ff5 (grafted, HEAD -> main, origin/main, origin/HEAD) Fix a bug in async list trimming

Operating system: macOS
Terminal emulator: iTerm2

Steps to reproduce

cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
> .zshrc <<EOF
PS1='%# ' PS2= RPS2='%^'; setopt transientrprompt interactivecomments
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d

mkdir -p test1/test2/test3/test4
mkdir -p bla/bla/bla
cd test1/test2/test3
cd ../../../
cd bla/bla/bla
cd ../../../

cd # Wait for autocomplete but recent dirs doesn't show up
> directory
> bla/               test1/             zsh-autocomplete/


cdr
> zsh: command not found: cdr

Should I enable cdr manually? Found very confusing setup instructions and don't want to go down this rabbit hole. I could try to use something else but I'm asking just because the docs say it should work automatically.

Duplicate issue #442: Recent directories completion doesn't work with cdr
Created: 2022-06-02T19:05:57Z
Environment

print $VENDOR $OSTYPE $SHELL $ZSH_ARGZERO $ZSH_PATCHLEVEL
print -l $_autocomplete__funcfiletrace
git -C ~zsh-autocomplete log --oneline -n1

apple darwin21.0 /bin/zsh -zsh zsh-5.8.1-0-g1a490c7
/Users/okuramasafumi/.local/share/zinit/zinit.git/zinit.zsh:1633
/Users/okuramasafumi/.local/share/zinit/zinit.git/zinit.zsh:1271
/Users/okuramasafumi/.local/share/zinit/zinit.git/zinit.zsh:2688
/Users/okuramasafumi/.zshrc:52
5b0073d (HEAD -> main, origin/main, origin/HEAD) Check that `$ZSH_COMPDUMP` file can be read

Operating system: macOS 12.4
Terminal emulator: iTerm2 3.5.0beta5

Customization:
zstyle ':autocomplete:*' insert-unambiguous yes
zstyle ':autocomplete:*' widget-style menu-select
zstyle ':autocomplete:*' fzf-completion yes

Steps to reproduce

cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
> .zshrc <<EOF
PS1='%# ' PS2= RPS2='%^'; setopt transientrprompt interactivecomments
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d

% mkdir one
% cd one
% cd
% cd
directory
one/               zsh-autocomplete/

Description
I enable cdr with the code below:
if is-at-least 4.3.11; then
  autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
  add-zsh-hook -Uz chpwd chpwd_recent_dirs
  zstyle ":chpwd:*" recent-dirs-max 500
  zstyle ":chpwd:*" recent-dirs-defalut true
  zstyle ":completion:*" recent-dirs-insert always
fi
I'm sure cdr works since running cdr command prints correct directories.
However, typing cd just prints directory candidates only, not recent dirs.
I debugged it and found that _autocomplete.recent_paths() function in functions/completion/_autocomplete.recent_paths file is called but no paths were added. $_comp_tags was empty so I suspect it might be a cause.

Closing comment (2022-06-03T12:47:19Z): Duplicate of #432.