dsh-ctrl-enter-send: Enter for newline, Ctrl+Enter to send

Introduction

When writing long prompts in DSH, many habits brought over from IMs or editors conflict: DSH defaults to sending with Enter, so to break a paragraph or list several requirements in the composer, you have to change it to Shift+Enter. More troublesome is the Chinese input method—switching to English mode and pressing Enter to line break would send half the prompt directly. dsh-ctrl-enter-send is a plugin that reverses these shortcuts: Enter inserts a line break, and Ctrl+Enter (Cmd+Enter on macOS) sends. It targets developers who write long inputs in the DSH composer daily. It does not touch other interfaces or redefine the send behavior.

What is this plugin

One-sentence positioning: It modifies the Enter send key in the DSH main composer, moving the send key from Enter to Ctrl/Cmd+Enter. It is maintained by community developer Geopanret (the author field in package.json is Maloseri). It is a client-side plugin, not an official DeepSeek package.

The problem solved is specific: When the Chinese IME is in English mode, pressing Enter to line break sends the unfinished prompt directly to the AI, requiring a resend or adding explanations.

Core Behavior

The plugin only modifies the key mapping of the main conversation composer; other interfaces remain unchanged. The comparison before and after is as follows.

Operation (Focus on main composer input box) Before After
Enter Send (queueing or steering if executing) Line break, equivalent to Shift+Enter
Shift+Enter Line break Line break, unchanged
Ctrl+Enter / Cmd+Enter Supplemental Delivery Mode Send, consistent with the “Send” button behavior
Pressing Enter when / or @ menu is open Select highlighted item Unchanged
Pressing Enter while IME is composing Confirm composition Unchanged
Empty draft + Ctrl+Enter (messages executing and queue exists) Steering all Unchanged
Alt+Enter, Ctrl+Shift+Enter, AltGraph+Enter Built-in mapping ignored Unchanged
Rename, inline edit, settings, popups, issue cards Unaffected Unchanged

One thing to note: The shortcut reference page and settings page still display built-in fixed entries “Enter = Send” and “Cmd/Ctrl+Enter = Supplemental Delivery”. These entries belong to the built-in package and cannot be rewritten by third-party plugins. This means the documentation is inconsistent with the actual behavior; you should look at the real key behavior, not the reference sheet.

Another trade-off is: The original “Supplemental Delivery” semantics of Ctrl+Enter have been replaced with the send gesture, which is exactly the plugin’s purpose; the “steer all queued messages” gesture for empty drafts is intentionally preserved.

Installation

The plugin is distributed from GitHub as a DSH bundle. Install it using the DSH CLI’s git install path and it is recommended to pin the release tag:

dsh plugin --profile <your-profile> add github:Geopanret/dsh-ctrl-enter-send#v0.1.0

A few details:

  1. This is a bundle-type plugin. After installation, it is appended to the profile’s dsh.profile.bundles. It takes effect on the next page load; refreshing the page is sufficient, no need to restart DSH.
  2. Pinning a tag or commit (e.g., github:Geopanret/dsh-ctrl-enter-send#<sha>) avoids content running on your machine quietly changing due to subsequent pushes; omitting #<ref> tracks the default branch.
  3. No build steps or approval for install scripts are needed. This is pure JavaScript, published directly as browser artifacts (where client.js is the complete browser bundle). pnpm does not need allowBuilds configured.

Uninstalling is also done via CLI:

dsh plugin --profile <your-profile> remove dsh-ctrl-enter-send

You can also operate on the Plugins page.

Compatibility

Requires DSH >=0.2.0 <0.3.0, declared in engines.dsh. The author has tested it on 0.2.1-rc.5. If the version is out of bounds, the plugin may not load. Confirm your DSH version before installing.

Implementation and Failure Conditions

The plugin is purely client-side: When the page loads, it installs a capture-phase keydown listener on window, rewriting the event object’s modifier key flags, causing the composer’s existing keymap to take its own line break branch (Shift+Enter) or send branch (normal Enter). The mapping provided in the original text is:

  • Normal Enter → Set shiftKey to true, take the built-in line break;
  • Ctrl/Cmd+Enter on non-empty draft → Set ctrlKey/metaKey to false, take the built-in send;
  • Empty draft preserves the built-in Cmd/Ctrl+Enter “steer all” gesture;
  • Menus, IME composition, Alt/AltGraph, and other inputs remain unchanged.

It relies on these DOM markers from DSH 0.2.1-rc.x: [data-composer-input], [data-composer-card], [data-trigger-menu], [data-composer-overlay], [data-composer-placeholder]. If any marker is not found, the plugin falls back to built-in behavior without guessing—the worst case is “no change,” and it won’t accidentally send. If rewriting event markers is not feasible in certain environments, the plugin will stop the original event and fire a synthetic Enter with the expected markers.

Who is it for, and Precautions

Suitable for the following people: Those who usually write multiple paragraphs or multiple requirements in the composer, want Enter to preserve the line break habit, and are willing to press Ctrl+Enter to send. The use case of wanting to keep the default Enter send and only occasionally using Shift+Enter is not its target scenario.

Three points worth checking before use:

  1. The plugin runs with the permissions of the current DSH process and is a community package. You should open client.js and index.js to review the implementation before installing to confirm there is no behavior beyond your expectations; the license is MIT.
  2. The inconsistency between the shortcut reference page and the actual behavior is a known limitation of this plugin, not a bug; do not change your operating habits based on the reference sheet.
  3. DSH upgrades may rename data-composer-* markers. At this time, the plugin will silently fall back to built-in keys. After upgrading, you need to check and update the selectors in client.js yourself.

Development

For local debugging, use the same CLI, adding the local path to the dev profile:

dsh plugin --profile <dev-profile> add /path/to/dsh-ctrl-enter-send

client.js is the complete client bundle, with no build steps; changes are picked up directly by DSH’s client HMR listener, so no restart of DSH is needed. Changes to the server-side index.js require a restart.

Summary

The value of this plugin lies in changing a key habit that is easy to fall into a trap with, and the scope of change is restrained: it only modifies the Enter semantics of the main composer; menus, composition, and other inputs remain exactly as they are. It is a community plugin (package.json notes “community plugin, not an official DeepSeek package”), installed via DSH CLI from GitHub, pinned to tag v0.1.0.

Directory: https://www.skillhub.cn/plugins/Geopanret/dsh-ctrl-enter-send

Source: https://github.com/Geopanret/dsh-ctrl-enter-send

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye