I’d love to see iex command line supporting vi command line editing

I’d love to see iex command line supporting vi command line editing. It’s painful using iex and having to move the cursor slowly back and forth with the arrow keys. Would be a nice optional feature to add in the future!

2 Likes

FWIW, the basic Emacs movement keys work. Not really what you wanted to hear.

If you use rlwrap you can switch to vi command bindings, but I wouldn’t hold my breath for native support in iex for vi keybindings.

2 Likes

Thanks – I’m going to hold my breath :slight_smile:

2 Likes

This is the top result from google iex vim, so I’m going to append my desire for iex to use an inputrc compatible line editing interface. Coming from ruby a decade ago when there were problems with getting readline available using RVM or rbenv, linedit at least would use setting from .inputrc. I’m unsure if linenoise (from redis created for redis) honors inputrc (vim bindings work in the redis-cli), but it might be worth a look if licenses are still an issue.

4 Likes

It is not a licensing issue, but buried very deep in the Erlang shell code. It order for the erlang shell to use readline, you’d have to largely rewrite it from scratch. Or at least that has been the conclusion of everyone that has taken a serious look at what is required.

https://ferd.ca/repl-a-bit-more-and-less-than-that.html

2 Likes

Just came here to register my wish of an iex vim mode too

Also, in the meantime, what’s the correct way to wrap iex with rlwrap ?
rlwrap iex just does not seem to be workinffg

It’s not the same as native vi commands in iex, but vim-slime lets you quickly “pipe” text from your vim editor to your iex repl.

Usage
Put your cursor over the text you want to send and type:
ctrl-c ctrl-c — the same as slime
(You can just hold ctrl and double-tap c.)
The current paragraph — what would be selected if you typed vip — is automatically selected.
To control exactly what is sent, you can manually select text before calling vim-slime.

1 Like