My question is how to make my ghci react properly on my home and end press.
I learned that ghci use haskeline to react to user input, and haskeline's behavior is partially defined in ~/.haskeline to some extent.
I have being suffering from the lack of support for end key and home key of ghci for a long time. So I tried to define my own ~/.haskeline file.
Firstly:
bind: a home
bind: b end
keyseq: "a" home
keyseq: "b" end
bind: left home
bind: right end
Both behave as when I press a then the cursor to the most left and similarly to others.
Secondly:
bind: home a
bind: end b
It shows that my ghci seems to ignore my home and end press absolutely.
So how could I send home and end key to ghci and haskline?
This should work by default. Most likely Haskeline isn't recognizing whatever your keyboard sends as the
homeandendkeys. This depends on your OS and terminal setup.You might want to adjust your
$TERMsetting to something that supports those keys, after whichHaskelineshould pick them up automatically.Otherwise, the Haskeline trac wiki has a recipe for getting it to recognize unknown key sequences, which should work on POSIX systems (not on Windows, where
homeandendshould also already be working by default). Adapting this to the current case:Add the corresponding lines to
~/.haskeline:where
your-terminalis whatever's in your$TERMvariable.