IEx.configure

You're seeing just the function configure, go back to IEx module for more information.

Specs

configure(keyword()) :: :ok

Configures IEx.

The supported options are:

  • :colors
  • :inspect
  • :width
  • :history_size
  • :default_prompt
  • :continuation_prompt
  • :alive_prompt
  • :alive_continuation_prompt
  • :parser

They are discussed individually in the sections below.

Colors

A keyword list that encapsulates all color settings used by the shell. See documentation for the IO.ANSI module for the list of supported colors and attributes.

List of supported keys in the keyword list:

  • :enabled - boolean value that allows for switching the coloring on and off
  • :eval_result - color for an expression's resulting value
  • :eval_info - ... various informational messages
  • :eval_error - ... error messages
  • :eval_interrupt - ... interrupt messages
  • :stack_info - ... the stacktrace color
  • :blame_diff - ... when blaming source with no match
  • :ls_directory - ... for directory entries (ls helper)
  • :ls_device - ... device entries (ls helper)

When printing documentation, IEx will convert the Markdown documentation to ANSI as well. Colors for this can be configured via:

  • :doc_code - the attributes for code blocks (cyan, bright)
  • :doc_inline_code - inline code (cyan)
  • :doc_headings - h1 and h2 (yellow, bright)
  • :doc_title - the overall heading for the output (reverse, yellow, bright)
  • :doc_bold - (bright)
  • :doc_underline - (underline)

IEx will also color inspected expressions using the :syntax_colors option. Such can be disabled with:

IEx.configure(colors: [syntax_colors: false])

You can also configure the syntax colors, however, as desired:

IEx.configure(colors: [syntax_colors: [atom: :red]])

Configuration for most built-in data types are supported: :atom, :string, :binary, :list, :number, :boolean, :nil, and others. The default is:

[number: :magenta, atom: :cyan, string: :green,
 boolean: :magenta, nil: :magenta]

Inspect

A keyword list containing inspect options used by the shell when printing results of expression evaluation. Default to pretty formatting with a limit of 50 entries.

To show all entries, configure the limit to :infinity:

IEx.configure(inspect: [limit: :infinity])

See Inspect.Opts for the full list of options.

Width

An integer indicating the maximum number of columns to use in output. The default value is 80 columns. The actual output width is the minimum of this number and result of :io.columns. This way you can configure IEx to be your largest screen size and it should always take up the full width of your current terminal screen.

History size

Number of expressions and their results to keep in the history. The value is an integer. When it is negative, the history is unlimited.

Prompt

This is an option determining the prompt displayed to the user when awaiting input.

The value is a keyword list with two possible keys representing prompt types:

  • :default_prompt - used when Node.alive?/0 returns false

  • :continuation_prompt - used when Node.alive?/0 returns false and more input is expected

  • :alive_prompt - used when Node.alive?/0 returns true

  • :alive_continuation_prompt - used when Node.alive?/0 returns true and more input is expected

The following values in the prompt string will be replaced appropriately:

  • %counter - the index of the history
  • %prefix - a prefix given by IEx.Server
  • %node - the name of the local node

Parser

This is an option determining the parser to use for IEx.

The parser is a "mfargs", which is a tuple with three elements: the module name, the function name, and extra arguments to be appended. The parser receives at least three arguments, the current input as a string, the parsing options as a keyword list, and the buffer as a string. It must return {:ok, expr, buffer} or {:incomplete, buffer}.

If the parser raises, the buffer is reset to an empty string.