zed
zed copied to clipboard
Missing key bindings
Check for existing issues
- [X] Completed
Describe the bug
Props on getting most of the Emacs-influenced CoreText bindings implemented out of the gate (a rarity for a new editor!). There are a handful missing, though:
- CtrlL: should center the cursor in the buffer
- CtrlV: should do page down (moving the cursor) – and I could not get key bindings to do this for me; unclear why!
- CtrlY: should “yank” from the “kill ring”, which is normally separate from the copy/paste buffer. If you choose to keep it in the copy/paste buffer, that’s fine but then CtrlY should be bound to match ⌘V
To reproduce
Try any of the keystrokes here and notice that they don't work.
Expected behavior
I, being a very long-time macOS-user, expect these to work everywhere. (Chrome and Firefox’s mixed support for them is the worst. :joy:)
Environment
Zed 0.50.0 – /Applications/Zed.app macOS 12.5 architecture arm64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue
No response
Update/clarification: CtrlV should not be Page Down but Cursor down by page.
Hey @chriskrycho, I'm unfamiliar with these keybindings, You say they are used everywhere on macOS? Which applications support them? I couldn't seem to use them in TextEdit.
BTW, it loos like ctrl-v was implemented.
@JosephTLyons TextEdit does something slightly odd with CtrlV and uses it for moving by a single line instead of by page, but otherwise respects those. One of the easiest ways to see CtrlL in practice is by opening a very large file (Cargo.lock or yarn.lock are good candidates) and scrolling and then hitting the keystroke; it will center where your cursor is vertically in the window. That goes even if your cursor is off screen.
This screen capture includes CtrlK and CtrlY as well!
https://user-images.githubusercontent.com/2403023/197801394-43f475bf-3fd6-439f-89a2-7f8aaccd81d5.mp4
Hey! Thanks for all the work on Zed.
Came across this thread while trying to figure out how to get yank (Ctrl + Y) and Begin Selection (Ctrl + Space) to work. I don't know anything about CoreText, but those are both core Emacs keybindings.
I looked through the keymaps repo and didn't see any for a default emacs setup. I'm going to try and configure my own, but figured I'd go ahead and ask here in case I'm missing it somewhere 🙏
Hey! Thanks for all the work on Zed.
Came across this thread while trying to figure out how to get yank (Ctrl + Y) and Begin Selection (Ctrl + Space) to work. I don't know anything about CoreText, but those are both core Emacs keybindings.
I looked through the keymaps repo and didn't see any for a default emacs setup. I'm going to try and configure my own, but figured I'd go ahead and ask here in case I'm missing it somewhere 🙏
Hey @devdumpling, we don't have any emacs keybindings defined anywhere and no one is working on it to my knowledge.
@JosephTLyons got it, thanks!
@JosephTLyons got it, thanks!
Feel free to open a PR if you end up working on that and feel comfortable doing so!
There's another binding that's missing here! ctrl-o inserts a new line after the cursor, so your cursor stays in the same place but everything after it is moved to a new line. This is another standard macOS keybinding.
I searched around and found this thread, and I'd like to plus one this as well. I think the important point here is that "these keybindings work everywhere in mac os".
If I go into the URL bar at the top of my browser window, compose a new mail message, heck they even work in spotlight searches, they just work anywhere. I can press ctrl-a to go to the beginning of the line ctrl-e to go to the end of the line. option-delete to "delete word". I didn't realize just how much I use all of these shortcuts, and just how widely they are supported in every single mac os application.
I don't know if the option-left, and option-right keybindings to move to the next word come from the same place, but use those all of the time as well 😅
Is there some sort of core support we can add that gets all of these keybindings at once?
- [x] ctrl shift page up: move tab to left
- [x] ctrl shift page down: move tab to right
I searched around and found this thread, and I'd like to plus one this as well. I think the important point here is that "these keybindings work everywhere in mac os". (@jish)
These are officially in the Apple: Mac keyboard shortcuts but originate from the GNU Readline emacs mode which is used for implementing line editing for all sorts of CLI applications (notably it was born from Bash).
@chriskrycho I've created a distinct issue for a cut buffer / yank support here:
- https://github.com/zed-industries/zed/issues/14260
@clo4 There's an existing issue for ctrl-o here:
- https://github.com/zed-industries/zed/issues/9891
@kiaradlf I opened this issue for those shortcuts (which I believe are chrome, not Apple derived)
- https://github.com/zed-industries/zed/issues/14174
This leaves ctrl-l which is currently bound to "ctrl-l": "editor::NextScreen". Which appears to toggle scrolling between a top / center / bottom placement of the cursor in the window and only has a keybinding on MacOS. I'm going to see about changing this default binding, but in the meantime you could add this to your keymap.json and get the behavior you're looking for:
[
{
"context": "Editor",
"bindings": {
"ctrl-l": "editor::ScrollCursorCenter"
}
}
]
Thanks all for reporting these opportunities for Zed to improve.
Please click over to those individual issues and click "subscribe" to follow their progress and 👍 upvote to increase visibility.