Trans.nvim/lua/Trans/setup.lua

69 lines
1.4 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 = ' 搜索翻译' })
vim.api.nvim_create_user_command('TranslateLast', function()
require("Trans").translate('last')
end, { desc = ' 显示上一次查询的内容' })
2023-01-14 01:57:12 +08:00
local highlights = {
TransWord = {
fg = '#7ee787',
bold = true,
},
TransPhonetic = {
link = 'Linenr'
},
2023-01-14 10:29:01 +08:00
TransTitle = {
fg = '#0f0f15',
bg = '#75beff',
2023-01-14 14:22:25 +08:00
bold = true,
2023-01-14 10:29:01 +08:00
},
TransTitleRound = {
2023-01-14 01:57:12 +08:00
fg = '#75beff',
},
TransTag = {
fg = '#e5c07b',
},
TransExchange = {
link = 'TransTag',
},
TransPos = {
link = 'TransTag',
},
TransTranslation = {
link = 'TransWord',
},
TransDefinition = {
link = 'Moremsg',
},
2023-01-14 19:35:13 +08:00
TransWin = {
2023-01-14 01:57:12 +08:00
link = 'Normal',
},
2023-01-14 19:35:13 +08:00
TransBorder = {
2023-01-14 01:57:12 +08:00
link = 'FloatBorder',
2023-01-14 10:29:01 +08:00
},
TransCollins = {
fg = '#faf743',
bold = true,
},
2023-01-14 14:22:25 +08:00
TransNotFound = {
fg = '#7aa89f',
},
2023-01-14 01:57:12 +08:00
}
2023-01-09 23:20:56 +08:00
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