Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bind to just Escape in REPL. #28598

Open
bovine3dom opened this issue Aug 11, 2018 · 0 comments
Open

Cannot bind to just Escape in REPL. #28598

bovine3dom opened this issue Aug 11, 2018 · 0 comments
Labels
stdlib:REPL Julia's REPL (Read Eval Print Loop)

Comments

@bovine3dom
Copy link
Contributor

bovine3dom commented Aug 11, 2018

Minimal working example, place in ~/.julia/config/startup.jl.

import REPL

const keysandstuff = Dict{Any,Any}(
    "\e\\e"   => function (s, o...)
        println("hello")
    end,
)

function repl_init(repl)
    repl.interface = REPL.setup_interface(repl; extra_repl_keymap = keysandstuff)
end

atreplinit(repl_init)

Outcome: pressing Escape prints hello, but all other special keys also print hello, e.g, the up arrow.

@Keno says that most terminal applications simply only allow a few hundred milliseconds after the escape character is entered for other characters to be entered, after which the escape characters are matched. I'll look into seeing if there is any better solution than this but I doubt that there is one - every terminal I have tried has a delay after pressing escape before escape is matched.

This would also fix being able to press Escape then b to go back a word, which tricks me into thinking I am in a Vim-style normal mode without fail.

Related: #6774

Edit: I would recommend removing the minimal example from your startup file once you have tested it, as it turns out that it makes the REPL quite hard to use...

@brenhinkeller brenhinkeller added the stdlib:REPL Julia's REPL (Read Eval Print Loop) label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

No branches or pull requests

2 participants