Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>caret-colorNew to Visual Studio Code? Get it now.
caret-color

caret-color

gezhanling

|
1 install
| (0) | Free
根据当前输入法自动切换编辑器光标颜色
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

caret-color

VSCode 插件:根据当前输入法自动切换编辑器光标颜色

英文输入法:光标保持 VSCode 默认颜色 中文 / 其他输入法:光标变为红色,醒目提醒

✨ 功能简介

写代码时经常忘记输入法处于中文状态,打出中文标点打断编码节奏。 本插件监听系统输入法状态,以光标颜色作为近距离提示:

  • 英文输入法:光标沿用 VSCode 默认样式
  • 非英文输入法:光标切换为洋红色

仅作用于代码编辑器输入光标,不改动终端、选中文本高亮、主题其他颜色。

💻 平台支持

平台 检测方式 依赖
Windows PowerShell + Win32 IMM(区分中文输入法的中/英模式) 系统自带 PowerShell
macOS osascript (JXA) + Carbon TIS,读取当前输入源 ID 系统自带
Linux fcitx5-remote / fcitx-remote / ibus engine,自动选择正在运行的框架 fcitx5、fcitx 或 ibus 之一

macOS 与 Linux ibus 按输入源 ID 判断:ABC、US 等英文键盘布局视为英文,其余视为非英文。 如果你的英文输入源不在默认列表中,可通过 caret-color.englishInputSources 配置;实际 ID 可在「输出」面板的 Caret Color 频道查看。 macOS 上中文输入法内部的中/英切换(如按 Shift)无法通过系统接口获取,仅能识别输入源本身的切换。

⌨️ 命令(Ctrl+Shift+P)

  • Caret Color: Reload IME Watcher 重启输入法监听
  • Caret Color: Disable Auto Color 临时关闭自动变色
  • Caret Color: Enable Auto Color 开启自动变色

⚙️ 配置项(settings.json)

{
  "caret-color.enable": true,
  "caret-color.otherImeColor": "#ff3333",
  // 视为英文的输入源(正则,整串匹配),留空使用内置默认值
  "caret-color.englishInputSources": []
}

caret-color

VS Code extension that automatically changes the editor caret color based on the current input method.

English input method: the caret keeps the default VS Code color. Chinese / other input methods: the caret turns red as a noticeable reminder.

Features

When writing code, it is easy to forget that the input method is set to Chinese and accidentally type Chinese punctuation, breaking your coding flow. This extension monitors the system input method and uses the caret color as a nearby reminder:

  • English input method: the caret keeps the default VS Code style.
  • Non-English input method: the caret turns magenta.

It only affects the insertion caret in code editors. It does not change the terminal, selection highlights, or other theme colors.

Platform Support

Platform Detection Method Dependency
Windows PowerShell + Win32 IMM (distinguishes between Chinese and English modes of Chinese input methods) PowerShell included with the system
macOS osascript (JXA) + Carbon TIS to read the current input source ID Included with the system
Linux fcitx5-remote / fcitx-remote / ibus engine, automatically detecting the active framework One of fcitx5, fcitx, or ibus

On macOS and Linux with ibus, input methods are identified by input source ID. English keyboard layouts such as ABC and US are treated as English; all others are treated as non-English. If your English input source is not in the default list, configure it through caret-color.englishInputSources. You can find the actual ID in the Caret Color channel of the Output panel. On macOS, system APIs cannot detect the internal Chinese/English mode switch of a Chinese input method (for example, pressing Shift). Only switching the input source itself can be detected.

Commands (Ctrl+Shift+P)

  • Caret Color: Reload IME Watcher — restart the input method watcher
  • Caret Color: Disable Auto Color — temporarily disable automatic color switching
  • Caret Color: Enable Auto Color — enable automatic color switching

Configuration (settings.json)

{
  "caret-color.enable": true,
  "caret-color.otherImeColor": "#ff3333",
  // Input sources treated as English (regular expressions matched against the entire string).
  // Leave empty to use the built-in defaults.
  "caret-color.englishInputSources": []
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft