Ⅰ. 插件描述
translator for vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用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.
- Install
pythonfor operation system - Install
translator.vimfor 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:
youdaobaidu
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-speech1- 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 setg: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
Screenshot for :TranBlock
ChangeLog
2015-02-06
- Add
g:translator_sayoption
- Add
2015-02-04
- Rewrite some module with python and remove
node.jsdependency - Add range support for
:Trancommand
- Rewrite some module with python and remove
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.
- QiWei (https://github.com/QiWei)