Trans.nvim/lua/Trans/setup.lua

24 lines
783 B
Lua
Raw Normal View History

local db = require("Trans").db
-- local conf = require("Trans").conf
2022-12-20 10:22:28 +08:00
2022-12-21 17:17:00 +08:00
vim.api.nvim_create_user_command('TranslateCursorWord', require("Trans.display").query_cursor, {})
2022-12-21 16:18:36 +08:00
vim.api.nvim_create_user_command('TranslateSelectWord', require("Trans.display").query_select, {})
2022-12-29 20:16:36 +08:00
vim.api.nvim_create_user_command('TranslateInputWord', require("Trans.display").query_input, {})
2022-12-20 10:22:28 +08:00
local group = vim.api.nvim_create_augroup("Trans", { clear = true })
vim.api.nvim_create_autocmd('VimLeave', {
group = group,
pattern = '*',
callback = function()
if db:isopen() then
db:close()
end
end,
})
2022-12-21 11:41:21 +08:00
2022-12-21 16:59:26 +08:00
-- vim.keymap.set('n', 'mm', '<cmd>TranslateCurosorWord<cr>')
-- vim.keymap.set('v', 'mm', '<Esc><cmd>TranslateSelectWord<cr>')
2022-12-21 11:41:21 +08:00
require("Trans.highlight").set_hl()