translator


Ⅰ. 插件描述

translator for vim

Ⅱ. 基本信息

创建日期:  2013-04-07
使用用户:  4
Github星:  1
插件作者:  fu design

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'fudesign2008/translator'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'fudesign2008/translator'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'fudesign2008/translator'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/fudesign2008/translator.vim

Ⅳ. 文档说明

translator.vim

translator for vim

Install

The plugin needs internet connection and python support.

  1. Install python for operation system
  2. Install translator.vim for vim

Usage

The translator allows you to get translation from popular web translation
engines for words and a block of text and view translation result in vim! You
do NOT need to open a browser to see translation result.

:Tran

Just use :Tran in command line. For example:

" to translate words
:Tran hello word
:Tran 给力

" to translate with range
:10, 12Tran

" to translate the current line
:Tran

:TranCursor

You can translate the word under cursor with :TranCursor command. For
example:

:TranCursor

:TranBlock

In visual mode, :TranBlock will be useful. This command will translate a
block of text which is selected.

:TranClose

Execute :TranClose to close result window.

Execute :help translator to see the help document for more infomation.

Options

g:translator_engine

The default value is youdao and available values are:

  • youdao
  • baidu

g:translator_say

Text-to-speech.

Note: This options is only available on Mac OS X with say shell command.

The default value is 1. The avaiable values are:

  • 0 - Do NOT use text-to-speech
  • 1 - Use text-to-speech only when translating one word
  • -1 - Use text-to-speech every where.

g:translator_custom_keymap

The default value is 0. If you do not like the default, just set
g:translator_custom_keymap to 1 and adding your own key mappings in
.vimrc.

The default key mappings are:

nnoremap <leader>tr :TranCursor<CR>
vnoremap <leader>tr :TranBlock<CR>
nnoremap <leader>tc :TranClose<CR>

Screenshots

Screenshot for :Tran
tran.png

Screenshot for :TranBlock
tranBlock.png

ChangeLog

  • 2015-02-06

    • Add g:translator_say option
  • 2015-02-04

    • Rewrite some module with python and remove node.js dependency
    • Add range support for :Tran command

Credits

Thanks to the following people for testing, bug reports, ideas etc. Without
you I probably would have got bored of the hacking the plugin.

添加新评论