Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set vi as editor in GHCi

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

.

like image 662

People also ask

How do I get out of Terminal in GHCi?

Quits GHCi. You can also quit by typing control-D at the prompt. Attempts to reload the current target set (see :load ) if any of the modules in the set, or any dependent module, has changed.

How do I run a program in GHCi?

Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)

What does GHCi mean in Haskell?

Introduction. GHCi is GHC's interactive environment, in which Haskell expressions can be interactively evaluated and programs can be interpreted.

How do I quit Haskell REPL?

You can also quit by typing a control-D at the prompt. Attempts to reload the current target set (see :load) if any of the modules in the set, or any dependent module, has changed. Note that this may entail loading new modules, or dropping modules which are no longer indirectly required by the target.


1 Answers

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

like image 178
Levi Pearson Avatar answered Oct 04 '22 14:10

Levi Pearson