/vim-translate

A tiny translate-shell wrapper for Vim.

Primary LanguageVim scriptMIT LicenseMIT

vim-translate Build Status

🌎 A tiny translate-shell wrapper for Vim.

Installation

Use your favorite plugin manager. Example with vim-plug:

Plug 'VincentCordobes/vim-translate'

Make sure you've installed translate-shell

Usage

Translate the whole buffer and put it in a scratch buffer

  • :Translate [options] [source]:[targets]

Translate a visual selection and put it in a scratch buffer

  • :'<,'>TranslateVisual [options] [source]:[targets]

Translate and replace a visual selection

  • :'<,'>TranslateReplace [options] [source]:[targets]

Quit the translation buffer

  • :TranslateClear

See here to know more about options

For convenience, you can create custom key mappings:

nnoremap <silent> <leader>t :Translate<CR>
vnoremap <silent> <leader>t :TranslateVisual<CR>

Configuration

g:translate#default_languages

A dictionary of defaults source → target

let g:translate#default_languages = {
      \ 'fr': 'en',
      \ 'en': 'fr'
      \ }

License

MIT