🌍 简体中文 | English
Winime 是一款专为 Neovim 设计的智能输入法切换插件,能够根据编辑上下文和编辑模式自动切换系统输入法,
让你在编写代码和注释时无需手动切换,大幅提升混合语言编辑效率。
|
|
在使用 Winime 之前,请确保您的环境满足以下要求:
注意: 目前暂不支持 macOS 和 Linux 系统
Neovim 0.10.0 或更高版本
如果版本过低,请前往官网下载最新版本:
Download Neovim
系统必须安装至少 2 种输入法
(一种其它语言输入法 + 一种英文输入法)
| 推荐配置 | 示例 |
|---|---|
| 其它输入法 | 微软拼音、微软五笔 |
| 英文输入法 | 美国英语、英国英语 |
| 输入法 | 兼容性 | 推荐度 |
|---|---|---|
| 系统自带输入法 | ✅ 优秀 | ⭐⭐⭐⭐⭐ |
| 第三方输入法 | ⭐⭐ | |
| 同一输入法的不同输入模式 | ❌ 完全不支持 |
建议: 为确保最佳体验,请优先使用 Windows 自带的微软输入法
使用 lazy.nvim
return {
"StellarDeca/winime.nvim",
opts = {
winime_core = {
grammer_analysis_mode = "Auto", -- 可选: "Auto" | "TreeSitter" | "String"
},
},
event = { "VimEnter", "VeryLazy" },
dependencies = (function()
-- ⚠️ 注意: mode 应与 opts.winime_core.grammer_analysis_mode 一致
local mode = "Auto"
if mode == "TreeSitter" then
return { "nvim-treesitter/nvim-treesitter" }
elseif mode == "Auto" then
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufEnter", "BufNewFile" },
}
end
return {}
end)(),
}使用 packer.nvim
use {
'StellarDeca/winime.nvim',
config = function()
require('winime').setup({
winime_core = {
grammer_analysis_mode = "Auto",
},
})
end
}| 模式 | 说明 | 优点 | 缺点 |
|---|---|---|---|
| 🤖 Auto | 自动选择最佳模式 | 智能切换,最佳体验 | 需要 TreeSitter |
| 🌲 TreeSitter | 基于语法树分析 | 精确度高 | 需要 TreeSitter 支持, 对于大型文件存在性能问题 |
| 📝 String | 基于字符串模式 | 无依赖 | 对于中大型文件存在性能问题,精度略微存在不足 |
| 命令 | 描述 |
|---|---|
:WinimeReload |
🔄 重新载入插件(将会完全使用默认配置并再次探测输入法) |
:WinimeUnload |
🔌 卸载 Winime(移除自动命令与绑定) |
:WinimeFileTypeAvaliable |
📄 列出当前支持的文件类型 |
🔴 首次启动自动探测失败?
请确认系统安装了至少两种输入法。若仍失败,请删除缓存目录:
# Windows
~/AppData/Local/nvim-data/winime然后重启 Neovim。
🔎 如何优化 Winime 的启动时长?
若希望避免 Winime 随 Neovim 一同启动,可在 lazy.nvim 配置中为其指定其他启动事件。
🟡 修改启动条件后插件报错?
确保 Winime 在相关自动命令触发前已正确加载:
BufEnterBufNewFileCursorMovedInsertEnterTextChangedICursorMovedIInsertLeave
🟢 支持 Mac / Linux 吗?
默认仅支持 Windows(使用 im-select.exe)。要支持其他平台:
- 替换
lua/winime/tools/im-select.exe为对应平台工具 - 在
lua/winime/tools/method.lua中实现对应平台的lua method api - 检查输入法区域ID是否适配对应平台
- 欢迎提交 PR 贡献代码 💪
🔒 隐私问题?会收集敏感信息吗?
绝对不会! Winime:
- ❌ 不会上传任何数据
- ❌ 不会分享任何日志
- ✅ 仅在本地保存必要的分析历史
- ✅ 所有数据仅存储在本地文件夹
- 🔤 标点统一替换 - 在 Insert 模式下智能替换中英文标点
- 支持按 filetype 配置
- 支持自定义替换表
- 上下文感知替换策略
- 📊 多系统支持
- 🐧 Linux 支持
- 🍎 MacOS 支持
欢迎提交 Issue 和 Pull Request!
- 主程序: GNU GPLv3 - 详见仓库根目录
- im-select.exe: MIT License - 来自 im-select 项目
如果这个项目对你有帮助,请给一个 ⭐ Star 支持一下!
Made with ❤️ by StellarDeca


