admin管理员组

文章数量:1193188

How can I include redirects in $words for zsh completions or do something equivalent?

If it cannot be done for $words, I know that I can use ${(z)BUFFER} to parse the full command line into an array. While that will include redirects from the command, it will also include separate commands from the same command line (command1 ; command2), pipes (command1 | command2), and possibly other things that are normally filtered out of $words.

As a bonus, is there any way to specify whether other commands, pipes, etc. will be included in $words?

If I cannot do this in $words, please let me know if there is some easier way to get redirects in an array with the rest of the current command (excluding other commands, pipes, etc.) than manually filtering out other commands, pipes, etc. from ${(z)BUFFER} (maybe there's a helper function that can do it; maybe there's another variable that zsh will populate; etc.).

本文标签: Include redirects in words for zsh completions or equivalentStack Overflow