23

How can I get vi editing mode to work in GHCi?

I'm using version 7.10.3.

I tried Prelude> :set editor vi, but to no effect.

I also have these lines in my ~/.inputrc.

set editing-mode vi
set keymap vi

.

2 Answers2

35

GHCi now uses the Haskeline library for command line editing (which has been true for quite a while now), and it does indeed have a vi mode. The configuration file is ~/.haskeline and the line you want is:

editMode: Vi

Documented here: https://github.com/judah/haskeline/wiki/UserPreferences

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
Levi Pearson
  • 4,884
  • 1
  • 16
  • 15
  • I've just started using it and I noticed that the `;` and `,` commands to repeat `f` or `F` commands in one or the other direction do not work... – Enlico Nov 13 '19 at 19:08
  • 1
    [Issue #60](https://github.com/judah/haskeline/issues/60) on GitHub is just about this. – Enlico Nov 13 '19 at 19:37
0

This works without any issues on MacOS with The Glorious Glasgow Haskell Compilation System, version 9.4.3

ghci> :set editor vi
ghci> :edit <yourfilename>
tanvi
  • 27
  • 4