绑定到 Fish shell 中某个键的函数需要我按回车键,如何避免这种情况?

Function bound to a key in Fish shell requires me to press enter, how to avoid that?

我有以下鱼shell函数

# gohome.fish
function gohome
    cd ~
end

当我用 bind \eg gohome 绑定它并按 Alt+G 时,我仍然必须按 enter 键才能调用它。是否可以按Alt+G立即执行gohome?

When I bind it with bind \eg gohome and press Alt+G I still have to press enter to invoke it.

你不知道。一键执行该功能

发生的情况是您的提示未重新绘制以更新当前目录,而按 enter 键会触发该提示。

中做commandline -f repaint
bind \eg 'gohome; commandline -f repaint'

或者在函数中。