-
Notifications
You must be signed in to change notification settings - Fork 3.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Emacs Compatibility Tracking Issue #4856
Comments
An offical "Emacs mode" would be really nice. There is a couple of example user configurations over here: https://github.com/zed-industries/community/discussions/1653 At the moment the lack of a "mark" command is the biggest holdup. In Emacs, pressing Ctrl+SPC will toggle selection and let you use movement commands to select text without keeping Shift pressed. Any chance this could be added to Zed? |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
For those following this issue we've recently shipped two emacs-related improvements: Please try out the It's very basic at this point, but give it a whirl, happy to consider PRs with improvements / refinements. Rather than close this issue I've repurposed it as a tracking issue for additional Emacs-related enhancements and I've edited the issue description above to include links to other issues. One other update, sadly, due to issues with international keyboards we also opted to revert If you need emacs/readline style keybinds in your terminal which use "terminal": {
"option_as_meta": true
} |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Various improvements to the emacs compatibility keybindings. - See also: #4856 Release Notes: - Improvements to emacs keybindings: - Better support for running emacs inside Zed terminal (e.g. `ctrl-x ctrl-c` will quit emacs in terminal not zed) - `alt-^` Join Lines - `ctrl-/` Undo - `alt-.` GotoDefinition and `alt-,` GoBack - `ctrl-x h` SelectAll - `alt-<` / `alt->` Goto End/Beginning of Buffer - `ctrl-g` as Menu::cancel
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
It might be worth adding |
@kzar Emacs Similar to this: zed/assets/keymaps/default-linux.json Line 306 in ba7b9b3
zed/crates/editor/src/actions.rs Lines 79 to 85 in ba7b9b3
And then add a conditional inside the newline_below to optionally move the cursor.zed/crates/editor/src/editor.rs Line 3139 in ba7b9b3
|
Good point about not moving the cursor, but I don't think that |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Oh, duh.
"ctrl-y": "editor::Paste",
"alt-w": "editor::Copy",
"ctrl-w": "editor::Cut",
"ctrl-?": "editor::Redo",
"ctrl-shift-n": "editor::SelectDown",
"ctrl-shift-p": "editor::SelectUp",
"alt-shift-f": "editor::SelectToNextWordEnd",
"alt-shift-b": "editor::SelectToPreviousWordStart",
"ctrl-alt-shift-f": "editor::SelectToEndOfLine",
"ctrl-alt-shift-b": "editor::SelectToBeginningOfLine" This below also stops the
"alt-x": "app_menu::OpenApplicationMenu",
"ctrl-?": null And this prevents the cursor movement commands from opening new buffers when reaching beyond the first and last lines of a buffer.
"ctrl-n": null,
"ctrl-p": null, |
This comment was marked as resolved.
This comment was marked as resolved.
Moving around the workspace panes is different from Emacs, which will just cycle through all available buffers and has no default concept of how they're positioned. Zed seems to organise them spatially, so instead of having just the default Emacs In Emacs, I go to the pane I want the buffer to be and switch to it by name. In Zed (at least for now), I have to locate the pane by looking at the tabs, switching to the pane and then choosing the desired tab. Suboptimal. Here's my current config:
"ctrl-x o": "tab_switcher::Toggle",
"alt-x b": ["workspace::ActivatePaneInDirection", "Left"],
"alt-x f": ["workspace::ActivatePaneInDirection", "Right"],
"alt-x p": ["workspace::ActivatePaneInDirection", "Up"],
"alt-x n": ["workspace::ActivatePaneInDirection", "Down"] |
"alt-,": "pane::GoBack", // xref-go-back
"ctrl-x ctrl-space": "pane::GoBack", // pop-global-mark
"ctrl-u ctrl-space": "pane::GoForward" // set-mark-command with negative prefix Typing |
Originally reported here: - #4856 (comment) macOS default vscode keymap already has this: https://github.com/zed-industries/zed/blob/8d42456b8a7c547c6760b604c24d902bd2e12b8b/assets/keymaps/default-macos.json#L55 But it's disabled on Linux default vscode keymap as VSCode has this bind instead: https://github.com/zed-industries/zed/blob/8d42456b8a7c547c6760b604c24d902bd2e12b8b/assets/keymaps/default-linux.json#L407 Explicitly add it to both emacs keymaps so we can keep them identical between macos/linux as long as possible. Release Notes: - emacs: Add support for `ctrl-t` transposing characters on Linux
This comment has been minimized.
This comment has been minimized.
Tomorrow (2025-01-21) this will be available Zed Preview 0.171.x (#23297 and #23428):
Note multi-cursor is supported for both. video demoScreen.Recording.2025-01-21.at.18.17.59.movThanks @ozanmakes for your work on #22904 which inspired me to get this over the line. |
Zed is getting more and more usable for me (as a long-time Emacs user) with these changes, thanks @notpeter! I've not had the latest upgrade yet, but something I've noticed recently. If I press |
I'm trying this Emacs keymap, one thing I'm confused about is how it should handle conflicts with default Zed keybinds, eg C-p instead of going to previous line currently opens project file search and C-a selects all instead of going to beginning of a line. |
You're probably missing the
|
I do have that, and I have some Emacs keybinds working, like C-n, C-e, but only those which are not used by Zed default bindings |
I'm in Zed
And my |
In Emacs, one can bind the same keyboard shortcut to different commands in different programming language buffers. It would be great if Zed had similar functionality. For example, using the same shortcut to execute different run commands / tasks in Python and Rust files, e.g. |
To help Emacs folks migrate, can I suggest adding feedback for when the user used the command palette for a command that already has a key binding. That way, folks can pick up the keybindings as they go. I've been finding I need to use the command pallete to find what I need (e.g. "file finder: toggle"), then go through the default keymap myself to find what that's bound to.
In Emacs, a message like You can run the command ‘forward-char’ with C-f is shown in the mini buffer, so the user can quickly pick up the binding for next time.
Second this. I used the dropdown boxes to discover command names and current keybindings in Zed, but a `which-key` functionality where the keybindings are shown alongside the commands in the pallette would be much more useful as it would cover all commands and be readily accessible.-- Daniel Vianna
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Rather than a monolithic "implement emacs in Zed" enhancement request (which is inherently unactionable) this issue is a tracking issue for centralizing various Zed bug fixes and enhancements to better supporting emacs-like compatibility and operation in Zed.
Issues:
ctrl-x
than MacOS Terminal (emacs) #16214occur
style) #22943keep lines
andflush lines
command #23408Merged PRs:
editor::SwapSelectionEnds
everywhere (emacs exchange-point-and-mark) #23428Comments such as "I need emacs mode to switch to Zed!" and the like are unwelcome here.
Please vote with 👍 below on this issue and the linked issues instead.
Editor note (@notpeter): Originally this issue was for an emacs keymap, a beta of which shipped in #19605
The text was updated successfully, but these errors were encountered: