How can I make Arch Linux show the names of packages in the bash command not found error?

On my Linux Mint systems, when I type a command that is not found but is available from a package in the Ubuntu or Mint repositories, the command not found error message includes the names of the package[s] providing the command.

kj7rrv@thinkpad:~$ emacs
Command 'emacs' not found, but can be installed with:
sudo apt install e3           # version 1:2.82+dfsg-2, or
sudo apt install emacs-gtk    # version 1:29.1+1-5ubuntu1
sudo apt install emacs-lucid  # version 1:29.1+1-5ubuntu1
sudo apt install emacs-nox    # version 1:29.1+1-5ubuntu1
sudo apt install emacs-pgtk   # version 1:29.1+1-5ubuntu1
sudo apt install jove         # version 4.17.5.3-1
kj7rrv@thinkpad:~$ 

On Arch Linux, however, I simply get the standard error message from bash.

[kj7rrv@tablet ~]$ emacs
bash: emacs: command not found
[kj7rrv@tablet ~]$

Is there a way to get a pacman-based equivalent of the Linux Mint message on Arch Linux? For a general idea, I’m looking for something like this, but the format doesn’t have to match.

[kj7rrv@tablet ~]$ emacs
Command 'emacs' not found, but can be installed with:
sudo pacman -S emacs  # version 30.2-1
...
[kj7rrv@tablet ~]$

If AUR integration using a helper such as paru is available, that would be ideal, but only handling the main repositories would be fine too.

Read more here: Source link