Skip to content
/ vim-translate-me Public
forked from voldikss/vim-translator
  • Notifications You must be signed in to change notification settings
  • Fork 1
  • Star 2

📕支持最新特性的 Vim/Neovim 翻译插件

License

2 stars 47 forks Branches Tags Activity
Star
Notifications You must be signed in to change notification settings

TwIStOy/vim-translate-me

Branches Tags
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

303 Commits
.github/workflows
.github/workflows
 
 
autoload
autoload
 
 
doc
doc
 
 
plugin
plugin
 
 
script
script
 
 
syntax
syntax
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

vim-translator

CI

Asynchronous translating plugin for Vim/Neovim

  • Installation
  • Features
  • Configuration
  • Keymaps
  • Commands
  • Highlight
  • Statusline
  • Know bugs
  • FAQ
  • Breaking changes
  • References
  • License

Installation

Plug 'voldikss/vim-translator'

Features

  • Asynchronous & mutithreading translating
  • Popupwin(vim8) & floatwin(neovim) support
  • Multiple engines: see g:translator_default_engines
  • Proxy support
  • No requirements for appid/appkey

Configuration

g:translator_target_lang

Type String.

Default: 'zh'

Please refer to language support list

g:translator_source_lang

Type String.

Default: 'auto'

Please refer to language support list

g:translator_default_engines

Type List of String.

Available: 'bing', 'google', 'haici', 'iciba'(expired), 'sdcv', 'trans', 'youdao'

Default: If g:translator_target_lang is 'zh', this will be ['bing', 'google', 'haici', 'youdao'], otherwise ['google']

g:translator_proxy_url

Type String. Default: ''

Example: let g:translator_proxy_url = 'socks5://127.0.0.1:1080'

g:translator_history_enable

Type Boolean.

Default: v:false

g:translator_window_type

Type String.

Default: 'popup'

Available: 'popup'(use floatwin in nvim or popup in vim), 'preview'

g:translator_window_max_width

Type Number (number of columns) or Float (between 0 and 1). If Float, the width is relative to &columns.

Default: 0.6

g:translator_window_max_height

Type Number (number of lines) or Float (between 0 and 1). If Float, the height is relative to &lines.

Default: 0.6

g:translator_window_borderchars

Type List of String. Characters of the floating window border.

Default: ['─', '│', '─', '│', '┌', '┐', '┘', '└']

Key Mappings

This plugin doesn't supply any default mappings.

""" Configuration example
" Echo translation in the cmdline
nmap <silent> <Leader>t <Plug>Translate
vmap <silent> <Leader>t <Plug>TranslateV
" Display translation in a window
nmap <silent> <Leader>w <Plug>TranslateW
vmap <silent> <Leader>w <Plug>TranslateWV
" Replace the text with translation
nmap <silent> <Leader>r <Plug>TranslateR
vmap <silent> <Leader>r <Plug>TranslateRV
" Translate the text in clipboard
nmap <silent> <Leader>x <Plug>TranslateX

Once the translation window is opened, type <C-w>p to jump into it and again to jump back

Beside, there is a function which can be used to scroll window, only works in neovim.

nnoremap <silent><expr> <M-f> translator#window#float#has_scroll() ?
                            \ translator#window#float#scroll(1) : "\<M-f>"
nnoremap <silent><expr> <M-b> translator#window#float#has_scroll() ?
                            \ translator#window#float#scroll(0) : "\<M-b>"

Commands

Translate

:Translate[!] [--engines=ENGINES] [--target_lang=TARGET_LANG] [--source_lang=SOURCE_LANG] [your text]

Translate the text from the source language source_lang to the target language target_lang with engine, echo the result in the cmdline

If engines is not given, use g:translator_default_engines

If text is not given, use the text under the cursor

If target_lang is not given, use g:translator_target_lang

The command can also be passed to a range, i.e., :'<,'>Translate ..., which translates text in visual selection

If ! is provided, the plugin will perform a reverse translating by switching target_lang and source_lang

Examples(you can use <Tab> to get completion):

:Translate                                  " translate the word under the cursor
:Translate --engines=google,youdao are you ok " translate text `are you ok` using google and youdao engines
:2Translate ...                             " translate line 2
:1,3Translate ...                           " translate line 1 to line 3
:'<,'>Translate ...                         " translate selected lines

TranslateW

:TranslateW[!] [--engines=ENGINES] [--target_lang=TARGET_LANG] [--source_lang=SOURCE_LANG] [your text]

Like :Translate..., but display the translation in a window

TranslateR

:TranslateR[!] [--engines=ENGINES] [--target_lang=TARGET_LANG] [--source_lang=SOURCE_LANG] [your text]

Like :Translate..., but replace the current text with the translation

TranslateX

:TranslateX[!] [--engines=ENGINES] [--target_lang=TARGET_LANG] [--source_lang=SOURCE_LANG] [your text]

Translate the text in the clipboard

TranslateH

:TranslateH

Export the translation history

TranslateL

:TranslateL

Display log message

Highlight

Here are the default highlight links. To customize, use hi or hi link

" Text highlight of translator window
hi def link TranslatorQuery             Identifier
hi def link TranslatorDelimiter         Special
hi def link TranslatorExplain           Statement

" Background of translator window border
hi def link Translator                  Normal
hi def link TranslatorBorder            NormalFloat

Statusline

  • g:translator_status

FAQ

https://github.com/voldikss/vim-translator/issues?q=label%3AFAQ

Breaking Changes

https://github.com/voldikss/vim-translator/issues?q=label%3A%22breaking+change%22

References

  • dict.vim
  • translator

License

MIT

About

📕支持最新特性的 Vim/Neovim 翻译插件

Resources

Readme

License

Activity

Stars

2 stars

Watchers

3 watching

Forks

1 fork
Report repository

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 62.7%
  • Python 37.3%

Footer

© 2024 GitHub, Inc.

玻璃钢生产厂家佛山玻璃钢雕塑工艺兰州大型玻璃钢雕塑厂家玻璃钢花盆前景怎样浙江开业商场美陈多少钱购买玻璃钢艺术雕塑山西不锈钢镂空玻璃钢人物雕塑玻璃钢景观雕塑尺寸玻璃钢戏曲人物雕塑徐州十一商场美陈玻璃钢雕塑用树脂湖南玻璃钢仿铜雕塑商丘泡沫玻璃钢人物雕塑玻璃钢雕塑佛像厂商场会员活动美陈布置四川商场美陈哪里有宣城佛像玻璃钢雕塑供应商滁州商场户外美陈花朵玻璃钢仿铜雕塑生产厂家伊春园林玻璃钢雕塑定做湛江玻璃钢雪糕雕塑石家庄玻璃钢座椅雕塑肇庆玻璃钢酒文化雕塑玻璃钢蝗虫雕塑雕塑玻璃钢花盆甘南大型玻璃钢雕塑阜阳欧式玻璃钢雕塑定制清远玻璃钢雕塑规格上海季节性商场美陈有哪些佛山发光动物玻璃钢雕塑生产商嘉定区拉丝玻璃钢雕塑在线咨询香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声单亲妈妈陷入热恋 14岁儿子报警汪小菲曝离婚始末遭遇山火的松茸之乡雅江山火三名扑火人员牺牲系谣言何赛飞追着代拍打萧美琴窜访捷克 外交部回应卫健委通报少年有偿捐血浆16次猝死手机成瘾是影响睡眠质量重要因素高校汽车撞人致3死16伤 司机系学生315晚会后胖东来又人满为患了小米汽车超级工厂正式揭幕中国拥有亿元资产的家庭达13.3万户周杰伦一审败诉网易男孩8年未见母亲被告知被遗忘许家印被限制高消费饲养员用铁锨驱打大熊猫被辞退男子被猫抓伤后确诊“猫抓病”特朗普无法缴纳4.54亿美元罚金倪萍分享减重40斤方法联合利华开始重组张家界的山上“长”满了韩国人?张立群任西安交通大学校长杨倩无缘巴黎奥运“重生之我在北大当嫡校长”黑马情侣提车了专访95后高颜值猪保姆考生莫言也上北大硕士复试名单了网友洛杉矶偶遇贾玲专家建议不必谈骨泥色变沉迷短剧的人就像掉进了杀猪盘奥巴马现身唐宁街 黑色着装引猜测七年后宇文玥被薅头发捞上岸事业单位女子向同事水杯投不明物质凯特王妃现身!外出购物视频曝光河南驻马店通报西平中学跳楼事件王树国卸任西安交大校长 师生送别恒大被罚41.75亿到底怎么缴男子被流浪猫绊倒 投喂者赔24万房客欠租失踪 房东直发愁西双版纳热带植物园回应蜉蝣大爆发钱人豪晒法院裁定实锤抄袭外国人感慨凌晨的中国很安全胖东来员工每周单休无小长假白宫:哈马斯三号人物被杀测试车高速逃费 小米:已补缴老人退休金被冒领16年 金额超20万

玻璃钢生产厂家 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化