All Projects → voldikss → Vim Translator

voldikss / Vim Translator

Licence: mit
📕 Translating plugin for Vim/Neovim

Labels

Projects that are alternatives of or similar to Vim Translator

dotfiles
🏠 dotfiles for my macOS environment
Stars: ✭ 17 (-93.46%)
Mutual labels:  neovim
nerd-galaxyline
A modern and great-looking status bar for neovim
Stars: ✭ 27 (-89.62%)
Mutual labels:  neovim
dotfiles
My arch setup script and dotfiles
Stars: ✭ 37 (-85.77%)
Mutual labels:  neovim
nvim-commaround
nvim plugin to toggle comments on and off
Stars: ✭ 35 (-86.54%)
Mutual labels:  neovim
scala-utils.nvim
Utilities for working with Scala in NeoVim.
Stars: ✭ 15 (-94.23%)
Mutual labels:  neovim
jdtls-launcher
The simplest way to install and launch JDTLS
Stars: ✭ 29 (-88.85%)
Mutual labels:  neovim
vim
涛叔的 vim 配置
Stars: ✭ 41 (-84.23%)
Mutual labels:  neovim
nerveux.nvim
A neovim plugin written in lua to interact with the neuron Zettelkasten software.
Stars: ✭ 19 (-92.69%)
Mutual labels:  neovim
focus.nvim
Auto-Focusing and Auto-Resizing Splits/Windows for Neovim written in Lua. A full suite of window management enhancements. Vim splits on steroids!
Stars: ✭ 289 (+11.15%)
Mutual labels:  neovim
dotfiles
Configs for apps I care about
Stars: ✭ 19 (-92.69%)
Mutual labels:  neovim
specs.nvim
👓 A fast and lightweight Neovim lua plugin to keep an eye on where your cursor has jumped.
Stars: ✭ 204 (-21.54%)
Mutual labels:  neovim
igs.nvim
A minimalist Neovim plugin that enhances the usage of git status inside Neovim.
Stars: ✭ 17 (-93.46%)
Mutual labels:  neovim
vimrc
My neovim config
Stars: ✭ 43 (-83.46%)
Mutual labels:  neovim
Snowflake
NixOS Flake Configuration.
Stars: ✭ 22 (-91.54%)
Mutual labels:  neovim
nrpattern.nvim
Neovim plugin to expand incrementing/decrementing to more formats.
Stars: ✭ 24 (-90.77%)
Mutual labels:  neovim
null-ls.nvim
Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
Stars: ✭ 965 (+271.15%)
Mutual labels:  neovim
nvim-dap-python
An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.
Stars: ✭ 70 (-73.08%)
Mutual labels:  neovim
Lldb.nvim
Debugger integration with a focus on ease-of-use.
Stars: ✭ 254 (-2.31%)
Mutual labels:  neovim
format.nvim
Neovim lua plugin to format the current buffer with external executables
Stars: ✭ 189 (-27.31%)
Mutual labels:  neovim
dotneovim
My NeoVIM configuration
Stars: ✭ 15 (-94.23%)
Mutual labels:  neovim

vim-translator

CI

Asynchronous translating plugin for Vim/Neovim

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-f>"

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

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].