如何自定义GHCi的Readline键绑定? [英] How to customize Readline keybindings of GHCi?

查看:106
本文介绍了如何自定义GHCi的Readline键绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道GHCi支持Readline,并且像 ^ W ^ U 这样的键绑定按预期工作。 p>

我想知道ghci是否支持Bash处理inputrc的方式自定义键绑定。

解决方案

你的GHC版本是什么? GHCi停止使用readline,并开始在6.10和 libedit 。 haskell.org/cgi-bin/hackage-scripts/package/haskelinerel =noreferrer> haskeline 在6.12左右。



libedit可以在 〜/ .editrc ;同样,Haskeline有 〜/ .haskeline 。例如,我有

 
#〜/ .editrc(用于libedit)
编辑
bind ^ R em -inc-search-prev
bind ^ S em-inc-search-next
bind ^ [[5〜ed-search-prev-history
bind ^ [[6〜ed-search -next-history

匹配我的

 
#〜/ .inputrc(for readline)
\e [5〜:history-search-backward
\e [6〜:history-search-forward


I know GHCi supports Readline, and keybindings such as ^W and ^U work as expected.

I do wonder whether ghci support customization of keybindings the way Bash deals with inputrc.

解决方案

What is your GHC version? GHCi stopped using readline and started using libedit around 6.10 and haskeline around 6.12.

libedit can be configured in ~/.editrc; similarly, Haskeline has ~/.haskeline. For example, I have

# ~/.editrc (for libedit)
edit on
bind ^R em-inc-search-prev
bind ^S em-inc-search-next
bind ^[[5~ ed-search-prev-history
bind ^[[6~ ed-search-next-history

to match my

# ~/.inputrc (for readline)
"\e[5~": history-search-backward
"\e[6~": history-search-forward

这篇关于如何自定义GHCi的Readline键绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆