trans.nvim


Ⅰ. 插件描述

Google language translator plugin for Neovim

Ⅱ. 基本信息

创建日期:  2018-01-30
使用用户:  2
Github星:  14
插件作者:  UEKUSA Yuta

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# trans.nvim

trans.nvim is a plugin for Neovim to translate text with Google Translator.

message

trans_nvim_message

preview

trans_nvim_preview

floating window

trans_nvim_floating_window

Required

You must first set up authentication by creating a API Key or service account of GCP.

Then you need to install the Go of version 1.11 or more.

Using API Key

The API Key documentation can be found here.

Please set the environment variable TRANS_API_KEY to the API Key.

Or Using Service Account

The service account documentation can be found here.

Please set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key.

Note

You need a little bit of money to use google translate API.
e.g. it costs $0.06 for 2889 characters.

Installation

For vim-plug

Plug 'utahta/trans.nvim', {'do': 'make'}

Settings

let g:trans_lang_locale = 'ja'
let g:trans_lang_output = 'preview'

To use floating windows

Floating windows are supported in neovim >= 0.4.0.

let g:trans_lang_output = 'float'

A Floating window is automatically hide when cursor is moved.

添加新评论