2

I'm not a fan of the smart completion system and I just want it to work as in the old days. How do I get zsh to autocomplete in the old way? E.g. autocompleting all commands in my PATH and all files (and directories) in my current dir. I don't want any kind of smart intelligence.

What I have tried:

  • No zle or zstyle configuration commands in my ~/.zshrc file. This results in smart completion, e.g. typing 'cd ' will complete only directories (yes, I want it to be dumb and complete everything, including files)

  • This configuration in .zshrc:

      zle -C complete-file complete-word _generic
      zstyle ':completion:complete-file::::' completer _files
    

    This completes files but command completion is lost.

The documentation is just overwhelming and I can't seem to find any quick hack to just disable the smart completion system alltogether.

Edit:

Running zmodload -L gives me the following result:

$ zmodload -L
zmodload zsh/complete
zmodload zsh/computil
zmodload zsh/main
zmodload zsh/parameter
zmodload zsh/stat
zmodload zsh/terminfo
zmodload zsh/zle
zmodload zsh/zutil

Do I need zsh/complete and zsh/computil for normal completion to work? I'm not running any zmodload commands from my ~/.zshrcf-file and grep -r zmodload /etc/zsh* returns nothing.

I'm running Ubuntu 18.04.2 LTS.

2
  • Do you have some modules like oh-my-zsh loaded? Programmable completion is not turned on by default in the zsh shell...
    – Kusalananda
    Jan 18, 2021 at 10:02
  • I haven't installed oh-my-zsh. I updated my question to include the output of zmodload -L. Jan 18, 2021 at 10:24

1 Answer 1

2

Don't call compinit. That's all you need to do. You might have the call in your .zshrc file, or perhaps another dotfile, or perhaps you source a plugin that calls it. Find out where it gets called and then remove the call. If compinit never gets called, then you'll get the old skool completion system instead.

If you can't find where compinit is called, try running zsh -x 2>zsh.log (exit the shell as soon as you see the prompt) then look for the compinit call in zsh.log

Do I need zsh/complete and zsh/computil for normal completion to work?

Yes, you do need zsh/complete and zsh/computil, if you want any completion at all.

1
  • Thank you so much, that really helped! running "zsh -x 2>zsh.log" helped me to track down the problem to the file /etc/zsh/zshrc. How wonderful it is to have it working in the old way again. :) Jan 19, 2021 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .