Trans.nvim/lua/Trans/setup.lua

61 lines
1.2 KiB
Lua
Raw Normal View History

2023-01-05 16:24:50 +08:00
if vim.fn.executable('sqlite3') ~= 1 then
error('Please check out sqlite3')
end
2022-12-20 10:22:28 +08:00
2023-01-14 01:57:12 +08:00
vim.api.nvim_create_user_command('Translate', function()
2023-01-09 23:20:56 +08:00
require("Trans").translate()
end, {
desc = ' 单词翻译',
})
2022-12-20 10:22:28 +08:00
2023-01-14 01:57:12 +08:00
vim.api.nvim_create_user_command('TranslateInput', function()
require("Trans").translate('input')
end, { desc = ' 搜索翻译' })
local highlights = {
TransWord = {
fg = '#7ee787',
bold = true,
},
TransPhonetic = {
link = 'Linenr'
},
TransRef = {
fg = '#75beff',
bold = true,
},
TransTag = {
fg = '#e5c07b',
},
TransExchange = {
link = 'TransTag',
},
TransPos = {
link = 'TransTag',
},
TransTranslation = {
link = 'TransWord',
},
TransDefinition = {
-- fg = '#bc8cff',
link = 'Moremsg',
},
TransCursorWin = {
link = 'Normal',
},
TransCursorBorder = {
link = 'FloatBorder',
2023-01-09 23:20:56 +08:00
}
2023-01-14 01:57:12 +08:00
}
2023-01-09 23:20:56 +08:00
2023-01-14 01:57:12 +08:00
-- TODO
2023-01-09 23:20:56 +08:00
-- vim.api.nvim_create_user_command('TranslateHistory', require("Trans.core").query_input, {
-- desc = '翻译输入的单词',
-- })
2023-01-04 22:22:52 +08:00
for highlight, opt in pairs(highlights) do
2023-01-09 23:20:56 +08:00
vim.api.nvim_set_hl(0, highlight, opt)
2023-01-04 22:22:52 +08:00
end