Why is ghci not honouring my .haskeline?

I have, from many years ago, a ~/.haskeline file that let me do command-line editing in GHCi using vi keybindings:

completionType: ListCompletion
editMode: Vi

I’m getting back into this again, and the command-line editing in GHCi seems to be quite…well, odd. I thought it might be something to do with using stack ghci, but even when I run the binary given to me by stack exec -- which ghci (which gives me .stack/programs/x86_64-linux/ghc-tinfo6-9.8.2/bin/ghci) I still have the same issues.

Scrolling through the command history with up and down arrows works, and moving the cursor within a command line with the right and left arrow keys also works. But:

  • Typing Esc followed by k does bring up the previous command line, but apparently leaves me in insert mode: typing k again inserts a k at the start of the line. I need to type Esc, k again to switch to the command before that.
  • Neither l nor Esc,l move the cursor right in the current command line; the former inserts an l character and the latter gives me a visual bell, presumably indicating an error.

The file does seem to be read, since the Emacs-mode commands C-f and C-b to move forward and back in a line do work if I remove editMode: Vi and stop working when I put that line back again.

Am I missing some drastic change about how .haskeline works? The documentation seems to be the same as it was years ago; the UserPreferences page on the Wiki seems to be consistent with what I’m doing.

If it’s not obvious what’s gone wrong here, I’d appreciate hints on how to debug this.

1 Like