Zsh alias with argument and autocompletion

February 18, 2020

After trying different alias types (such as in [0] and [1]) I was unable to add an alias with an argument that also worked with autocompletion. Perhaps I skimmed through too quickly. Regardless, I solved this issue as follows:

alias openb='openb(){ xdg-open $1 &! }; openb'

I went through the Zsh docs on functions and tried different approaches and none of them worked with autocompletion. If you could be kind enough to email (ej at this-site-dot-com) or message me in regards the reason of this working, I would appreciate it very much.

This worked on:

$ cat /etc/fedora-release
Fedora release 31 (Thirty One)
$ /bin/zsh --version
zsh 5.7.1 (x86_64-redhat-linux-gnu)


  1. bash alias with argument and autocompletion
  2. 5 Types Of ZSH Aliases You Should Know