Ⅰ. 插件描述
vim google translateⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'maksimr/google-translator'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'maksimr/google-translator'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'maksimr/google-translator'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/maksimr/vim-translator
Ⅳ. 文档说明
translator.vim
This script allows you to translate text using the google online translator.
You can translate as single words and whole blocks using visual-mode.
Use :Translate Hello World to translate words or sentences
Note: With a large number of text program can take some time
Installation
For version 1.3 you may choose driver for translate, now available ruby ,node.js, v8cgi, lua
Ruby
- install ruby
- install vim with supporting ruby
Node.js
- install node.js
V8cgi
- install v8cgi
- Documentation
Lua
- install lua
- install vim with supporting lua
- install socket.http for lua (liblua5.1-socket-dev for ubuntu)
If you use version 1.2(that do not support nodejs) you must install ruby and install gem json.
place files in plugin directory or under bundle bundle/vim-translator
Configuration
The whole setting is made through a variable g:goog_user_conf in your vimrc file.
user configuration for ruby
".vimrc
g:goog_user_conf = {
'langpair': 'en|ru', "language code iso 639-1
'v_key': 'T' "? define key in visual-mode (optional)
}user configuration for node.js
".vimrc
g:goog_user_conf = {
'langpair': 'en|ru', "language code iso 639-1
'cmd': 'node',
'v_key': 'T' "? define key in visual-mode (optional)
}user configuration for lua
".vimrc
g:goog_user_conf = {
'langpair': 'en|ru', "language code iso 639-1
'cmd': 'lua',
'v_key': 'T' "? define key in visual-mode (optional)
}user configuration with available parameters
".vimrc
g:goog_user_conf = {
'langpair': 'en|ru', "language code iso 639-1
'cmd' : 'node',
'v_key': 'T', "? define key in visual-mode (optional)
'charset' : 'koi8-r' "? if need change encoding (use iconv) (optional)
}user configuration for v8cgi
".vimrc
g:goog_user_conf = {
'langpair': 'en|ru',
'cmd': 'v8cgi'
}(version: 1.3.2)