I like this idea. It meets the requirement.
The documentation for custom keybindings
The documentation says to * Users should refer to LineEdit.jl
to discover the available actions on key input.*
This file can be found in julia/share/stdlib/v1.6/REPL/src
LineEdit.jl is a 2563 line program written by someone obviously very skilled in writing a character interface.
The “available actions” appear to start at line 238. “:edit_insert” looks promising. Search for “edit_insert” and you find the function edit_insert() at line 736.
At that point, function edit_insert() is incomprehensible to me.
So, let’s try guessing (if you consider this to be a bad method, you would be correct):
This does not work:
import REPL
import REPL.LineEdit
const mykeys = Dict{Any,Any}(
# \ie[tab] to ==
"\\ie" => (s,o...)->(LineEdit.edit_insert, s, "==")
)
function customize_keys(repl)
repl.interface = REPL.setup_interface(repl; extra_repl_keymap = mykeys)
end
atreplinit(customize_keys)
In fact, executing the above in your startup.jl will prevent you from typing the letter “e”.
You can’t type exit() to get out.
It took me about two hours to come up with that guess (it is in fact guess version 4, the first three were worse).