Can't you just use
zsh -f
ack() { command ack "$*" }
ack hey there
or something along these lines?
[...]
Actually I was curious if I could write something along what you described. I have to reckon that my zsh-fu is not enough for it.
To muck with the cursor position, you would normally change the CURSOR
value (see man zshzle
). From within zle widgets you would access special values by using zmodload -i zsh/parameter
(see man zshmodules
). But the trick is that -as stated in the zshzle
man page):
Inside completion widgets and traps called while ZLE is active, these parameters are available read-only.
So we can't change the value of CURSOR
from inside a completion widget.