我的问题是如何让我的ghci在我的home和end上做出正确的反应。
我了解到ghci使用haskeline对用户输入做出反应,haskeline的行为在某种程度上是在~/.haskeline中定义的。
长期以来,我一直缺乏对end密钥和ghci的home键的支持。因此,我试图定义自己的~/.haskeline文件。
首先:
bind: a home
bind: b end
keyseq: "a" home
keyseq: "b" end
bind: left home
bind: right end两者的行为都与我按a时的行为一样,然后光标位于最左边,与其他游标相似。
第二:
bind: home a
bind: end b这表明我的ghci似乎完全无视我的home和end新闻。
那么我如何将home和end密钥发送到ghci和haskline
发布于 2015-11-16 02:27:17
默认情况下,这应该可以工作。最有可能的是,Haskeline没有识别键盘作为home和end键发送的内容。这取决于您的操作系统和终端设置。
您可能想要将$TERM设置调整为支持这些键的东西,然后Haskeline应该自动地将它们捡起来。
否则,Haskeline trac wiki就会让它识别未知的密钥序列,它应该在POSIX系统上工作(而不是在home和end默认情况下也应该工作的Windows上)。使其适应目前的情况:
$ ghc -e getLine
<press home, then return>...some noise here...
"...haskell string for home..."
$ ghc -e getLine
<press end, then return>...some other noise...
"...haskell string for end..."向~/.haskeline中添加相应的行
keyseq: your-terminal "...haskell string for home..." home
keyseq: your-terminal "...haskell string for end..." end其中your-terminal是$TERM变量中的任何内容。
发布于 2015-11-16 05:52:16
我目前对Most likely Haskeline isn't recognizing whatever your keyboard sends as the home and end keys. This depends on your OS and terminal setup.不太了解,我今天第一次学到了这个。
但我成功地编写了一个适合我的笔记本电脑的~/.haskeline (Ubuntu14.04,ghc-7.10.2)。
keyseq: "\ESCOH" home
keyseq: "\ESCOF" endhttps://stackoverflow.com/questions/33720430
复制相似问题