HOME and END keys don't work in iex

HOME and END keys don’t work in my iex running on Ubuntu 18.04:

iex
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

When the HOME key is pressed, nothing happens.
When the END key is pressed, a ‘~’ is typed.

The ‘Delete’ key works fine.

The same is seen in my Erlang shell.

How to fix it? Thanks.

Hello and welcome,

try ctrl-a and ctrl-e…

Hi kokolegorille,

ctrl-a and ctrl-e work perfectly as HOME and END respectively in my iex as well as my erlang shell, thanks!

Still they are not as convenient as HOME and END keys, is there anything I can tweak to make HOME and END keys work?

They are subset of Emacs shortcuts…

from http://erlang.org/documentation/doc-5.3/doc/getting_started/getting_started.html

Key Sequence Function
C-a Beginning of line
C-b Backward character
M-b Backward word
C-d Delete character
M-d Delete word
C-e End of line
C-f Forward character
M-f Forward word
C-g Enter shell break mode
C-k Kill line
C-l Redraw line
C-n Fetch next line from the history buffer
C-p Fetch previous line from the history buffer
C-t Transpose characters
M-t Transpose words
C-y Insert previously killed text

I think it’s easier to learn some Emacs, than to make HOME and END keys work :slight_smile:

1 Like