Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以通过 zle 功能模拟按键?
test (){ BUFFER="sudo $BUFFER" CURSOR=$#BUFFER <??send right-arrow keypress??> } zle -N test bindkey "^f" test
我觉得这将是我视觉问题的解决方案,当我使用缓冲区和光标位置时,我在光标的原始位置上有剩余光标。我认为,如果我能够从测试功能中向终端发送右箭头按键,它将删除它
这适用于 xdotool 包
sudo_ (){ BUFFER="sudo $BUFFER" CURSOR=$#BUFFER xdotool key 0xff53 } zle -N sudo_ bindkey "^f" sudo_