Improves the new `Editor::DuplicateSelection` @CharlesChen0823 added in
https://github.com/zed-industries/zed/pull/21154.
- Merge `duplicate_selection` and `duplicate_line` into single function.
- Add keyboard shortcuts to JetBrains and SublimeText keymaps.
- If the selection is empty (e.g. just a cursor) make
`Editor::DuplicateSelection` fallback to being the same as
`Editor::DuplicateLineDown`.
- Tested with multiple cursors and for multiple selections.
| Editor | Action | macOS | Linux |
| ----------- | ------------------- | ----------- | ------------ |
| VSCode | Duplicate Selection | | |
| JetBrains | Duplicate Selection | cmd-d | ctrl-d |
| XCode | Duplicate | cmd-d | N/A |
| SublimeText | duplicate_line | cmd-shift-d | ctrl-shift-d |
This matches behavior of the `duplicate` functionality in all other
major editors, with one exception: other editors change the selection so
that the newly duplicated object, current Zed behavior leaves the
original selection unchanged (TODO?)
Improve behavior of ctrl-a/ctrl-e home/end in emacs keybind.
Follow up to #21921 to add those to Linux emacs keymap too.
Release Notes:
- emacs: Improved `ctrl-a` / `ctrl-e` / `home` / `end` behavior
- emacs: Added for `ctrl-s` / `ctrl-r` / `ctrl-g` for navigating buffer
search results
JetBrains IDE's use `ctrl-w` and `ctrl-shift-w` on Win/Linux and
`cmd-up` and `cmd-down` on mac to extend/shrink selections.
https://www.jetbrains.com/guide/java/tips/extend-selection/
Release Notes:
- Fixed extend/shrink selection on JetBrains keymap
- Improved Sublime keymap: Support for switching to individual tabs with `cmd-1` thru `cmd-9` (MacOS) and `alt-1` thru `alt-9` (Linux) matching Sublime behavior.
Improved SublimeText keymap (Mac & Linux).
- Add bind for MoveLineUp/Down (`ctrl-shift-up` on linux and `cmd-ctrl-up` on MacOS).
Co-authored-by: unixtensor <brandon@rhpidfyre.io>
- atom(mac): Cmd+j conflicts with `workspace: ToggleBottomDock` in
default map. Revert.
- default(linux): `ctrl-shift-t` conflict. Move
`project_symbols::Toggle` to `ctrl-t` to match vscode linux. Leave
`pane::ReopenClosedItem` at `ctrl-shift-t` to match vscode/chrome on
linux.
- Fixes#13973
Release Notes:
- Added Linux-Specific keymaps for JetBrains, Atom and Sublime Text
- Improved MacOS-specific keymaps for JetBrains and Atom
- Improved Linux default keymap (VSCode compatibility)
- Windows now uses same keymap as Linux
---------
Co-authored-by: Peter Tripp <peter@zed.dev>