We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
以VV开头的字符串(其中可能有a-zA-Z0-9),然后去掉VV这两个字母直接上屏
小鹤双拼 double_pinyin_flypy
weasel 0.16.3
Win11
有时候需要输入一些字母与数字混杂的字符串,又不想切换输入法,就想在字符串前面加上VV开头,希望能够在最后按下回车后,去掉VV开头、把剩余的其他字符串直接上屏,请问如何实现?如何打一个补丁?
No response
The text was updated successfully, but these errors were encountered:
看描述,挺像我之前写的一个插件,当时用的是 `P 做前缀,输入一遍就记住这样:
不过用的是 lua_translator,不懂的话不好入手。
用原版配置还真没想过怎么好做到,看看有没有简单的办法。
Sorry, something went wrong.
我自己写了lua,一直没有调试成功,代码如下:
-- 方案文件配置, -- recognizer/patterns/vv_prefix_text: "^VV([0-9]|10|[A-Za-z]+)$" local rime = require "rime" -- 初始化符号输入的状态 local function init(env) -- 读取 RIME 配置文件中的引导符号模式 local config = env.engine.schema.config local vv_prefix_text = config:get_string("recognizer/patterns/vv_prefix_text") -- 生成单引导符和双引导符模式 env.vv_prefix_pattern = vv_prefix_text -- rime.log("init" .. vv_prefix_text) end -- 处理符号和文本的重复上屏逻辑 local function processor(key_event, env) local engine = env.engine local context = engine.context local input = context.input -- 当前输入的字符串 -- 1. 检查是否输入的编码为双引导符 ;;,用于汉字或字母重复上屏 -- local vv_prefix_pattern = "^VV([0-9]|10|[A-Za-z]+)$" if key_event.keycode == 0xff0d and key_event:release() then if string.match(input, env.vv_prefix_pattern) then rime.log("enter VV prefix" .. input) local remaining_input = string.sub(input, 3) engine:commit_text(remaining_input) -- 上屏上次的汉字或文本 context:clear() -- 清空输入 return 1 -- 捕获事件,处理完成 end end -- rime.log("enter VV prefix") return 2 -- 未处理事件,继续传播 end -- 导出到 RIME return { init = init, func = processor }
能看看你的代码吗?或者帮我看看问题在什么地方?我还不会使用debug功能来寻找问题所在
No branches or pull requests
摘要
以VV开头的字符串(其中可能有a-zA-Z0-9),然后去掉VV这两个字母直接上屏
输入方案
小鹤双拼 double_pinyin_flypy
相关应用
weasel 0.16.3
系统信息
Win11
详细说明
有时候需要输入一些字母与数字混杂的字符串,又不想切换输入法,就想在字符串前面加上VV开头,希望能够在最后按下回车后,去掉VV开头、把剩余的其他字符串直接上屏,请问如何实现?如何打一个补丁?
自定义配置
No response
The text was updated successfully, but these errors were encountered: