When using the REPL, is there a way to have an ipython-style confirmation when pressing Ctrl-D to exit? Currently Julia does this:
julia> Type ^D again to exit.
julia>
I’m not a fan of this because I think it’ll just train me to double-tap Ctrl-D, which can be destructive if using a Julia shell that’s not using my startup.jl (since it’ll exit the shell).
It’s certainly conceivable — it’s purely a REPL user-interface feature, so it wouldn’t be breaking. You could submit a PR to modify this code to implement it.
I’m not sure whether it would be accepted — I don’t have strong feelings either way myself — but it’s certainly a reasonable proposal.
The issue isn’t that I’d accidentally press ctrl-D — I’d almost certainly ever press it intentionally — but rather that I’d have some old REPL session open in terminal that I hadn’t used in a while, I’d come across it and say “I don’t need this anymore, let me exit out” and then as soon as I did I’d say “oh shoot I did still want something from that REPL”. The confirmation prompt is to give me a chance to think twice.
Coming from Stata, I am so used to CTRL-D for executing lines of code that I have created a shortcut in VScode that does it. I exit Julia by accident every time I update my system and forget to setup my shortcuts. I would love this feature.
I think it’ll just train me to double-tap Ctrl-D, which can be destructive if using a Julia shell that’s not using my startup.jl
That might be an argument in favor of having the confirm_exit option on by default.
Also, you can also press Ctrl-D twice in ipython to exit, so I actually never press Ctrl-D followed by y<Enter>, because it’s less direct than double Ctrl-D. So having the option to type y doesn’t help me in avoiding risking quitting the shell.
I would be fine having the same UI as ipython (where double Crtl-D is a hidden option), but would be reluctant to remove the possibility to type Ctrl-D twice to exit.