feat: add TranslateInput command

This commit is contained in:
JuanZoran
2023-03-22 22:27:27 +08:00
parent 34a01920a5
commit 2bb4b4d46b
3 changed files with 21 additions and 16 deletions

View File

@ -26,11 +26,16 @@ local command = api.nvim_create_user_command
command("Translate", function()
Trans.translate()
end, { desc = "单词翻译" })
end, { desc = "Translate cursor word" })
command("TranslateInput", function()
Trans.translate({ mode = 'input' })
end, { desc = " Translate input word" })
command("TransPlay", function()
local str = Trans.util.get_str(api.nvim_get_mode().mode)
if str and str ~= "" and Trans.util.is_English(str) then
str:play()
end
end, { desc = "自动发音" })
end, { desc = "auto play" })