我有以下鱼壳功能
# gohome.fish
function gohome
cd ~
end
Run Code Online (Sandbox Code Playgroud)
当我绑定它bind \eg gohome并按 Alt+GI 时仍然需要按 Enter 来调用它。是否可以按 Alt+G 立即执行 gohome?
当我用 bind \eg gohome 绑定它并按 Alt+GI 时仍然需要按 Enter 来调用它。
你没有。按键后立即执行该功能。
发生的情况是您的提示没有重新绘制以更新当前目录,而按 Enter 会触发该提示。
这样做commandline -f repaint无论是在
bind \eg 'gohome; commandline -f repaint'
Run Code Online (Sandbox Code Playgroud)
或在函数中。