LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Z shell tab completion: Is it possible to define a new "pre-command"? (https://www.linuxquestions.org/questions/linux-general-1/z-shell-tab-completion-is-it-possible-to-define-a-new-pre-command-4175429944/)

kaiserkarl13 10-01-2012 03:33 PM

Z shell tab completion: Is it possible to define a new "pre-command"?
 
I am trying to write a zstyle ":completion:*" or similar rule that completes command names upon tab completion, similar to the pre-defined rules for commands like nice, nohup, exec, or sudo.

The commands in this case are those for MPI programs; for example, let's say that
Code:

mpiexec -n 4 my_[TAB]
would expand to
Code:

mpiexec -n 4 my_program
assuming my_program existed and could be found in the current hash table from $PATH.

I tried
Code:

compdef "_precommand" mpiexec
but that only completes commands if you leave out the "-n 4" in the above example.

I'm hoping it's something like,
Code:

zstyle ":completion:*:mpiexec:argument-3:" commands
Thanks!


All times are GMT -5. The time now is 12:56 PM.