diff --git a/assets/keymaps/linux/jetbrains.json b/assets/keymaps/linux/jetbrains.json index 98d5cf93106f35e488ab70a60468fa2239cb08c0..fc5175829704d661593ca3dd1f67f4cc692ff41e 100644 --- a/assets/keymaps/linux/jetbrains.json +++ b/assets/keymaps/linux/jetbrains.json @@ -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", diff --git a/assets/keymaps/macos/jetbrains.json b/assets/keymaps/macos/jetbrains.json index 304ffb86e8c2fd08fb756b015490f8c4ac424f58..0a49f3deb19351c04c8e9ba9fce132c1da1f250b 100644 --- a/assets/keymaps/macos/jetbrains.json +++ b/assets/keymaps/macos/jetbrains.json @@ -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", diff --git a/docs/src/key-bindings.md b/docs/src/key-bindings.md index 7b449fea05aabd6deba52a687c571f2533f17baf..e3612a12120f683df4b91259be920750e46226c8 100644 --- a/docs/src/key-bindings.md +++ b/docs/src/key-bindings.md @@ -26,6 +26,24 @@ This setting can also be changed via the command palette through the `zed: toggl You can also enable `vim_mode` or `helix_mode`, which add modal bindings. For more information, see the documentation for [Vim mode](./vim.md) and [Helix mode](./helix.md). +## Word and subword navigation + +Zed exposes word and subword motions as separate actions. + +- Word motions stop at whitespace and punctuation boundaries. +- Subword motions also stop inside identifiers such as `camelCase`, `PascalCase`, and `snake_case`. + +In the default macOS and Linux keymaps: + +- `alt-left` / `alt-right` move by word +- `shift-alt-left` / `shift-alt-right` select by word +- `ctrl-alt-left` / `ctrl-alt-right` move by subword +- `ctrl-alt-shift-left` / `ctrl-alt-shift-right` select by subword + +If you use the JetBrains base keymap, Zed makes editor-local `alt-left` / `alt-right` and `shift-alt-left` / `shift-alt-right` use subword motions by default to match JetBrains-style CamelHump navigation. Outside the editor, the JetBrains keymap keeps its existing pane navigation bindings. + +If you want to customize this behavior further, open the keymap editor with {#kb zed::OpenKeymap} or edit your `keymap.json` directly. + ## Keymap Editor You can access the keymap editor through the {#kb zed::OpenKeymap} action or by running {#action zed::OpenKeymap} action from the command palette. You can easily add or change a keybind for an action with the `Change Keybinding` or `Add Keybinding` button on the command pallets left bottom corner. diff --git a/docs/src/migrate/intellij.md b/docs/src/migrate/intellij.md index bb10c8cdc3b9002e0aeb9a362a0a945de6f46176..ddb2bc4f6b0aaf4b7c878594b8e553a921481341 100644 --- a/docs/src/migrate/intellij.md +++ b/docs/src/migrate/intellij.md @@ -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 `zed: open settings file` 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) diff --git a/docs/src/migrate/pycharm.md b/docs/src/migrate/pycharm.md index 6bef34f81cb380690764742a7b0310cbc81f2072..a7a5e7829c350bdaff7c397b5a589bc9e740ec57 100644 --- a/docs/src/migrate/pycharm.md +++ b/docs/src/migrate/pycharm.md @@ -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 `zed: open settings file` 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) diff --git a/docs/src/migrate/rustrover.md b/docs/src/migrate/rustrover.md index 5dc2ab10e9e3f70cd34f2582e3a2a39608168ed8..8cd33641b3890e67f71fcb8b4af7fb6e4446928c 100644 --- a/docs/src/migrate/rustrover.md +++ b/docs/src/migrate/rustrover.md @@ -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 `zed: open settings file` 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) diff --git a/docs/src/migrate/webstorm.md b/docs/src/migrate/webstorm.md index 72916b04c5579785d2f099f1fd2b09d7ffb11acf..ac3bc06c106e5ff451f908221cdc29b145a23186 100644 --- a/docs/src/migrate/webstorm.md +++ b/docs/src/migrate/webstorm.md @@ -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 `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 WebStorm's CamelHumps navigation. + ## Set Up Editor Preferences You can configure most settings in the Settings Editor ({#kb zed::OpenSettings}). For advanced settings, run `zed: open settings file` 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 (WebStorm → Zed)