forked from rime/rime-pinyin-simp
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 调整目录结构并更新说明 2. 增加自动编辑英文用户字典的功能,详见说明(使用此版本必须更新rime.lua及melt_eng前缀的全部文件) 3. 优化Easy English Nano拼写运算
- Loading branch information
Showing
7 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Rime dictionary | ||
# encoding: utf-8 | ||
# | ||
# Easy English Nano使用的英文自定义词典, | ||
# 方案关闭了自造词,但是可以在输入字符后输入--,lua滤镜会保存键盘字符到此字典中。 | ||
|
||
--- | ||
name: melt_eng_custom | ||
version: "2021.06.12" | ||
#sort: by_weight | ||
use_preset_vocabulary: true | ||
... | ||
|
||
NERV NERV 100 |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,56 @@ | ||
function get_date(input, seg, env) | ||
if ( input == "date") then | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d"), " -")) | ||
elseif ( input == "date-" or input == "time--") then | ||
yield(Candidate("date", seg.start, seg._end, os.date("%m/%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y/%m/%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y.%m.%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y%m%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%B %d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), "")) | ||
elseif ( input == "time" or input == "date---") then | ||
yield(Candidate("time", seg.start, seg._end, os.date("%H:%M"), " -")) | ||
yield(Candidate("time", seg.start, seg._end, os.date("%H:%M:%S"), " -")) | ||
yield(Candidate("time", seg.start, seg._end, os.date("%H%M%S"), " -")) | ||
elseif ( input == "time-" or input == "date--") then | ||
yield(Candidate("date", seg.start, seg._end, os.date("%m/%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y/%m/%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y.%m.%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y%m%d%H%M%S"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%B %d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日 %H:%M"), "")) | ||
elseif ( string.sub(input,-1) == "-") then | ||
if ( input == "date-" or input == "time--") then | ||
yield(Candidate("date", seg.start, seg._end, os.date("%m/%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y/%m/%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y.%m.%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y%m%d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%B %d"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), "")) | ||
elseif ( input == "time-" or input == "date--") then | ||
yield(Candidate("date", seg.start, seg._end, os.date("%m/%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y/%m/%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y.%m.%d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y%m%d%H%M%S"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%B %d %H:%M"), "")) | ||
yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日 %H:%M"), "")) | ||
else | ||
inpu = string.gsub(input,"[-]+$","") | ||
if (string.len(inpu) > 1) then | ||
if ( string.sub(input,-2) == "--") then | ||
-- file = io.open("C:\\Users\\Yazii\\AppData\\Roaming\\Rime\\pinyin_simp_pin.txt", "a") | ||
-- user_path = (rime_api ~= nil and rime_api.get_user_data_dir ~= nil and {rime_api:get_user_data_dir()} or {'%appdata%\\Rime'})[1] | ||
ppath = getCurrentDir() .. "melt_eng_custom.dict.yaml" | ||
-- yield(Candidate("pin", seg.start, seg._end, ppath , "")) | ||
file = io.open(ppath,"a") | ||
file:write("\n" .. inpu .. "\t" .. inpu .. "\t100") | ||
file:close() | ||
yield(Candidate("pin", seg.start, seg._end, inpu , " 已保存")) | ||
else | ||
yield(Candidate("pin", seg.start, seg._end, inpu , " -保存")) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
function getCurrentDir() | ||
function sum(a, b) | ||
return a + b | ||
end | ||
info = debug.getinfo(sum) | ||
path = info.source | ||
path = string.sub(path, 2, -1) -- 去掉开头的"@" | ||
path = string.match(path, "^(.*[\\/])") -- 捕获目录路径 | ||
spacer = string.match(path,"[\\/]") | ||
path=string.gsub(path,'[\\/]',spacer) | ||
return path | ||
end |