-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiex.exs
50 lines (45 loc) · 1.37 KB
/
iex.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if function_exported?(Mix, :__info__, 1) and Mix.env() == :dev do
# if statement guards you from running it in prod, which could result in loss of logs.
Logger.configure_backend(:console, device: Process.group_leader())
end
Application.put_env(:elixir, :ansi_enabled, true)
timestamp = fn ->
{_date, {hour, minute, _second}} = :calendar.local_time()
[hour, minute]
|> Enum.map(&String.pad_leading(Integer.to_string(&1), 2, "0"))
|> Enum.join(":")
end
node_name =
node()
|> Atom.to_string()
|> String.split("@")
|> List.first()
IEx.configure(
colors: [
syntax_colors: [
number: :light_yellow,
atom: :light_cyan,
string: :light_black,
boolean: :red,
nil: [:magenta, :bright]
],
ls_directory: :cyan,
ls_device: :yellow,
doc_code: :green,
doc_inline_code: :magenta,
doc_headings: [:cyan, :underline],
doc_title: [:cyan, :bright, :underline]
],
default_prompt:
"[#{IO.ANSI.magenta()}#{timestamp.()}#{IO.ANSI.reset()}] " <>
"#{IO.ANSI.green()}%prefix#{IO.ANSI.light_green()}❯#{IO.ANSI.reset()}",
alive_prompt:
"[#{IO.ANSI.magenta()}#{timestamp.()}#{IO.ANSI.reset()}] " <>
"#{IO.ANSI.yellow()}#{node_name}#{IO.ANSI.reset()} " <>
"#{IO.ANSI.green()}%prefix#{IO.ANSI.light_green()}❯#{IO.ANSI.reset()}",
history_size: 1000,
inspect: [
pretty: true,
limit: :infinity
]
)