From 5e3c762fb069dd3ba8f93f1ea18f00ddfb0990c5 Mon Sep 17 00:00:00 2001 From: sinder Date: Wed, 22 Apr 2026 20:07:40 +0800 Subject: [PATCH] docs: Improve vim mode's command mnemonics section (#52892) The "Command menonics" section in Zed's vim mode documentation made it seem that the mentioned aliases were available, by default, which isn't the case. These changes update the documentation to make it clearer that this is meant to be set on the `command_aliases` setting and provides and example configuration that users can easily copy and paste into their settings file. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #52894 Release Notes: - N/A --------- Co-authored-by: dino --- docs/src/vim.md | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/src/vim.md b/docs/src/vim.md index e60e084ac13cf935be49ab3b87304317df971d77..e53e37fb31235c7a0d5e1bc0ec8eb8c4469f0acd 100644 --- a/docs/src/vim.md +++ b/docs/src/vim.md @@ -354,14 +354,35 @@ These commands modify editor options locally for the current buffer. ### Command mnemonics -As any Zed command is available, you may find that it's helpful to remember mnemonics that run the correct command. For example: - -- `:diffs` for "toggle all hunk diffs" -- `:cpp` for "copy path to file" -- `:crp` for "copy relative path" -- `:reveal` for "reveal in finder" -- `:zlog` for "open zed log" -- `:clank` for "cancel language server work" +Zed does not ship with any command mnemonics by default, but you can define short aliases for Zed commands using the `command_aliases` setting in your settings file. When you type an alias from this map in the command palette, it resolves to the mapped command. + +#### Example Configuration + +To configure command mnemonics, add the `command_aliases` key to your settings file. Here's an example configuration with useful mnemonics: + +```json [settings] +{ + "command_aliases": { + "zlog": "zed::OpenLog", + "newf": "workspace::NewFile", + "diffs": "editor::ToggleSelectedDiffHunks", + "crp": "workspace::CopyRelativePath", + "cpp": "workspace::CopyPath", + "reveal": "editor::RevealInFileManager", + "clank": "editor::CancelLanguageServerWork" + } +} +``` + +With this configuration, you can use commands like: + +- `:zlog` - Open the Zed log +- `:newf` - Create a new file +- `:diffs` - Toggle selected diff hunks +- `:crp` - Copy the relative path to the current file +- `:cpp` - Copy the full path to the current file +- `:reveal` - Reveal the current file in the file manager +- `:clank` - Cancel language server work ## Customizing key bindings