Hi everyone,
I am looking for a good config for an .iex file that can do the following:
- Format the output of the commands in an easy to read manner
- Color the iex shell for readability
Something like this
Thanks in advance
Hi everyone,
I am looking for a good config for an .iex file that can do the following:
Thanks in advance
Managed to obtain colors like so:
IEx.configure(colors: [syntax_colors: [number: :magenta, atom: :cyan, string: :green,
boolean: :magenta, nil: :magenta]])
All this config goes in the root of your project folder in an .iex.exs file that you have to create.
Now can someone explain how to format the output of the iex shell?
Thanks
It should get formatted automaitcally.
Though this depends on your terminal width.
Edit:
You can also provide the :width
config option:
Thanks @NobbZ I will have a look over it. But can you offer an example of a good width to obtain something similar as in the example in my first post?
Tried that didn’t work. Is there any way to make it look as in the picture maybe something like json formatter? That would be helpful or how can i build something like that.
For me it seems to work:
iex(1)> IEx.configure(width: 30)
:ok
iex(2)> [%{id: 1, name: "Jose", username: "josevalim"}]
[
%{
id: 1,
name: "Jose",
username: "josevalim"
}
]
Interesting i will share my config with you. Maybe we can find out what i did wrong thanks in advance
My config:
IEx.configure(
colors: [
syntax_colors: [
number: :magenta,
atom: :cyan,
string: :green,
boolean: :magenta,
nil: :magenta
],
width: 30
]
)
Does width need to be in front of colors?
This works
IEx.configure(
width: 30,
colors: [
syntax_colors: [
number: :magenta,
atom: :cyan,
string: :green,
boolean: :magenta,
nil: :magenta
]
]
)
For anyone needing to have something similar, the following config posted above works like a charm. Thanks for the help @NobbZ