nhpip
Hi,
https://github.com/nhpip/history
I wrote an initial version of this a month or 2 ago. I recently improved on it after I crashed my IEx shell at work.
Features:
1 Persist history
2 Persist the shell variable bindings (that get reloaded when you restart)
2 List history
3 Search history
4 Re-execute a command in history
5. Scoping rules
6. Update configuration
I probably broke some rules on how it was implemented, but it works for me. Feel free to play with it…Next on my list is to make it play better with the current IEx history.
Pics attached

Display history
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
Other Trending Topics
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security















Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
nhpip
Added a few improvements:
Will-W
Love a nice bit of code hacking.
Are you aware that you can do the following (in my case in .bashrc) and it will persist history?
export ERL_AFLAGS="-kernel shell_history enabled"Between that and the normal readline shortcuts like ctrl+r I think most of what you’re looking for is built-in.
OTOH, if you’re building it for fun - nice work!
nhpip
Thanks,
The problem withe ctrl+r is that it’s a line history, not a command history. So if, for example, you paste a large list, map or struct into the shell it renders it useless. I use the kernel flags too, but that’s a globally shared view which is fine in some cases, but not always (I also don’t think it includes date etc…plus I haven’t found a nice way to just show the history.
Still, as you said … it’s all for fun
nhpip
OK, latest version:
https://github.com/nhpip/history
In addition to saving history and bindings, this version adds:
Supports for aliasing the History module
Copy/paste a command from history to the shell (so you can edit it)
Use ctrl+u and ctrl+k to move up and down history. Unlike the standard history search with the arrow keys this is command not line based. So, for example:
Paste:
ctrl+u:
nhpip
OK, fixed a bad bug where it would not work on the latest version of Elixir.
dimitarvp
Just now looked at this after I had it in my TODO things to check for 14 months.
I am interested as to why are you recommending to use the
devbuild in your README?Ideally we should just have a script that does something like
mix do deps.get, releaseand then copies the final release to a well-known place and use it from there? Not sure. If you accept PRs I could look into it because I am very interested in niceriexhistory, especially one that’s not line-bound but is working on complete statements that are valid Elixir code.nhpip
OMG please don’t let the code scare you, it was my first personal elixir project after over a decade of Erlang. As for the dev comment, a couple of guys from work tried it and I didn’t want (thinking of work) someone to add it to our product’s deps and pushing it to our AWS EC2 instances. I should probably edit the README. Feel free to do PRs if you want. I warn you that it does some weird back door stuff. One thing I like about it is ability to save shell variable bindings.
dimitarvp
Well, 50/50, I am not sure yet I’d post PRs if you are not willing to further develop this and/or make it more current (or something).
But another question: any clue which exact Erlang module and function to use to browse history? Or is that only for Erlang and
iexuses something differently? Looking atiexsource code didn’t net any insights on a quick look.nhpip
I’m happy to continue to maintain it. Erlang uses the
shellmodule and all history is saved via thedisk_logmodule. However, the OTP team is re-writing a lot of the shell, so that may change. What I do is attach a trace to theiexshell’siex_serverprocess to capture and save events.dimitarvp
Tried to look into this in more detail. Is this the whole meat and potatoes of actually fetching the currently globally known shell history?
Or is there more to it? I executed this in my
iexREPL and it seems to give me all history items indeed. Unfortunately it doesn’t merge multi-line expressions into one…I am aware that the
:shellandIEx.Historymodules allow you to have separate managed histories but I am only interested in the global one. Currently trying to find where exactly on disk is the global Erlang shell history preserved, to no avail so far. I can’t even find any mention of thegroup_historyatom anywhere on erlang.org…