MoonshotAI / MoonshotAI/kimi-cli
[Windows] Ctrl+V 无法在 Windows Terminal 中粘贴图片,建议添加 Alt+V 备选快捷键
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
问题描述
在 Windows Terminal 中使用 Kimi Code CLI 时,Ctrl+V 快捷键无法粘贴剪贴板中的图片。这是因为 Windows Terminal 默认会拦截 Ctrl+V 用于自身的粘贴操作,导致该快捷键无法传递给 Kimi CLI。
复现步骤
- 在 Windows 系统上打开 Windows Terminal
- 启动 Kimi Code CLI (
kimi) - 复制一张图片到剪贴板(如截图工具)
- 在 Kimi CLI 输入框中按
Ctrl+V - 观察结果:图片没有被粘贴,或者只能粘贴图片的路径文本(而非图片本身)
预期行为
按下粘贴快捷键后,剪贴板中的图片应该被识别并转换为 [image:xxx.png,WxH] 占位符插入到输入框中。
实际行为
Ctrl+V被 Windows Terminal 拦截- 无法通过键盘快捷键粘贴图片
- 用户只能使用鼠标右键粘贴(替代方案)
环境信息
- 操作系统: Windows 10/11
- 终端: Windows Terminal (默认配置)
- Kimi CLI 版本: 最新版
- 安装方式:
uv tool install kimi-cli
参考:Claude Code 的解决方案
Claude Code 在 Windows 上同时支持以下两种快捷键来粘贴图片:
Ctrl+V- 标准粘贴快捷键Alt+V(或M-V) - Windows Terminal 备选快捷键
这确保了在 Windows Terminal 拦截 Ctrl+V 的情况下,用户仍然可以使用 Alt+V 粘贴图片。
相关代码参考(Claude Code 的实现):
# 同时绑定两个快捷键
@_kb.add("c-v", eager=True)
@_kb.add("escape", "v", eager=True) # Alt+V
建议的解决方案
在 kimi_cli/ui/shell/prompt.py 中,为粘贴功能添加 Alt+V 备选快捷键:
if is_clipboard_available():
@_kb.add("c-v", eager=True)
@_kb.add("escape", "v", eager=True) # 添加 Alt+V 支持
def _(event: KeyPressEvent) -> None:
if self._try_paste_image(event):
return
clipboard_data = event.app.clipboard.get_data()
event.current_buffer.paste_clipboard_data(clipboard_data)
clipboard = PyperclipClipboard()
else:
clipboard = None
临时解决方案(用户侧)
在等待官方修复之前,Windows 用户可以:
- 使用鼠标右键粘贴 - Windows Terminal 支持右键点击粘贴剪贴板内容
- 修改 Windows Terminal 设置 - 取消
Ctrl+V的默认粘贴绑定,让其传递给应用程序 - 使用文件引用 - 将图片保存为文件,然后用
@filename.png引用
附加信息
- 相关文档:https://moonshotai.github.io/kimi-cli/zh/reference/keyboard.html
- 代码位置:
kimi_cli/ui/shell/prompt.py第 710-721 行
感谢开发者的辛苦工作!希望这个小的改进能让 Windows 用户的使用体验更加顺畅。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in kimi_cli/ui/shell/prompt.py around lines 710-721 and inspect the existing image-paste key binding and _try_paste_image flow. Reproduce the behavior in Windows Terminal, then verify that Alt+V inserts the same image placeholder while Ctrl+V and mouse-paste behavior remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 66/100