Skip to content

Instantly share code, notes, and snippets.

@Ismael-VC
Forked from meggart/.juliarc.jl
Created August 10, 2016 00:47
Show Gist options
  • Save Ismael-VC/ad73ccc55d84287e4d7ffb15bc2d9b6a to your computer and use it in GitHub Desktop.
Save Ismael-VC/ad73ccc55d84287e4d7ffb15bc2d9b6a to your computer and use it in GitHub Desktop.
Macroexpand shortcut in the REPL
if VERSION > v"0.4.0-dev+4268"
const marcoexpandkeys = Dict{Any,Any}("^I" => function (s,o...)
if !isempty(s)
line = parse(Base.LineEdit.input_string(s))
s.kill_buffer=Base.LineEdit.input_string(s)
Base.LineEdit.edit_clear(s)
Base.LineEdit.edit_insert(s,string(macroexpand(line)))
end
end,
"^O" => function(s,o...)
Base.LineEdit.edit_clear(s)
Base.LineEdit.edit_insert(Base.LineEdit.buffer(s),s.kill_buffer)
Base.LineEdit.refresh_line(s)
end)
function customize_keys(repl)
repl.interface = Base.REPL.setup_interface(repl; extra_repl_keymap = marcoexpandkeys)
end
Base.LineEdit.atreplinit(customize_keys)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment