[Proposal] persistent history for iex sessions

36 views
Skip to first unread message

Michał Gibowski

unread,
Aug 7, 2020, 2:09:23 PM8/7/20
to elixir-lang-core
Hi,

I come from Scala and I am used to that REPL history is persisted across sessions. So if I close console and open it again within the same project, I can still press arrow key on my keyboard and access commands from the previous session.

The same experience is supported by psql and probably many other tools.

I think it would be great to have this in iex too.

The history would be per project and could be stored in a file called for example .iex.history. I am not sure if it's necessary to place some any to it's size.

What do you think?

Cheers,
Michal Gibowski




Marco Milanesi

unread,
Aug 7, 2020, 2:13:06 PM8/7/20
to elixir-l...@googlegroups.com
Hello,

Not sure if it can be used per project, however if you set the environment variable

ERL_AFLAGS=-kernel shell_history enabled

from your shell, you should have history.

Cheers

--
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/b71f3ed1-3e4c-4f5d-bb3b-262d288ac91co%40googlegroups.com.

Adam Lancaster

unread,
Aug 7, 2020, 2:13:19 PM8/7/20
to elixir-l...@googlegroups.com

Austin Ziegler

unread,
Aug 7, 2020, 4:49:35 PM8/7/20
to elixir-l...@googlegroups.com
You can also save this history to a file (but there’s no easy way to edit the history otherwise):

```
defmodule IexHistory do
  @moduledoc false

  def save_history(filename \\ "iex_history.exs") do
    File.write!(filename, Enum.reverse(:group_history.load()))
  end
end
```

-a



--
Reply all
Reply to author
Forward
0 new messages