GithubHelp home page GithubHelp logo

cg-man / coc-translator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from voldikss/coc-extensions

1.0 1.0 0.0 373 KB

๐ŸŒธ Translation extension for coc.nvim

TypeScript 97.56% JavaScript 2.44%

coc-translator's Introduction

coc-translator

Translation extension for coc.nvim. Inspired by vim-translator

Install

:CocInstall coc-translator

NOTE: No need to install vim-translator

Features

  • Multiple translator engines
  • Export translation history
  • View and process translation history via CocList
  • Proxy support(see coc.nvim doc)

Configuration

"translator.toLang": {
  "type": "string",
  "default": "zh",
  "description": "Target language"
},
"translator.engines": {
  "type": "array",
  "default": [
    "bing",
    "google",
    "youdao",
    "haici"
  ]
},
"translator.enableHover": {
  "type": "boolean",
  "default": false,
  "description": "Enable on hover translating"
},
"translator.maxsize": {
  "type": "number",
  "default": 5000,
  "description": "Max history count"
},
"translator.window.maxWidth": {
  "type": "number",
  "default": 999
},
"translator.window.maxHeight": {
  "type": "number",
  "default": 999
}

more information, see package.json

Engines

engine supported language types
bing ref
iciba(deprecated) ref
google ref
youdao ref
haici

Keymaps

Example

" popup
nmap <Leader>t <Plug>(coc-translator-p)
vmap <Leader>t <Plug>(coc-translator-pv)
" echo
nmap <Leader>e <Plug>(coc-translator-e)
vmap <Leader>e <Plug>(coc-translator-ev)
" replace
nmap <Leader>r <Plug>(coc-translator-r)
vmap <Leader>r <Plug>(coc-translator-rv)

Commands

  • :CocCommand translator.popup [text] Display translation result via floating/popup window
  • :CocCommand translator.echo [text] Echo the translation result in the cmdline
  • :CocCommand translator.replace [text] Replace the word under the cursor with the translation
  • :CocCommand translator.exportHistory Export translation history in the tabpage

Note: [text] is optional, if no text, the extension will use the <word> under the cursor.

Work with translation lists

run :CocList translation to open the translation list.

  • Filter your translation items and perform operations via <Tab>
  • Use operation delete to delete the translation item under the cursor
  • Use operation yank to yank ...
  • Use operation open to open the file which contains the query word
  • Use operation preview to preview ...
  • Use operation append to append the word to the end of cursor position
  • Use operation pretend to pretend ...

For more advance usage, checkout :h coc-list

F.A.Q

Q: Where are the translation data stored?

A: Normally the data is saved in ~/.config/coc/extensions/coc-translation-data, but if you set g:coc_extension_root to another location, it will change as well

License

MIT

coc-translator's People

Contributors

cg-man avatar chemzqm avatar dependabot-preview[bot] avatar dependabot[bot] avatar fannheyward avatar voldikss avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.