Created
July 16, 2015 15:26
-
-
Save meggart/c1e45bae0d60f3d8822d to your computer and use it in GitHub Desktop.
Macroexpand shortcut in the REPL
This file contains 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
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