pi-zed-shift-enter
Fixes Shift+Enter not creating newlines in pi when running inside Zed's terminal
Package details
Install pi-zed-shift-enter from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-zed-shift-enter- Package
pi-zed-shift-enter- Version
1.0.1- Published
- Feb 15, 2026
- Downloads
- 15/mo · 5/wk
- Author
- illusivejosiah
- License
- MIT
- Types
- extension
- Size
- 4.4 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"extension.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-zed-shift-enter
Fixes Shift+Enter not creating newlines in pi when running inside Zed's built-in terminal.
Install
pi install git:github.com/illusivejosiah/pi-zed-shift-enter
Or manually copy extension.ts to ~/.pi/agent/extensions/zed-shift-enter.ts.
Problem
Zed's terminal does not support the Kitty keyboard protocol (zed#29756). When you press Shift+Enter in pi inside Zed's terminal, it queues a follow-up message instead of inserting a newline.
Ctrl+J works as an alternative newline key without this extension.
Root Cause
| Key | Bytes sent by Zed | Pi interprets as |
|---|---|---|
| Enter | \x0d (CR) |
Enter — submit |
| Shift+Enter | \x1b\x0d (ESC+CR) |
Alt+Enter — follow-up (wrong) |
| Ctrl+J | \x0a (LF) |
Newline (correct) |
Without Kitty protocol, pi treats the ESC prefix as an Alt modifier, so ESC+CR becomes Alt+Enter instead of Shift+Enter.
This extension intercepts \x1b\x0d and converts it to \x0a (bare LF), which pi's editor recognizes as a newline.
When is this no longer needed?
This extension becomes unnecessary when either:
- Zed implements the Kitty keyboard protocol (zed#29756)
- Pi adds
\x1b\x0das a recognized Shift+Enter variant in the editor's newline detection
License
MIT