-
Notifications
You must be signed in to change notification settings - Fork 43
Home
Welcome to the librime-lua wiki!
-
Prepare the compiled file (or the latest artifact in actions).
-
Extract
rime-xxxx-Windows.7z/dist/lib/rime.dll
file and overwrite it to therime.dll
file under the weasel installation directory.
-
Create
PATH_TO_RIME_USER_DATA_DIR/rime.lua
:function date_translator(input, seg) if (input == "date") then --- Candidate(type, start, end, text, comment) yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), " 日期")) end end function single_char_first_filter(input) local l = {} for cand in input:iter() do if (utf8.len(cand.text) == 1) then yield(cand) else table.insert(l, cand) end end for i, cand in ipairs(l) do yield(cand) end end
More sample: rime.lua
Documentation: wiki
-
Reference Lua functions in your schema:
engine: ... translators: ... - lua_translator@date_translator - lua_translator@other_lua_function1 ... filters: ... - lua_filter@single_char_first_filter - lua_filter@other_lua_function2
-
Deploy & try
- librime >= 1.5.0
- LuaJIT 2 / Lua 5.1 / Lua 5.2 / Lua 5.3 / Lua 5.4
-
Prepare source code
Move the source to the
plugins
directory of librime:mv librime-lua $PATH_TO_RIME_SOURCE/plugins/lua
Or you can use the
install-plugins.sh
script to automatically fetch librime-lua:cd $PATH_TO_RIME_SOURCE bash install-plugins.sh hchunhui/librime-lua
-
Install dependencies
Install development files of Lua:
# For Debian/Ubuntu: sudo apt install liblua5.3-dev # or libluajit-5.1-dev
The build system will use
pkg-config
to search Lua.The build system also supports building Lua from source in the
thirdparty
directory. Thethirdparty
directory can be downloaded using the following commands:cd $PATH_TO_RIME_SOURCE/plugins/lua git clone https://github.com/hchunhui/librime-lua.git -b thirdparty --depth=1 thirdparty
-
Build
Follow the librime's build instructions.
# On Linux, merged build make merged-plugins sudo make install
For more information on RIME plugins, see here.