Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get zsh to inherit the complete autocompletion?

I have an little shell script (named "run") which redirects all output of a program to /dev/null:

#!/bin/bash
$@ &> /dev/null &
disown +

How can I say zsh that the whole autocompletion shall work for this?

I mean

$ run git com<TAB>

autocomplete to

$ run git commit
like image 382
Ernest Bredar Avatar asked Sep 04 '25 17:09

Ernest Bredar


1 Answers

I was able to make that work by adding:

compdef _command run

to my .zshrc file.

I've based my answer on this bash question. It was worth giving it a try with compdef - surprisingly it worked. As I'm still zsh/autocompletion newbie I cannot explain the inner workings and you should probably go through the documentation or other sources to find more on the topic.

like image 145
cpt-planet Avatar answered Sep 07 '25 18:09

cpt-planet