nhpip
Hello,
I wrote the initial version of this library as my first Elixir project a couple of years ago, mostly to learn Elixir, but also a desire to be able to save variable bindings between IEx sessions (especially useful when debugging). When the OTP team re-wrote the shell it caused it to break. I’ve been on a recent mission to fix it and update the code.
It’s still very much beta, but folks are more than welcome to play with it.
Here are the key features:
- Saves IEx shell history between sessions / VM restarts.
- Saves the shell variable bindings between sessions / VM restarts.
- Ability to paste (most) terms into the shell without a screen full of garbage (experimental).
- Navigation keys allow history traversal where multi-line pastes require a single key up/down (instead of up-arrowing every line of whatever was pasted). Unfortunately I had to chose different keys.
- Shortcut functions permit search, pasting, re-evaluation and editing of items in history.
- Editing can be done in-situ or in a text editor.
- Shell variable bindings can be set/get outside of scope of the shell to assist in code debugging.
- Can be enabled and state shared globally, or on individual shell sessions.
I really do some dirty hacks to get the bindings and history, it would be awesome if there was an official way to do that.
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
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
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
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
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
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
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
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
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
garazdawi
The best way to get some official support is to open an issue at the Erlang/OTP github and describe what functionality you would like. Maybe we can design something together that would benefit everyone trying to build fancy shell things.
ken-kost
Tried it out, great stuff.
One note, readme reads:
It’s a little confusing because I needed to add it as dependency, otherwise it wouldn’t work, I got:
So readme maybe could read:
Installation
Add
:iex_history2to the list of dependencies in `mix.exs``:Enable
IExHistory2in.iex.exs:I tried to open a PR for this but I get
remote: Permission to nhpip/iex_history2.git denied to ken-kost.nhpip
Hi,
I just updated the code to allow it to be included in mix as part of another application.
Let me know it works now
Thanks
nhpip
Definitely, let me think it through. The shell is great for 90% of what I need. This project all started because I wanted to save shell variable bindings between VM restarts. It then grew from there.
I don’t want to add work to the core OTP team that only I would ever use, but something like being able to act as a
shimbetweenuser_drvandgroupand also betweengroup_leaderand (in the case of Elixir)iex_server.The shim could then just snoop messages between those processes, block them or modify them.
So as an example of something I just added. If I see a certain struct getting evaluated I intercept a couple of fields and modify them with extra data. So since I rely on
erlang.traceI do something like:Of course this has a couple of problems:
I am more than happy for alternative ideas
Thanks
nhpip
Maybe a behaviour?
garazdawi
If you want to insert yourself between
iex_serverandgroup(i.e. thegroup_leaderofiex_server, then you will have to get a hook intoiex_server. The good thing here is that the protocol used betweeniex_serverandgroupis documented so it should be relatively easy to insert something there if the Elixir team wants to allow it.The protocol inbetween
user_drvandgroupis however not documented and thus we cannot just add something that that snoops inbetween there. What exactly is it that you would like to do there?In this example it seems like you would like to change the behaviour of the shell evaluator. Maybe it is possible to achieve by using a custom iex parser? If not, then that is yet another place in
iex_serverto insert yourself in. We don’t allow doing that in Erlang either, but I could see us adding such a feature if it was requested.nhpip
Thanks, I’ll look into the custom parser
nhpip
The custom parser really helped clean up things. Thanks for the suggestion.
New version available: