iex enhancement: make Home and End keys work

50 views
Skip to first unread message

Fernando Canizo

unread,
Jul 16, 2023, 9:58:07 PM7/16/23
to elixir-lang-core
Request (TL;DR):

Please add support for Home and End keys in `iex` shell.

I know one can use CTRL-A and CTRL-E respectively, however I believe that having those keys working as expected is a good addition to the developer experience.

Context (you can omit this):

While looking for a way to configure `iex` properly to make Home and End keys work, came across this post from Elixir Forum: https://elixirforum.com/t/home-and-end-keys-dont-work-in-iex/31563 where the reply from _kokolegorille_ says: "I think it’s easier to learn some Emacs, than to make HOME and END keys work".

Which got me thinking, cause... How hard can it be to add a couple of new mappings? So I went looking for iex configuration documentation and didn't find anything related to key mappings.

I downloaded Elixir source code and grepped around for several possible terms. But got nothing.

Skimmed through all files under `lib/iex/lib/iex` and found a comment on `server.ex` saying: "Starts IEx to run directly from the Erlang shell."

Then I thought: "Maybe that's why _kokolegorille_ implied it was a hard task, cause you have to work it upstream.

I went to check Erlang shell code then, and I found this PR: https://github.com/erlang/otp/pull/794 saying that in Oct 2015 the keys are already working on Erlang shell.

Now I'm puzzled, because if they work there and `iex` is just an Erlang shell underneath, then those keys should work.

I installed Erlang and started `erl` to see that Home and End aren't working there.

So now I'm completely lost and came here to see if someone can walk me through the inner workings of keys in `iex` and see if there's a solution for this issue.

José Valim

unread,
Jul 17, 2023, 2:28:41 AM7/17/23
to elixir-l...@googlegroups.com
If someone submits a PR for Erlang/OTP, they will automatically work for Elixir, so please go down that road. :)

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/fc833068-a689-46d5-8544-f7d7b41daae0n%40googlegroups.com.

Fernando Canizo

unread,
Jul 17, 2023, 5:57:08 PM7/17/23
to elixir-l...@googlegroups.com
My bad. `Home` and `End` keys already work both under Erlang shell `erl` and Elixir shell `iex`. But seems to be dependent on the terminal emulator:
- Guake terminal: works fine
- Urxvt: doesn't work

As my main terminal is `urxvt` I thought it was an `iex` problem. Sorry for the noise.




--
Fernando L. Canizo
Reply all
Reply to author
Forward
0 new messages