diff --git a/doc/Trans.txt b/doc/Trans.txt index bef36a5..a76cd51 100644 --- a/doc/Trans.txt +++ b/doc/Trans.txt @@ -34,7 +34,7 @@ Table of Contents *Trans-table-of-contents* - |Trans-待办-(画大饼)| -注意: 当前分支目前没有发布, README.MD的描述并不准确, 遇到问题请切换到 MAIN分支或者联系我 ~ +注意: 当前分支目前没有发布, README.MD 的描述并不准确, 遇到问题请切换到 MAIN分支或者联系我 ~ 特点 *Trans-trans.nvim-特点* @@ -105,7 +105,7 @@ Packer.nvim ~ use { 'JuanZoran/Trans.nvim' run = function() require('Trans').install() end, -- 自动下载使用的本地词库 - requires = { 'kkharji/sqlite.lua', }, + requires = 'kkharji/sqlite.lua', , -- 如果你不需要任何配置的话, 可以直接按照下面的方式启动 config = function () require'Trans'.setup{ @@ -131,7 +131,6 @@ Packer.nvim ~ require("Trans").setup {} -- 启动Trans vim.keymap.set({"n", 'x'}, "mm", 'Translate', { desc = ' Translate' }) -- 自动判断virtual 还是 normal 模式 vim.keymap.set({'n', 'x'}, 'mk', 'TransPlay', {desc = ' 自动发音'}) -- 自动发音选中或者光标下的单词 - vim.keymap.set("n", "mi", "TranslateInput", { desc = ' Translate' }) end } < @@ -172,7 +171,7 @@ Lazy.nvim ~ > Linux 下安装: > `sudo pacman -S sqlite # Arch` > `sudo apt-get install sqlite3 libsqlite3-dev # Ubuntu` - 后续会增加 `healthcheck` 进行检查 + **尝试运行 checkhealth Trans** - **auto_play** 使用步骤: linux 只需要安装`festival` sudo apt-get install festival festvox-kallpc16k **如果你想要设置音色,发音可以访问:** Festival 官方 @@ -217,25 +216,20 @@ Festival配置(仅针对linux用户) ~ 配置 *Trans-trans.nvim-配置* >lua - require'Trans'.setup{ + require'Trans'.setup { ---@type string the directory for database file and password file dir = os.getenv('HOME') .. '/.vim/dict', - ---@type table modeStrategy default strategy for mode + query = 'fallback', + -- backend_order = {}, + ---@type 'default' | 'dracula' | 'tokyonight' global Trans theme [see lua/Trans/style/theme.lua] + theme = 'default', -- default | tokyonight | dracula strategy = { - ---@type { frontend:string, backend:string } fallback strategy for mode + ---@type { frontend:string, backend:string | string[] } fallback strategy for mode default = { frontend = 'hover', backend = '*', }, }, - ---@type table fallback backend for mode - backend = { - ---@class TransBackendOpts - default = { - ---@type integer timeout for backend send request - timeout = 2000, - }, - }, ---@type table frontend options frontend = { ---@class TransFrontendOpts @@ -251,6 +245,7 @@ Festival配置(仅针对linux用户) ~ close = 'slid', interval = 12, }, + timeout = 2000, }, ---@class TransHoverOpts : TransFrontendOpts hover = { @@ -261,16 +256,17 @@ Festival配置(仅针对linux用户) ~ ---@type string -- see: /lua/Trans/style/spinner spinner = 'dots', ---@type string -- TODO :support replace with {{special word}} - fallback_message = '翻译超时或没有找到相关的翻译', + fallback_message = '{{notfound}} 翻译超时或没有找到相关的翻译', auto_resize = true, + -- strict = false, -- TODO :No Width limit when str is a sentence padding = 10, -- padding for hover window width keymaps = { - -- play = '_', -- Deprecated pageup = '[[', pagedown = ']]', pin = '[', close = ']', toggle_entry = ';', + -- play = '_', -- Deprecated }, ---@type string[] auto close events auto_close_events = { @@ -278,31 +274,47 @@ Festival配置(仅针对linux用户) ~ 'CursorMoved', 'BufLeave', }, - ---@type string[] order to display translate result + ---@type table order to display translate result order = { - 'title', - 'tag', - 'pos', - 'exchange', - 'translation', - 'definition', + default = { + 'str', + 'translation', + 'definition', + }, + offline = { + 'title', + 'tag', + 'pos', + 'exchange', + 'translation', + 'definition', + }, + youdao = { + 'title', + 'translation', + 'definition', + 'web', + } }, ---@type table icon = { -- or use emoji - star = '', -- ⭐ - notfound = ' ', -- ❔ - yes = '✔', -- ✔️ - no = '', -- ❌ - cell = '■', -- ■ | □ | ▇ | ▏ ▎ ▍ ▌ ▋ ▊ ▉ █ + list = '●', -- ● | ○ | ◉ | ◯ | ◇ | ◆ | ▪ | ▫ | ⬤ | 🟢 | 🟡 | 🟣 | 🟤 | 🟦 | 🟨 | 🟧 | 🟥 | 🟪 | 🟫 | 🟩 | 🟠 | 🟦 | 🟨 | 🟧 | 🟥 | 🟪 | 🟫 | 🟩 | 🟠 + star = '', -- ⭐ | ✴ | ✳ | ✲ | ✱ | ✰ | ★ | ☆ | 🌟 | 🌠 | 🌙 | 🌛 | 🌜 | 🌟 | 🌠 | 🌌 | 🌙 | + notfound = ' ', --❔ | ❓ | ❗ | ❕| + yes = '✔', -- ✅ | ✔️ | ☑ + no = '', -- ❌ | ❎ | ✖ | ✘ | ✗ | + cell = '■', -- ■ | □ | ▇ | ▏ ▎ ▍ ▌ ▋ ▊ ▉ █ + web = '󰖟', --🌍 | 🌎 | 🌏 | 🌐 | + tag = ' ', + pos = '', + translation = '󰊿', + definition = '󰗊', + exchange = '✳', }, }, }, - style = { - ---@type string global Trans theme [see lua/Trans/style/theme.lua] - theme = 'default', -- default | tokyonight | dracula - }, - } + }p < @@ -315,7 +327,6 @@ Festival配置(仅针对linux用户) ~ >lua vim.keymap.set({'n', 'x'}, 'mm', 'Translate') vim.keymap.set({'n', 'x'}, 'mk', 'TransPlay') -- 自动发音选中或者光标下的单词 - vim.keymap.set('n', 'mi', 'TranslateInput') < @@ -325,50 +336,58 @@ Festival配置(仅针对linux用户) ~ 默认定义 >lua { - TransWord = { - fg = '#7ee787', - bold = true, - }, - TransPhonetic = { - link = 'Linenr' - }, - TransTitle = { - fg = '#0f0f15', - bg = '#75beff', - bold = true, - }, - TransTitleRound = { - fg = '#75beff', - }, - TransTag = { - fg = '#e5c07b', - }, - TransExchange = { - link = 'TransTag', - }, - TransPos = { - link = 'TransTag', - }, - TransTranslation = { - link = 'TransWord', - }, - TransDefinition = { - link = 'Moremsg', - }, - TransWin = { - link = 'Normal', - }, - TransBorder = { - link = 'FloatBorder', - }, - TransCollins = { - fg = '#faf743', - bold = true, - }, - TransFailed = { - fg = '#7aa89f', - }, - } + TransWord = { + fg = '#7ee787', + bold = true, + }, + TransPhonetic = { + link = 'Linenr' + }, + TransTitle = { + fg = '#0f0f15', + bg = '#75beff', + bold = true, + }, + TransTitleRound = { + fg = '#75beff', + }, + TransTag = { + -- fg = '#e5c07b', + link = '@tag' + }, + TransExchange = { + link = 'TransTag', + }, + TransPos = { + link = 'TransTag', + }, + TransTranslation = { + link = 'TransWord', + }, + TransDefinition = { + link = 'Moremsg', + }, + TransWin = { + link = 'Normal', + }, + TransBorder = { + fg = '#89B4FA', + }, + TransCollins = { + fg = '#faf743', + bold = true, + }, + TransFailed = { + fg = '#7aa89f', + }, + TransWaitting = { + link = 'MoreMsg' + }, + TransWeb = { + -- TODO : + link = 'MoreMsg', + } + } < @@ -395,14 +414,14 @@ Festival配置(仅针对linux用户) ~ 待办 (画大饼) *Trans-trans.nvim-待办-(画大饼)* -- ☒ 多风格样式查询 -- ☒ 重新录制屏幕截图示例 - ☒ 快捷键定义 - ☒ 自动读音 +- ☒ 在线多引擎异步查询 +- ☒ `句子翻译` | `中翻英` 的支持 +- ☐ 多风格样式查询 +- ☐ 重新录制屏幕截图示例 - ☐ 变量命名的支持 - ☐ 历史查询结果保存 -- ☐ 在线多引擎异步查询 -- ☐ `句子翻译` | `中翻英` 的支持 ============================================================================== 2. Links *Trans-links*