添加绑定到不自动执行字符串的鱼?

我如何在fish中设置一个键绑定,以便fish在将其附加到命令行后理解不执行绑定字符串,而只是将其作为字符串附加到命令行。

我想设置一个附加的绑定 | less按,即Alt + Y.

似乎默认情况下fish了解自动执行的命令。

即当我在命令行上键入ls然后按Alt + Y它只应该完成命令看起来像这个ls | less ls | less但仍未执行它。

我正在尝试这样的事情

 bind \ey " \| less" 

但鱼不接受我的语法

要在命令行的末尾附加| less,它已经是fish中的默认函数,使用Alt-p

http://fishshell.com/user_doc/index.html#editor

如果您愿意,可以创建一个函数来执行此操作:

 function __fish_less commandline -i -- "|less" end bind \ey __fish_less 

我不确定你是否需要逃避| 做一些测试……

编辑:

关于追加,命令行帮助说:

 * -a or --append do not remove the current commandline, append the specified string at the end of it * -i or --insert do not remove the current commandline, insert the specified string at the current cursor position * -r or --replace remove the current commandline and replace it with the specified string (default) 

所以要追加而不是插入命令,我想你应该使用-a