refactor: init the repo and decide to add more feature
This commit is contained in:
@@ -6,7 +6,7 @@ local buf_opts = {
|
||||
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
for k, v in pairs(buf_opts) do
|
||||
vim.api.nvim_buf_set_options(buf, k, v)
|
||||
vim.api.nvim_buf_set_option(buf, k, v)
|
||||
end
|
||||
|
||||
M.buf = buf
|
||||
|
||||
@@ -1,27 +1,21 @@
|
||||
local M = {}
|
||||
|
||||
-- INFO :加载的规则 [LuaRule]
|
||||
M.replace_rules = {
|
||||
'order',
|
||||
'Trans.+',
|
||||
}
|
||||
|
||||
M.conf = {
|
||||
style = {
|
||||
window = {
|
||||
ui = {
|
||||
input = 'float',
|
||||
cursor = 'cursor',
|
||||
select = 'cursor'
|
||||
},
|
||||
order = {
|
||||
'title',
|
||||
'tag',
|
||||
'pos',
|
||||
'exchange',
|
||||
'zh',
|
||||
'en',
|
||||
'Title',
|
||||
'Tag',
|
||||
'Pos',
|
||||
'Exchange',
|
||||
'Translation',
|
||||
'Definition',
|
||||
},
|
||||
conf = {
|
||||
window = {
|
||||
-- NOTE :可选的风格:['fixed', 'relative', .. TODO]
|
||||
-- width 和 height说明:
|
||||
-- 大于1:
|
||||
@@ -44,6 +38,12 @@ M.conf = {
|
||||
width = 0.8,
|
||||
height = 0.9,
|
||||
},
|
||||
-- NOTE :如果你想限制某个组件的行数,可以设置 (名称与order相同)
|
||||
-- Example:
|
||||
-- limit = {
|
||||
-- En = 1, -- 只显示第一行,(一般为最广泛的释义)
|
||||
-- },
|
||||
limit = nil,
|
||||
},
|
||||
},
|
||||
ui = {
|
||||
@@ -107,4 +107,10 @@ M.conf = {
|
||||
-- TODO register word
|
||||
}
|
||||
|
||||
-- INFO :加载的规则 [LuaRule]
|
||||
M.replace_rules = {
|
||||
'order',
|
||||
'Trans.+',
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
local M = {}
|
||||
local conf = require("Trans").conf.view
|
||||
local conf = require("Trans.conf").style.window
|
||||
local type_check = require("Trans.util.debug").type_check
|
||||
|
||||
-- FIXME
|
||||
|
||||
local get_float_opts = function(float_conf)
|
||||
type_check {
|
||||
float_conf = { float_conf, 'table' },
|
||||
}
|
||||
local columns = vim.o.columns
|
||||
local height = vim.o.lines - vim.o.cmdheight - float_conf.top_offset
|
||||
local width = math.floor(columns * float_conf.relative_width)
|
||||
@@ -21,6 +27,9 @@ local get_float_opts = function(float_conf)
|
||||
end
|
||||
|
||||
local get_cursor_opts = function(cursor_conf)
|
||||
type_check {
|
||||
cursor_conf = { cursor_conf, 'table' },
|
||||
}
|
||||
local opts = {
|
||||
relative = 'cursor',
|
||||
col = 2,
|
||||
|
||||
Reference in New Issue
Block a user