A Neovim plugin that translates text using the DeepL API with multiple output modes (float, replace, append).
| Float Mode |
|---|
|
| Replace Mode |
|
| Append Mode |
|
- Translate text selected in visual mode using the DeepL API
- Multiple output modes:
- Float mode: Display translation results in a floating window
- Replace mode: Replace selected text with translation
- Append mode: Append translation below selected text
- User-specified target language
- Simple and lightweight implementation
- Neovim 0.7.0 or higher
- DeepL API key (free or paid plan)
curlcommand
{
"walkersumida/deepl.nvim",
version = "*",
opts = {},
}use {
"walkersumida/deepl.nvim",
config = function()
require('deepl').setup()
end,
}Plug "walkersumida/deepl.nvim"Set your DeepL API key in the DEEPL_API_KEY environment variable.
export DEEPL_API_KEY="your-api-key-here"You can make this persistent by adding it to your shell configuration file (.bashrc, .zshrc, etc.).
Add the following to your init.lua or init.vim:
require('deepl').setup()Currently, there are no configuration options, but they may be added in the future.
- Select text in visual mode
- Run the
:DeepL <language_code> [--mode=<mode>]command
The plugin supports three output modes:
float(default): Display translation in a floating windowreplace: Replace selected text with translationappend: Append translation below selected text (with an empty line)
" Display translation in floating window (default)
:DeepL EN
:DeepL EN --mode=float
" Replace selected text with translation
:DeepL JA --mode=replace
" Append translation below selected text
:DeepL DE --mode=appendExamples of language codes:
EN- EnglishJA- JapaneseDE- GermanFR- FrenchES- SpanishIT- ItalianNL- DutchPL- PolishPT- PortugueseRU- RussianZH- ChineseKO- Korean
For a complete list of supported languages, see the DeepL API documentation.
Example keybindings for convenience:
-- Translate to English (floating window)
vim.keymap.set('v', '<leader>te', ':DeepL EN<CR>', { desc = 'Translate to English' })
-- Translate to Japanese (floating window)
vim.keymap.set('v', '<leader>tj', ':DeepL JA<CR>', { desc = 'Translate to Japanese' })
-- Replace with English translation
vim.keymap.set('v', '<leader>tre', ':DeepL EN --mode=replace<CR>', { desc = 'Replace with English translation' })
-- Replace with Japanese translation
vim.keymap.set('v', '<leader>trj', ':DeepL JA --mode=replace<CR>', { desc = 'Replace with Japanese translation' })
-- Append English translation below
vim.keymap.set('v', '<leader>tae', ':DeepL EN --mode=append<CR>', { desc = 'Append English translation below' })
-- Append Japanese translation below
vim.keymap.set('v', '<leader>taj', ':DeepL JA --mode=append<CR>', { desc = 'Append Japanese translation below' })When the translation result floating window is displayed:
- Press
qorESCto close
DEEPL_API_KEY environment variable is not set
โ Check that the DEEPL_API_KEY environment variable is set.
curl error: ...
โ Check that the curl command is installed.
The DeepL API response may be incorrect. Check that your API key is valid.
Give a โญ๏ธ if this project helped you! Thank you!


