nhpip
IExHistory2 - improved history, save variable bindings from the IEx shell and more...
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
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly.
One of i...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Other Trending Topics
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance










First 8 of 8 Posts
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: