Created
February 20, 2024 11:27
-
-
Save dch/df5eecc1e4df3795b09670cc60cb1598 to your computer and use it in GitHub Desktop.
dch custom iex prompt, put in ~/.iexs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule I do | |
def cls, do: IO.puts("\ec") | |
def qt(m, f) do | |
:recon_trace.calls( | |
{m, f, :return_trace}, | |
{100, 10000}, | |
pid: :all, | |
scope: :local, | |
stack: :return | |
) | |
end | |
def raw(any, label \\ "iex") do | |
IO.inspect(any, | |
label: label, | |
pretty: true, | |
limit: :infinity, | |
structs: false, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: :green, | |
nil: :magenta, | |
boolean: :magenta | |
], | |
width: 0 | |
) | |
end | |
def dbg(any, label \\ "iex") do | |
IO.inspect(any, | |
label: label, | |
pretty: true, | |
limit: :infinity, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: :green, | |
nil: :magenta, | |
boolean: :magenta | |
], | |
width: 0 | |
) | |
end | |
end | |
IEx.configure( | |
default_prompt: | |
[ | |
# ANSI CHA, move cursor to column 1. Breaks stuff. | |
# "\e[G", | |
:light_green, | |
# plain string | |
"🧪 ", | |
:white, | |
:reset | |
] | |
|> IO.ANSI.format() | |
|> IO.chardata_to_string(), | |
inspect: [limit: :infinity, pretty: true], | |
colors: [ | |
enabled: true, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: [:italic, :blue], | |
boolean: [:italic, :magenta], | |
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] | |
] | |
) | |
import I |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment