Keybindings: type something in REPL and loop in history through commands that have this prefix


#1

Hi, I’m trying to map in the REPL a custom key to the same behavior than the “up arrow” key. As suggested in the documentation, I tried something like that:

const mykeys = Dict{Any,Any}(
    "^s" => (s,o...)->(LineEdit.edit_move_up(s) || LineEdit.history_prev(s, LineEdit.mode(s).hist))
)
function customize_keys(repl)
    repl.interface = REPL.setup_interface(repl; extra_repl_keymap = mykeys)
end

But history_prev actually loops through all the previous commands, while typing “up arrow” in the REPL loops through commands in the history that have as a prefix what has already been typed. Which function should I call to get this behavior? I had a look at LineEdit.jl, but I got a bit confused between the different keymaps: default_keymap, history_keymap, prefix_history_keymap…
Is there a function that already does exactly what I need :slight_smile: ? Thanks.