-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add Newline keybindings #854
Conversation
Like you indicated, Alt-Enter definitely doesn't work for Windows because that's a system wide hook to go full screen in whatever app you're using, namely Windows Terminal. On Windows I use Shift-Enter. On MacOS, some people wanted Alt-I, not sure if that's a vim thing or what. I'm not opposed to multiple keybindings but if we know Alt-Enter never works on Windows, we might want to only apply it in non-Windows environments. Maybe? |
Alt+Enter isn't a system wide binding - I use it in Nushell in Windows Terminal personally. It's bound by default in Windows Terminal, but it's also easy to unbind it. Other terminals in Windows probably have different default keybindings. |
Ya, I think you're right about the system level aspect but Alt-Enter does the same thing in WT, cmd.exe, alacritty.exe, wezterm.exe, yori.exe, tabby.exe. There may be some terminal app on Windows that doesn't use it, but I haven't found it yet. |
Interesting - I guess us old-time Fish shell users have just gotten used to unbinding it, since Fish only provides Alt+Enter.
The question is - Why disallow it? Binding it in Reedline/Nushell is never going to cause any problems1. That's why I think we should just go ahead and provide multiple options. 1 AFAIK, keybindings are always handled in the following order (hand-waving over a few, like hardware):
So, since Reedline will only get the Alt+Enter event if it is unbound at the higher-levels, it shouldn't matter if we just leave the keybinding in the code for all platforms, right? |
Do we want a third-fallback like Ctrl+J (Emacs)? Someone mentioned using that, and again, there doesn't seem to be any harm in binding it. Users who want to bind any of these to another function are free to do so in Nushell.
|
I'm good with double binding it. It's not worth all this conversation. We can always change it if it gets in the way. |
Thanks |
See #832 (wasn't merged by me because of the hardcoding but should be fine as a soft binding like you did) |
oops, should we revert? |
Nope small fix |
Implements #792 and also should be the proper implementation of nushell/nushell#13606
Adds Alt+Enter and Shift+Enter as keybindings to insert a newline in Emacs and Vi-insert modes.
In the Nushell PR, @sholderbach said:
I figure there's no reason we can't just bind both so that multiple platforms and terminals can handle this gracefully. I know Alt+Enter is commonly captured by Windows Terminal, and Shift+Enter doesn't seem to be recognized on Linux (also via
input listen
).If the Terminal captures one of the keybindings, then hopefully the other is available. And if not, the user can always add their own in their Nushell config.