๐ deepl.nvim
November 22, 2025 ยท View on GitHub
A Neovim plugin that translates text using the DeepL API with multiple output modes (float, replace, append).
| Float Mode |
|---|
|
|
| Replace Mode |
|
|
| Append Mode |
|
|
โจ Features
- 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
๐ Requirements
- Neovim 0.7.0 or higher
- DeepL API key (free or paid plan)
curlcommand
๐ฆ Installation
lazy.nvim
{
"walkersumida/deepl.nvim",
version = "*",
opts = {},
}
packer.nvim
use {
"walkersumida/deepl.nvim",
config = function()
require('deepl').setup()
end,
}
vim-plug
Plug "walkersumida/deepl.nvim"
โ๏ธ Configuration
DeepL API Key
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.).
Plugin Initialization
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.
๐ Usage
Basic Usage
- Select text in visual mode
- Run the
:DeepL <language_code> [--mode=<mode>]command
Output Modes
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)
Examples
" 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=append
Supported Languages
Examples 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.
โจ๏ธ Keybinding Examples
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' })
๐ฎ Floating Window Controls
When the translation result floating window is displayed:
- Press
qorESCto close
๐ง Troubleshooting
API Key Error
DEEPL_API_KEY environment variable is not set
โ Check that the DEEPL_API_KEY environment variable is set.
curl Error
curl error: ...
โ Check that the curl command is installed.
JSON Parse Error
The DeepL API response may be incorrect. Check that your API key is valid.
๐ References
โญ Show your support
Give a โญ๏ธ if this project helped you! Thank you!