如何写~/.haskeline,以便ghci或haskeline可以在“home”和“end”上正常运行



我的问题是如何让我的ghci在我的homeend新闻中做出正确的反应。

我了解到ghci使用haskeline来对用户输入做出反应,并且haskeline的行为在某种程度上在~/.haskeline中得到了部分定义。

长期以来,我一直在遭受对

end密钥和home密钥的支持ghci的困扰。所以我尝试定义自己的~/.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按压。

那么我怎样才能homeend钥匙发送给ghcihaskline呢?

默认情况下应该可以工作。很可能Haskeline无法识别键盘发送的任何home键和end键。这取决于您的操作系统和终端设置。

您可能希望将$TERM设置调整为支持这些键的设置,之后Haskeline应该自动拾取它们

否则,Haskeline trac wiki 有一个让它识别未知键序列的方法,它应该在 POSIX 系统上工作(而不是在 Windows 上,默认情况下homeend也应该已经工作了(。根据当前情况进行调整:

$ 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变量中的任何内容。

我目前对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(Ubuntu 14.04,ghc-7.10.2(。

keyseq: "ESCOH" home
keyseq: "ESCOF" end

相关内容

最新更新