Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coffebar/crowtranslate.nvim
Translate the visually selected text in Neovim.
https://github.com/coffebar/crowtranslate.nvim
Last synced: about 1 month ago
JSON representation
Translate the visually selected text in Neovim.
- Host: GitHub
- URL: https://github.com/coffebar/crowtranslate.nvim
- Owner: coffebar
- Created: 2023-10-13T20:14:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-04T17:07:24.000Z (about 1 year ago)
- Last Synced: 2023-11-04T18:22:20.873Z (about 1 year ago)
- Language: Lua
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# crowtranslate.nvim
This Neovim plugin allows you to translate selected text using
[Crow Translate](https://github.com/crow-translate/crow-translate)
(required on your system).Text will be replaced over the selection.
## Installation
Using lazy.nvim:
```lua
{
"coffebar/crowtranslate.nvim",
lazy = true,
cmd = { "CrowTranslate" },
opts = {
-- Japanese to English if selected text includes Japanese characters
language = "ja",
mask = "[ぁ-んァ-ン一-龥]", -- regex for your language detection
default = "en", -- alternative language
engine = "google", -- google, bing, libretranslate, lingva, yandex
},
},
```## Usage
Select text in visual mode and run `:CrowTranslate`. Text will be replaced with the translation.
```lua
-- Example keymap with which-key
local wk = require("which-key")
wk.register({
T = { "CrowTranslate", "Translate selected text" },
}, { mode = "x" })
```The direction will be automatically detected based on the selected text and the `mask` option.
Alternatively, you can specify the direction manually by passing argument to command:
`:CrowTranslate en`
## Known issues
- Windows is not supported, PRs are welcome.
## Demo
https://github.com/coffebar/crowtranslate.nvim/assets/3100053/1bf77e1d-c7c6-4b42-9071-7e5049a5e35d