欢迎使用 im-select 👋

前提条件
安装
macOS
Homebrew
brew tap daipeihust/tap
brew install im-select
或者你可以在控制台中运行以下命令:
curl -Ls https://raw.githubusercontent.com/daipeihust/im-select/master/install_mac.sh | sh
im-select 程序将被下载到您的 /usr/local/bin/ 路径。
windows
下载 im-select.exe,并将其移动到正确的路径。(如果您需要 64 位版本,可以下载 this one。)
linux
您无需为 linux 安装此程序。linux 拥有切换输入法的工具
Usage
macOS
如果您的 PATH 包含 /usr/local/bin,您可以直接使用 im-select 代替 /usr/local/bin/im-select
获取当前输入法按键
/usr/local/bin/im-select
切换当前输入法
/usr/local/bin/im-select imkey
例如 /usr/local/bin/im-select com.apple.keylayout.US
linux
ibus
@mengbo 提供了此 ibus 配置
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "xkb:us::eng",
"vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/ibus engine",
"vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/ibus engine {im}"
xkb-switch
@VEL4EG 提供了此 xkb-switch 配置
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "us",
"vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/xkb-switch",
"vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/xkb-switch -s {im}"
fcitx
@yunhao94 提供了此 fcitx 配置
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "1",
"vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/fcitx-remote",
"vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/fcitx-remote -t {im}",
gdbus
@d-r-q 为 gdbus 提供此配置
将 gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().currentSource.index" | awk -F'[^0-9]*' '{print $2}' 放入 get-im.sh。
将 gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources[$1].activate()" 放入 set-im.sh。
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "0",
"vim.autoSwitchInputMethod.obtainIMCmd": "<path to get-im.sh>",
"vim.autoSwitchInputMethod.switchIMCmd": "<path to set-im.sh> {im}",
qdbus (KDE)
@igorechek06 提供了此 qdbus 配置
"vim.autoSwitchInputMethod.enable": true,
"vim.autoSwitchInputMethod.defaultIM": "0",
"vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/qdbus org.kde.keyboard /Layouts getLayout",
"vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/qdbus org.kde.keyboard /Layouts setLayout {im}",
windows
im-select.exe 是一个命令行程序,但它无法在 cmd 或 powershell 中运行。这是微软的 bug,键盘 API 不支持在 cmd 和 powershell 中使用。我建议你使用 git-bash。
注意:git-bash 并非必需。它仅用于获取当前输入法按键,这在 VSCodeVim 的配置中是必需的。
Run tests
To get current keyboard locale
/path/to/im-select.exe
切换当前键盘区域设置
/path/to/im-select.exe locale
注意:Windows 中的路径格式如下:C:\Users\path\to\file
作者
🤝 贡献
如果您发现一些问题,欢迎创建拉取请求!
表达您的支持
如果这个项目对您有帮助,请给一个 ⭐️!
如果您喜欢它,请请我喝杯咖啡!如果您有任何问题,可以通过电子邮件联系我!
📝 许可证
本项目依据 MIT 许可证的条款进行授权。