Is it possible to simulate a keypress from withing zle function?
test (){
BUFFER="sudo $BUFFER"
CURSOR=$#BUFFER
<??send right-arrow keypress??>
}
zle -N test
bindkey "^f" test
I feel it would be a solution to my visual irk, where when I play with buffer and cursor position, I have remnant cursor on the original position of the cursor. I think that if I would be able to send right-arrow keypress to the terminal from within the test function, that it would remove it
this works with xdotool package
sudo_ (){
BUFFER="sudo $BUFFER"
CURSOR=$#BUFFER
xdotool key 0xff53
}
zle -N sudo_
bindkey "^f" sudo_