Closed grassvalley closed 1 year ago
special_table 文件已经不再使用了,请使用 Lua 脚本扩展。
你好,能否给出一个 lua 脚本的示例,就以上面的几个特殊符号为例。另外,脚本如何命名,存放到哪里? 我自己要是从头摸索,估计要很长时间了。 谢谢!
请在设置对话框选择 "用户数据" 页面,编辑用户 Lua 脚本。
将如下代码填入文件中:
_SYMBOL_TABLE = {
['wujiaoxing'] = {"★", "☆"},
['sanjiaoxing'] = {"▲", "△"},
['zhijing'] = {"Ø"},
['duihao'] = {"√"},
['chu'] = {"÷"},
['sheshidu'] = {"℃"},
}
function getSymbolFromTable(input)
local ret
ret = _SYMBOL_TABLE[input]
return ret
end
ime.register_trigger("getSymbolFromTable", "常用符号", {'*'}, {})
输入 "wujiaoxing", 试试。
可能需要重新登陆的。
OK,测试成功,谢谢! 不需要重新登陆,只要来回切换下输入法就行。
不客气。
把我整理的特殊符号编码贴出来,万一也有人需要呢?
` _SYMBOL_TABLE = { ['wujiaoxing'] = {"★", "☆"}, ['wjx']= {"★", "☆"}, ['sanjiaoxing'] = {"▲", "△"}, ['sjx']={"▲", "△"}, ['yuanquan']={"○","●"}, ['yq']={"○","●"}, ['fangkuang']={'□','■'}, ['fk']={'□','■'}, ['du']={'°'}, ['jiaodu']={'∠'}, ['jd']={'∠'}, ['sheshidu'] = {"℃"}, ['ssd']={"℃"}, ['baifenhao']={'﹪'}, ['bfh']={'﹪'}, ['qianfenhao']={'‰'}, ['qfh']={'‰'}, ['wanfenhao']={'‱'}, ['wfh']={'‱'}, ['wuqiongda']={'∞'}, ['wqd']={'∞'}, ['xiaoyudengyu']={'≤'}, ['xydy']={'≤'}, ['dayudengyu']={'≥'}, ['dydy']={'≥'}, ['chu'] = {"÷"}, ['cheng']={'×'}, ['cha']={'×'}, ['ch']={'×','÷'}, ['zhijing'] = {"Ø"}, ['zj']={"Ø"}, ['pingfangmi']={'㎡'}, ['pfm']={'㎡'}, ['lifangmi']={'m³'}, ['lfm']={'m³'}, ['limi']={'㎝'}, ['lm']={'㎝'}, ['qianmi']={'㎞'}, ['qm']={'㎞'}, ['haomi']={'㎜'}, ['hm']={'㎜'}, ['qianke']={'㎏'}, ['qk']={'㎏'}, ['duihao'] = {"√"}, ['jiantou']={'←','→','↑','↓'}, ['jt']={'←','→','↑','↓'}, ['shangbiao']={'®','Ⓡ'}, ['sb']={'®','Ⓡ'}, ['heji']={'Σ'}, ['hj']={'Σ'}, ['yuanquanshuzi']={'①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'}, ['yqsz']={'①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'}, ['kuohaoshuzi']={'㈠','㈡','㈢','㈣','㈤','㈥','㈦','㈧','㈨','㈩'}, ['khsz']={'㈠','㈡','㈢','㈣','㈤','㈥','㈦','㈧','㈨','㈩'}, }
function getSymbolFromTable(input) local ret ret = _SYMBOL_TABLE[input] return ret end
ime.register_trigger("getSymbolFromTable", "常用符号", {'*'}, {}) `
谢谢分享!
Where is this lua script located? Thanx
The Lua script is in the ~/.config/ibus/libpinyin/user.lua
file.
The Lua script is in the
~/**.config**/ibus/libpinyin/user.lua
file.
Good idea! In future versions of libpinyin, please consider moving other user files from ~/.cache to ~/.config. Thanx
能否通过自定义功能,直接输入特殊符号,比如: wujiaoxing ★ ☆ sanjiaoxing ▲△ zhijing Ø duihao √ chu ÷ sheshidu ℃
下面这个文件似乎想要实现类似的功能,是不是已经废弃了? https://github.com/libpinyin/ibus-libpinyin/blob/37860481044afd21821988240878642bdec6d796/src/special_table