

GitHub - voldikss/vim-translate-me: 支持最新特性的 Vim/Neovim 翻译插件
source link: https://github.com/voldikss/vim-translate-me
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
vim-translate-me
Vim/Neovim 翻译插件
支持悬浮窗口(目前只有Neovim支持)和异步(Vim 8 和 Neovim 都支持)
预览
安装
-
确保已经安装了 Python(2或3都行)
-
安装(这里用 vim-plug)
Plug 'voldikss/vim-translate-me' :PlugInstall
用法
变量
-
g:vtm_popup_window
显示翻译内容的窗口
-
可选值:
'preview'
,'floating'
-
默认值:如果检测到
floating
特性支持,则为'floating'
,否则为'preview'
-
-
g:vtm_preview_position
如果
g:vtm_popup_window
为'preview'
,此选项决定preview 窗口的位置-
可选值:
'to'
在顶部,'bo'
在底部(:help to
查看详细说明) -
默认值:
'bo'
-
-
g:vtm_default_mapping
是否使用默认快捷键
-
可选值:
1
使用默认快捷键,0
不使用默认快捷键 -
默认值:
1
-
-
g:vtm_default_api
默认使用的翻译接口
-
可选值:
'youdao'
,'baidu'
-
默认值:
'youdao'
-
-
g:vtm_youdao_app_key
&g:vtm_youdao_app_secret
有道 api 的
APPKEY
和APP_SECRET
,可以自己申请,建议不用设置,使用默认值 -
g:vtm_baidu_app_key
&g:vtm_baidu_app_secret
百度 api 的
APPKEY
和APP_SECRET
,可以自己申请 建议不用设置,使用默认值
快捷键
-
默认快捷键
你也可以自己更改,把
<Leader>d
,<Leader>w
或者<Leader>r
配置为你设置的快捷键" 普通模式,<Leader>d 翻译光标下的文本,在命令行回显翻译内容 nmap <silent> <Leader>t <Plug>Translate " 可视模式,<Leader>d 翻译光标下的文本,在命令行回显翻译内容 vmap <silent> <Leader>t <Plug>TranslateV " 普通模式,<Leader>w 翻译光标下的文本,在窗口中显示翻译内容 nmap <silent> <Leader>w <Plug>TranslateW " 可视模式,<Leader>w 翻译光标下的文本,在窗口中显示翻译内容 vmap <silent> <Leader>w <Plug>TranslateWV " 普通模式,<Leader>r 替换光标下的文本为翻译内容 nmap <silent> <Leader>r <Plug>TranslateR " 可视模式,<Leader>r 替换光标下的文本为翻译内容 vmap <silent> <Leader>r <Plug>TranslateRV
-
在翻译窗口打开的情况下,通过
<Leader>d
在主窗口和翻译窗口之间跳转 -
在翻译窗口中按
q
键关闭窗口
命令
-
:Translate<CR>
命令不带参数执行,翻译当前光标下的单词并在命令行回显
-
:Translate <word><CR>
翻译单词
<word>
,并在命令行回显翻译内容 -
:Translate <api> <word><CR>
使用指定的
<api>
翻译单词<word>
并在命令行回显,可用<Tab>
补全<api>
参数 -
:TranslateW
用法同上,但是在窗口中显示翻译内容
Credit
Todo
- Extensable, to be a vim translate manager and support third part translation source
- Proxy support
- Customized highlight
License
MIT
Recommend
-
67
-
58
something about me, something about everything.
-
50
Go 1.12带来了正式的Go module支持、初步的TLS 1.3支持、runtime和标准库做了各项提高,工具也有所改进,trace方面引入minimum mutator utiliza...
-
66
README.md vim-floaterm This plugin helps open the terminal in the floating window and toggle it quickly, detached from my
-
69
README.md vim-translator
-
12
支持 Windows 10 最新 PerMonitorV2 特性的 WPF 多屏高 DPI 应用开发 发布于 2018-10-22 18:04 更新于 2020-06-10 08:41 W...
-
19
1964 年,空指针崩溃的源头,以及 Dart 最新的空安全特性!1964 年,空指针崩溃的源头,以及 Dart 最新的空安全特性! 2020-10-09|flutter2009 年,
-
12
JavaScript快速检测浏览器对CSS3特性的支持 余果 2012-09-24 front-end 在项目中需要快速检测浏览器是否支持某CSS3特性,比如检测是否支持“transform”,然后我的布局会有两种完全不同...
-
6
Cilium 1.10版本特性解读:支持 Wireguard、BGP、Egress IP 网关、XDP、阿里云集成 ...
-
5
Java 18 还未用上,Java 19 最新两大特性曝光
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK