简体   繁体   English

fish shell 的自动提示键绑定可以自定义吗?

[英]Can fish shell's autosuggestion keybindings be customized?

There are two keybindings to accept a Fish suggestion: ctrl-f and right arrow.接受 Fish 建议有两个键绑定: ctrl-f和向右箭头。 But these require using pinkies and/or leaving the home row.但是这些需要使用小指和/或离开主行。

I'd rather use something easier to access, like shift+enter .我宁愿使用更容易访问的东西,比如shift+enter Is there a way to configure this?有没有办法配置这个? I couldn't find anything in the docs about changing the keybindings.我在文档中找不到任何关于更改键绑定的内容。

They can, by using the bind command.他们可以通过使用bind命令。 Use bind <sequence> <commands> , eg bind \cg accept-autosuggestion to bind it to control-g.使用bind <sequence> <commands> ,例如bind \cg accept-autosuggestion将它绑定到 control-g。 Stick it somewhere in config.fish (assuming fish >= 3.0.0).将它粘贴在 config.fish 中的某个位置(假设 fish >= 3.0.0)。

To find out what sequence your terminal sends for a key combination (these sadly aren't standardized), use fish_key_reader and press that combination.要找出您的终端为按键组合发送的序列(遗憾的是这些不是标准化的),请使用fish_key_reader并按下该组合。

To find out what commands are bound to a particular combo, use bind <sequence> .要找出哪些命令绑定到特定组合,请使用bind <sequence> Eg bind \cf will print bind --preset \cf forward-char (where --preset means that that's the default binding).例如bind \cf将打印bind --preset \cf forward-char (其中--preset表示这是默认绑定)。

However, shift+enter isn't typically possible, simply because it's not sent by the terminal, so it's unavailable to programs running in them.然而, shift+enter 通常是不可能的,仅仅是因为它不是由终端发送的,所以它对在它们中运行的程序不可用。

bind \e\e  accept-autosuggestion 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM