A Zed editor extension that provides syntax highlighting for
Kanata keyboard configuration files (.kbd).
- 🎨 Syntax highlighting for
.kbdfiles via tree-sitter-kanata - 🔄 Auto-indentation for better code formatting
- 🔗 Bracket matching to help with nested configurations
- 💬 Comment support with line comments (
;;) - 🔍 Real-time error diagnostics via custom Rust-based LSP server
- Automatically downloaded and installed on first use
- Available for macOS (x86_64, ARM64), Linux (x86_64, ARM64), and Windows (x86_64, ARM64)
- Powered by the official kanata-parser
- 🎯 Go-to-definition for aliases and layer names
- Jump to
defaliasdefinitions from@aliasreferences - Navigate to
deflayerdefinitions from layer name references
- Jump to
- ✨ Auto-formatting to align
deflayerblocks according todefsrclayout- Preserves the spatial keyboard layout from
defsrc - Automatically aligns all keys in deflayers for better readability
- Preserves the spatial keyboard layout from
Once published to the Zed extension registry:
- Open Zed
- Open the command palette (
Cmd+Shift+Pon macOS,Ctrl+Shift+Pon Linux/Windows) - Search for "zed: extensions"
- Search for "kanata" and install
To install the development version:
- Clone this repository:
git clone https://github.com/willpuckett/zed-kanata.git
cd zed-kanata- In Zed:
- Open the command palette (
Cmd+Shift+P/Ctrl+Shift+P) - Run "zed: install dev extension"
- Select the
zed-kanatadirectory
- Open the command palette (
The extension will automatically compile and install. The LSP server binary will be automatically downloaded from GitHub releases on first use.
Once installed, the extension automatically activates when you open any .kbd
file, providing:
- Syntax highlighting for all Kanata configuration syntax
- Auto-indentation for nested expressions
- Bracket matching and navigation
Create a file with the .kbd extension:
;; My Kanata Configuration
(defcfg
process-unmapped-keys yes
danger-enable-cmd no
)
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet menu rctl
)
(deflayer default
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)
- Ensure you have the latest version of Zed
- Check that the extension is properly installed via the extensions menu
- Try reinstalling the dev extension
- Ensure the file has a
.kbdextension - Restart Zed after installation
- Check Zed's logs (
~/Library/Logs/Zed/Zed.logon macOS) for errors
MIT License
- ⌨️ Kanata - The keyboard remapper this extension supports
- 🌳 tree-sitter-kanata - Tree-sitter grammar for Kanata (used by this extension)
- 💻 vscode-kanata - VSCode extension for Kanata with language server support
- Publish to Zed extension registry
- Language server integration for diagnostics
- Go-to-definition for aliases and layers
- Formatting support for aligning deflayer blocks
- Code snippets for common Kanata patterns
- Hover information for key codes and actions
Note: This is an unofficial extension and is not affiliated with the official Kanata project.