Introduction

When writing prompts in DSH Web Composer, the lack of line history navigation and autocompletion commonly found in terminals significantly reduces editing efficiency. The dsh-client-ui-quickfill plugin brings the Shell’s scrollback mechanism to the browser, providing historical recall, fuzzy search, and autocompletion through keyboard shortcuts, aiming to improve the fluency of prompt writing.

Core Features

History Navigation

The plugin supports two history recall modes:
1. Multi-line draft: Use Alt+Up and Alt+Down to browse history cyclically.
2. Single-line draft: Use the Up and Down keys.
In single-line mode, pressing Up for the first time triggers zsh’s up-line-or-search logic: if the current draft is a prefix of a history entry, the cursor jumps to that entry and continues searching under that prefix.

Press Ctrl+R (Windows/Linux) or Cmd+R (macOS) to open a fuzzy search selector. Entered text narrows the matching scope (subsequence matching), use Up/Down to select entries, press Ctrl+R again to move to the next match (reverse search). Press Enter to populate the content, and Esc to close the selector.

Autocompletion

During input, if there is a recent history entry that matches the beginning of the current draft, the plugin displays a gray ghost layer (Fish-style autocompletion) after the cursor. Press Tab or Right Arrow at the end to accept the suggestion.

Draft Protection and Data Storage

The plugin preserves the current draft state and cursor position. When switching back to the latest history entry or pressing Esc, the previous content is restored. Consecutive duplicate history entries are collapsed, and empty prompts are not recorded. IME input (such as Chinese pinyin) is not disrupted.

The plugin provides an optional cross-session history pool feature, using localStorage to expand the search scope. It is disabled by default to protect privacy.

Installation and Enablement

Install the Plugin

Use the official command to install the plugin package:

dsh plugin --profile web add dsh-client-ui-quickfill

Configure Dependencies

Edit ~/.dsh/profiles/web/package.json and add the following to dependencies:

{
  "dependencies": {
    "dsh-client-ui-quickfill": "^0.1.0"
  }
}

Restart the Service

After installation, the dsh web service must be restarted. As a self-registering Bundle, the plugin automatically scans cordis.patch.yml and injects UI components into the window.__DSH_BOOT__ startup graph.

Usage

  • Recall history: Press Alt+Up or Alt+Down to cycle through historical prompts.
  • Fuzzy search: Press Ctrl+R to open the search box and enter keywords to find history entries.
  • Accept completion: While typing, press Tab or → to accept the gray autocompletion suggestion.
  • Exit and restore: Press Esc to close the search box or restore the current draft and cursor position.

Applicable Scenarios and Notes

  • Environment requirements: Requires a DSH Web Profile (version 0.1.0-rc.8 or later) and a pnpm environment.
  • Cross-platform differences: macOS users should note that Cmd+R is also the browser’s refresh shortcut and may conflict.
  • Input state limitations: While using a slash command or when sending a message is in progress, Ctrl+R is intercepted. Press Esc first to exit that state.
  • Font compatibility: In some custom theme fonts, the ghost completion layer may be displaced by 1-2px.
  • Privacy and data: Cross-session history is stored locally in the browser and disabled by default. To enable it, manually turn on the relevant switch in Local Storage.

Summary

By reusing terminal interaction habits, this plugin provides efficient history management and autocompletion capabilities for DSH Web Composer. All data is stored locally in the browser and does not involve server transmission, making it suitable for developers who frequently debug prompts.

GitHub repository
Community directory