I have programs which take filename arguments as
scp:path/to/file.ext ark:/abs/path/to/file.ext Is it possible make zsh complete filenames after some keywords followed by colon?
So far, I found how to do it in bash: add : to the COMP_WORDBREAKS variable.
Thanks to Gilles, I manage to work like this.
$ cat ~/.zshrc ... function aftercolon() { if compset -P 1 '*:'; then _files "$expl[@]" else _files "$expl[@]" fi } autoload -Uz compinit compinit compdef aftercolon hello olleh Now in commands hello and olleh, completion after : works as expected.
I think there might be better way since:
I had to odd if/else since the commands also take filename without prefix.
And since I have many commands take this kind of argument, I need to add names of every commands