JetBrains keymap: Add CamelHump subword navigation (#51540)
Closes #21054 ## Summary • make the JetBrains base keymap use subword motions for `Alt+Left/Right` and `Shift+Alt+Left/Right` in editors • keep Zed's default keymaps and the underlying `word`/`subword` primitives unchanged • document word vs. subword navigation in the key bindings docs • document the JetBrains default in the IntelliJ, WebStorm, PyCharm, and RustRover migration guides ## Testing • `./script/check-keymaps` • `cargo fmt --all -- --check` • `./script/clippy -p editor` • `cd docs && pnpm dlx prettier@3.5.0 src/key-bindings.md src/migrate/intellij.md src/migrate/webstorm.md src/migrate/pycharm.md src/migrate/rustrover.md --check` Related to #12816 and #34090, but does not actually address the configurable word separators or broader subword semantics. Intentionally scoped to JetBrains keymap defaults & docs. Release Notes: - Improved JetBrains keymap behavior by adding CamelHump-style subword navigation in editors. --------- Co-authored-by: Tom Houlé <tom@tomhoule.com> Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
1 parent
6206d48ac5
commit
f7356481e7
7 files changed
+149
-84
No files matched your search
@@ -60,6 +60,10 @@
|
||||
"ctrl-end": "editor::MoveToEnd",
|
||||
"ctrl-shift-home": "editor::SelectToBeginning",
|
||||
"ctrl-shift-end": "editor::SelectToEnd",
|
||||
"alt-left": "editor::MoveToPreviousSubwordStart",
|
||||
"alt-right": "editor::MoveToNextSubwordEnd",
|
||||
"shift-alt-left": "editor::SelectToPreviousSubwordStart",
|
||||
"shift-alt-right": "editor::SelectToNextSubwordEnd",
|
||||
"ctrl-f8": "editor::ToggleBreakpoint",
|
||||
"ctrl-shift-f8": "editor::EditLogBreakpoint",
|
||||
"ctrl-shift-u": "editor::ToggleCase",
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
"cmd-end": "editor::MoveToEnd",
|
||||
"cmd-shift-home": "editor::SelectToBeginning",
|
||||
"cmd-shift-end": "editor::SelectToEnd",
|
||||
"alt-left": "editor::MoveToPreviousSubwordStart",
|
||||
"alt-right": "editor::MoveToNextSubwordEnd",
|
||||
"shift-alt-left": "editor::SelectToPreviousSubwordStart",
|
||||
"shift-alt-right": "editor::SelectToNextSubwordEnd",
|
||||
"ctrl-f8": "editor::ToggleBreakpoint",
|
||||
"ctrl-shift-f8": "editor::EditLogBreakpoint",
|
||||
"cmd-shift-u": "editor::ToggleCase",
|
||||
|
||||
@@ -305,3 +305,37 @@ For example, `ctrl-n` creates a new tab in Zed on Linux. If you want to send `ct
|
||||
|
||||
You can also bind keys to launch Zed Tasks defined in your `tasks.json`.
|
||||
See the [tasks documentation](tasks.md#custom-keybindings-for-tasks) for more.
|
||||
|
||||
### Subword Navigation
|
||||
|
||||
Zed exposes word and subword motions as separate actions. Word motions stop at whitespace and punctuation boundaries, while subword motions also stop inside identifiers such as `camelCase`, `PascalCase`, and `snake_case`.
|
||||
|
||||
The JetBrains base keymap uses editor-local `alt-left` / `alt-right` and `shift-alt-left` / `shift-alt-right` for subword navigation to match JetBrains-style CamelHump navigation. If you use another base keymap and want that behavior, add this to your `keymap.json`:
|
||||
|
||||
```json [keymap]
|
||||
[
|
||||
{
|
||||
"context": "Editor",
|
||||
"bindings": {
|
||||
"alt-left": "editor::MoveToPreviousSubwordStart",
|
||||
"alt-right": "editor::MoveToNextSubwordEnd",
|
||||
"shift-alt-left": "editor::SelectToPreviousSubwordStart",
|
||||
"shift-alt-right": "editor::SelectToNextSubwordEnd"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
If you use the JetBrains base keymap and want `alt-left` / `alt-right` to keep moving between tabs in editors, add this override:
|
||||
|
||||
```json [keymap]
|
||||
[
|
||||
{
|
||||
"context": "Editor",
|
||||
"bindings": {
|
||||
"alt-left": "pane::ActivatePreviousItem",
|
||||
"alt-right": "pane::ActivateNextItem"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
@@ -43,6 +43,8 @@ If you're coming from IntelliJ, the fastest way to feel at home is to use the Je
|
||||
|
||||
This maps familiar shortcuts like `Shift Shift` for Search Everywhere, `Cmd+O` for Go to Class, and `Cmd+Shift+A` for Find Action.
|
||||
|
||||
In editors, the JetBrains keymap also makes `Alt+Left` / `Alt+Right` and `Shift+Alt+Left` / `Shift+Alt+Right` move and select by subword, so identifiers like `camelCase` and `snake_case` behave like IntelliJ's CamelHumps navigation.
|
||||
|
||||
## Set Up Editor Preferences
|
||||
|
||||
You can configure most settings in the Settings Editor ({#kb zed::OpenSettings}). For advanced settings, run {#action zed::OpenSettingsFile} from the Command Palette to edit your settings file directly.
|
||||
@@ -84,26 +86,28 @@ If you chose the JetBrains keymap during onboarding, most of your shortcuts shou
|
||||
|
||||
### Common Shared Keybindings (Zed with JetBrains keymap ↔ IntelliJ)
|
||||
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | ----------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol / Class | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | -------------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol / Class | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Move by subword | `Alt + Left/Right` |
|
||||
| Select by subword | `Shift + Alt + Left/Right` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
|
||||
### Different Keybindings (IntelliJ → Zed)
|
||||
|
||||
|
||||
+24
-20
@@ -43,6 +43,8 @@ If you're coming from PyCharm, the fastest way to feel at home is to use the Jet
|
||||
|
||||
This maps familiar shortcuts like `Shift Shift` for Search Everywhere, `Cmd+O` for Go to Class, and `Cmd+Shift+A` for Find Action.
|
||||
|
||||
In editors, the JetBrains keymap also makes `Alt+Left` / `Alt+Right` and `Shift+Alt+Left` / `Shift+Alt+Right` move and select by subword, so identifiers like `camelCase` and `snake_case` behave like PyCharm's CamelHumps navigation.
|
||||
|
||||
## Set Up Editor Preferences
|
||||
|
||||
You can configure most settings in the Settings Editor ({#kb zed::OpenSettings}). For advanced settings, run {#action zed::OpenSettingsFile} from the Command Palette to edit your settings file directly.
|
||||
@@ -84,26 +86,28 @@ If you chose the JetBrains keymap during onboarding, most of your shortcuts shou
|
||||
|
||||
### Common Shared Keybindings
|
||||
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | ----------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | -------------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Move by subword | `Alt + Left/Right` |
|
||||
| Select by subword | `Shift + Alt + Left/Right` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
|
||||
### Different Keybindings (PyCharm → Zed)
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ If you're coming from RustRover, the fastest way to feel at home is to use the J
|
||||
|
||||
This maps familiar shortcuts like `Shift Shift` for Search Everywhere, `Cmd+O` for Go to Class, and `Cmd+Shift+A` for Find Action.
|
||||
|
||||
In editors, the JetBrains keymap also makes `Alt+Left` / `Alt+Right` and `Shift+Alt+Left` / `Shift+Alt+Right` move and select by subword, so identifiers like `camelCase` and `snake_case` behave like RustRover's CamelHumps navigation.
|
||||
|
||||
## Set Up Editor Preferences
|
||||
|
||||
You can configure most settings in the Settings Editor ({#kb zed::OpenSettings}). For advanced settings, run {#action zed::OpenSettingsFile} from the Command Palette to edit your settings file directly.
|
||||
@@ -96,26 +98,28 @@ If you chose the JetBrains keymap during onboarding, most of your shortcuts shou
|
||||
|
||||
### Common Shared Keybindings
|
||||
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | ----------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
| Action | Shortcut |
|
||||
| ----------------------------- | -------------------------- |
|
||||
| Search Everywhere | `Shift Shift` |
|
||||
| Find Action / Command Palette | `Cmd + Shift + A` |
|
||||
| Go to File | `Cmd + Shift + O` |
|
||||
| Go to Symbol | `Cmd + O` |
|
||||
| Recent Files | `Cmd + E` |
|
||||
| Go to Definition | `Cmd + B` |
|
||||
| Find Usages | `Alt + F7` |
|
||||
| Rename Symbol | `Shift + F6` |
|
||||
| Reformat Code | `Cmd + Alt + L` |
|
||||
| Toggle Project Panel | `Cmd + 1` |
|
||||
| Toggle Terminal | `Alt + F12` |
|
||||
| Duplicate Line | `Cmd + D` |
|
||||
| Delete Line | `Cmd + Backspace` |
|
||||
| Move Line Up/Down | `Shift + Alt + Up/Down` |
|
||||
| Expand/Shrink Selection | `Alt + Up/Down` |
|
||||
| Move by subword | `Alt + Left/Right` |
|
||||
| Select by subword | `Shift + Alt + Left/Right` |
|
||||
| Comment Line | `Cmd + /` |
|
||||
| Go Back / Forward | `Cmd + [` / `Cmd + ]` |
|
||||
| Toggle Breakpoint | `Ctrl + F8` |
|
||||
|
||||
### Different Keybindings (RustRover → Zed)
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ If you're coming from WebStorm, the fastest way to feel at home is to use the Je
|
||||
|
||||
This maps familiar shortcuts like {#kb:jetbrains project_symbols::Toggle} for Go to Class and {#kb:jetbrains command_palette::Toggle} for Find Action.
|
||||
|
||||
In editors, the JetBrains keymap also makes `Alt+Left` / `Alt+Right` and `Shift+Alt+Left` / `Shift+Alt+Right` move and select by subword, so identifiers like `camelCase` and `snake_case` behave like WebStorm's CamelHumps navigation.
|
||||
|
||||
## Set Up Editor Preferences
|
||||
|
||||
You can configure most settings in the Settings Editor ({#kb zed::OpenSettings}). For advanced settings, run {#action zed::OpenSettingsFile} from the Command Palette to edit your settings file directly.
|
||||
@@ -82,31 +84,40 @@ Open buffers appear as tabs across the top. The Project Panel shows your file tr
|
||||
|
||||
If you chose the JetBrains keymap during onboarding, most of your shortcuts should already feel familiar. Here's a quick reference of common actions and their keybindings with the JetBrains keymap active.
|
||||
|
||||
### Common Keybindings
|
||||
### Common Shared Keybindings
|
||||
|
||||
| Action | Zed Keybinding |
|
||||
| ---------------------- | ----------------------------------------------- |
|
||||
| Command Palette | {#kb:jetbrains command_palette::Toggle} |
|
||||
| Go to File | {#kb:jetbrains file_finder::Toggle} |
|
||||
| Go to Symbol | {#kb:jetbrains project_symbols::Toggle} |
|
||||
| File Outline | {#kb:jetbrains outline::Toggle} |
|
||||
| Go to Definition | {#kb:jetbrains editor::GoToDefinition} |
|
||||
| Find Usages | {#kb:jetbrains editor::FindAllReferences} |
|
||||
| Rename Symbol | {#kb:jetbrains editor::Rename} |
|
||||
| Reformat Code | {#kb:jetbrains editor::Format} |
|
||||
| Toggle Project Panel | {#kb:jetbrains project_panel::ToggleFocus} |
|
||||
| Toggle Terminal | {#kb:jetbrains terminal_panel::Toggle} |
|
||||
| Duplicate Line | {#kb:jetbrains editor::DuplicateSelection} |
|
||||
| Delete Line | {#kb:jetbrains editor::DeleteLine} |
|
||||
| Move Line Up | {#kb:jetbrains editor::MoveLineUp} |
|
||||
| Move Line Down | {#kb:jetbrains editor::MoveLineDown} |
|
||||
| Expand Selection | {#kb:jetbrains editor::SelectLargerSyntaxNode} |
|
||||
| Shrink Selection | {#kb:jetbrains editor::SelectSmallerSyntaxNode} |
|
||||
| Comment Line | {#kb:jetbrains editor::ToggleComments} |
|
||||
| Go Back | {#kb:jetbrains pane::GoBack} |
|
||||
| Go Forward | {#kb:jetbrains pane::GoForward} |
|
||||
| Toggle Breakpoint | {#kb:jetbrains editor::ToggleBreakpoint} |
|
||||
| Navigate to Next Error | {#kb:jetbrains editor::GoToDiagnostic} |
|
||||
| Action | Zed Keybinding |
|
||||
| ----------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| Search Everywhere | {#kb:jetbrains command_palette::Toggle} |
|
||||
| Find Action / Command Palette | {#kb:jetbrains command_palette::Toggle} |
|
||||
| Go to File | {#kb:jetbrains file_finder::Toggle} |
|
||||
| Go to Symbol | {#kb:jetbrains project_symbols::Toggle} |
|
||||
| Recent Files | {#kb:jetbrains file_finder::Toggle} |
|
||||
| Go to Definition | {#kb:jetbrains editor::GoToDefinition} |
|
||||
| Find Usages | {#kb:jetbrains editor::FindAllReferences} |
|
||||
| Rename Symbol | {#kb:jetbrains editor::Rename} |
|
||||
| Reformat Code | {#kb:jetbrains editor::Format} |
|
||||
| Toggle Project Panel | {#kb:jetbrains project_panel::ToggleFocus} |
|
||||
| Toggle Terminal | {#kb:jetbrains terminal_panel::Toggle} |
|
||||
| Duplicate Line | {#kb:jetbrains editor::DuplicateSelection} |
|
||||
| Delete Line | {#kb:jetbrains editor::DeleteLine} |
|
||||
| Move Line Up/Down | {#kb:jetbrains editor::MoveLineUp} / {#kb:jetbrains editor::MoveLineDown} |
|
||||
| Expand/Shrink Selection | {#kb:jetbrains editor::SelectLargerSyntaxNode} / {#kb:jetbrains editor::SelectSmallerSyntaxNode} |
|
||||
| Move by subword | {#kb:jetbrains editor::MoveToPreviousSubwordStart} / {#kb:jetbrains editor::MoveToNextSubwordEnd} |
|
||||
| Select by subword | {#kb:jetbrains editor::SelectToPreviousSubwordStart} / {#kb:jetbrains editor::SelectToNextSubwordEnd} |
|
||||
| Comment Line | {#kb:jetbrains editor::ToggleComments} |
|
||||
| Go Back / Forward | {#kb:jetbrains pane::GoBack} / {#kb:jetbrains pane::GoForward} |
|
||||
| Toggle Breakpoint | {#kb:jetbrains editor::ToggleBreakpoint} |
|
||||
|
||||
### Different Keybindings (WebStorm → Zed)
|
||||
|
||||
| Action | WebStorm | Zed (JetBrains keymap) |
|
||||
| ---------------------- | ----------- | ------------------------ |
|
||||
| File Structure | `Cmd + F12` | `Cmd + F12` (outline) |
|
||||
| Navigate to Next Error | `F2` | `F2` |
|
||||
| Run | `Ctrl + R` | `Ctrl + Alt + R` (tasks) |
|
||||
| Debug | `Ctrl + D` | `Alt + Shift + F9` |
|
||||
| Stop | `Cmd + F2` | `Ctrl + F2` |
|
||||
|
||||
### Unique to Zed
|
||||
|
||||
|
||||
Reference in new issue
Block a user