Awscli autocompletion not working in zsh

The auto-completion for awscli commands is not working. I am using zsh with oh-my-zsh enabled and the aws plugin.

$ nixos-version 
19.09pre180443.4dd5c93998d (Loris)
$ nix-channel --list 
zsh = {
  enable = true;
  enableCompletion = true;
  ohMyZsh = {
      enable = true;
      theme = "steeef";
      plugins = [ "z" "aws" ];
$ aws --version
aws-cli/1.16.106 Python/2.7.16 Linux/4.19.44 botocore/1.12.96

Trying to debug the issue I have checked what other packages do for adding auto-completion. It looks like all of them are moving the auto-completion scripts to $out/share/zsh/site-functions. And somehow all the folders are available to zsh via $FPATH. I can see many directories in my $FPATH, but none about awscli.

Any help would be much appreciated. I have looked for similar issues in Github with no luck. Am I misconfiguring something?

1 Like

I had similar problem, but with docker. I had docker dir in my $FPATH but docker completion didn’t work. I’ve disabled ohMyZsh entirely in the config and completion started to work, not from ohMyZsh plugins.

I think there is some problem with ohMyZsh. But I don’t know what exactly. I wont investigate this since I stop using it. I switched to POWERLEVEL9K for prompt bells and whistles, and the only thing that I need from ohMyZsh is substring history search, which I’ve installed from the package.

I’m having the same issue.
Also with ohMyZsh. Have you found a solution? Is there an issue to track this? Do we know the reason?

I haven’t debugged the problem further, I stopped using ohMyZsh. I don’t think there is an issue.

there is a shell completion script for zsh packaged with awscli, if it’s not working, then the issue is that it’s not being invoked (at least on master)

$ tree ./result/share/
└── zsh
    └── site-functions

I figured out how to solve my problem:

It turns out that you need to let home-manager generate the correct .zshrc for you

so you need to make sure that you have

programs.zsh.enable = true;

in your home manager configuration.