soup
How to kill/cancel line input in IEx
Sometimes when poking around in IEx, I will mis-pair a bracket or quote and get “stuck”. This often happens if I mispaste something.
In irb I could always just ctrl-c to basically cancel the current input buffer and put me back in the “root” of the interpreter.
irb(main):002:1* arst(
irb(main):003:1* nieo
irb(main):004:1>
^C
irb(main):002:0>
In IEx I get this
iex(1)> arst(
...(1)> nieo
...(1)>
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
(l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
And from my poking around, a/A quit IEx, c puts me back where I was, p,i,l,v,D,d,k are informational or for killing processes (maybe the current IEx is hidden in there).
Is there a way to just throw out all the current input (short of working out what pair is open and manually closing them all)? I want to retain the rest of my IEx state.
Marked As Solved
michallepicki
#iex:break
Noted in documentation here: https://hexdocs.pm/iex/master/IEx.html#module-expressions-in-iex
Also Liked
axelson
Another alternative (which is what I use) is pressing Ctrl-g i<RET>c<RET> (you can press Ctrl-g h<RET> to get an associated help menu). Sometimes I’ve also used Ctrl-] to close the currently open bracket, but that hasn’t actually come in handy too often for me when I get stuck.
There was a email thread on the Elixir Google group a while back about this, but if I recall correctly changes would have to be made to Erlang’s erl in order to change the Ctrl-c behavior.
Popular in Questions
Other popular topics
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
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









