Questions tagged [elixir-iex]

Elixir’s interactive shell.

iex is Elixir’s interactive shell, which can be used to interactively run Elixir code from the command line.

150 questions
10
votes
2 answers

Can I customize Elixir iex to exit with ctrl-D?

I know several ways to quit iex but I'd love to use ctrl-D like in other REPLs (e.g., node, irb.) How can I customize iex to do this?
jwfearn
  • 28,781
  • 28
  • 95
  • 122
10
votes
1 answer

Alias all contents of a module/namepsace in IEX

Following the advice in this question regarding how to load iex with the dependencies of the current project I was able to work with phoenix framework dependencies in a pretty productive manner. However, it gets a bit tedious having to provide the…
Graham Conzett
  • 8,344
  • 11
  • 55
  • 94
8
votes
2 answers

How do you get the elixir compiler to show warnings when running a phoenix server?

Running a phoenix server in iex session via mix, like: iex -S mix phx.server Will sometimes give a list of warnings like: Compiling 1 file (.ex) warning: variable "user" is unused lib/app_web/controllers/user_controller.ex:37 But seemingly only…
Laser
  • 5,085
  • 4
  • 34
  • 48
7
votes
1 answer

How do I run `iex -S mix` without compiling changed files?

Say I'm writing a new module, the code isn't ready yet and I want to test something in the repl. I run iex -S mix and it fails because of compilation errors I didn't intend to fix yet. I presume there is a last compiled version of my app that I…
Morozov
  • 2,719
  • 2
  • 21
  • 23
7
votes
1 answer

Phoenix: Requiring IEx in only :dev and :test for entire project

I'm new to Elixir/Phoenix and I was wondering if there was a way to essentially require IEx for the purpose of IEx.pry in the same manner that in Ruby/Rails you can add something like group :test, :development do gem 'pry', require:…
VitaminMarc
  • 193
  • 1
  • 8
7
votes
1 answer

How to avoid ecto logs inside iex?

I have a worker which creates database queries, like that: defmodule MyApp.Periodically do use GenServer def start_link do GenServer.start_link(__MODULE__, %{}) end def init(state) do schedule_work() # Schedule work to be performed…
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
7
votes
1 answer

How to make custom prompt take effect at iex start?

I have a custom prompt but when I launch iex, a builtin prompt shows. After I hit enter my prompt takes effect. How can I make my prompt take effect when iex starts? Here's what I'm seeing: And this is my .iex.exs file: IEx.configure( colors: […
jwfearn
  • 28,781
  • 28
  • 95
  • 122
7
votes
1 answer

How to get Line Numbers in Console Outputs in Elixir

I need to get line numbers for IO.puts or IO.inspect or any other kind of output that appears on elixir console for the purpose of debugging. Is there an in-built feature for this? Or is there any other easy way to achieve the same? P.S: By Line…
Kshitij Mittal
  • 2,698
  • 3
  • 25
  • 40
6
votes
2 answers

How do I list all shell variables in IEx?

I can't figure out how to view my current context in IEx. I want to see a list of all the variable that have been defined in the shell. Is this possible? Thanks.
tadasajon
  • 14,276
  • 29
  • 92
  • 144
6
votes
3 answers

What is the exact meaning of the equal sign in Elixir?

I don't get what exactly means the equal sign in Elixir. What is unclear is that it looks like a mix between assignment and a pattern matching operation. iex(1)> x=4 4 iex(2)> y=5 5 iex(3)> 3=y ** (MatchError) no match of right hand side value:…
Melicerte
  • 118
  • 1
  • 8
6
votes
1 answer

Increase timeout period of Elixir IEx.pry session

I'm trying to increase the timeout period of an IEx.pry session. Specifically, I'my pry-ing in a Phoenix framework unit test. I've added the following to the body of my test: require IEx IEx.pry I looked at the IEx documentation for the pry…
Elliot Larson
  • 10,669
  • 5
  • 38
  • 57
5
votes
1 answer

Is there a vim mode available for `iex`

Is there a vim mode available for iex? That is, something like set -o vi in bash. Here's my version info: IEx 1.13.0 (compiled with Erlang/OTP 24) I'm running it on Linux Mint 20.2 Uma.
Stephen Swensen
  • 22,107
  • 9
  • 81
  • 136
5
votes
2 answers

Get a list of all elixir modules in IEx

To get a list of all functions on a module in IEx I can run: Map.__info__(:functions) # or Enum.__info__(:functions) Using the {Module}.__info__(:functions) format. How can I get a list of all the standard lib modules?
Loading...
  • 863
  • 9
  • 21
5
votes
1 answer

Very basic IEx and IEx.pry from an elixir script gets error: IEx shell running?

I'm working through Dave Thomas' Programming Elixir and I'm attempting some examples from the list chapter. When I'm learning a language I prefer to stay as basic as I can by running