Translate with Deepl from the command-line or in vim
Go to file
Pierre Prinetti 6f67a681fd
Rename the license file
2023-07-05 14:40:49 +02:00
LICENSE.txt Rename the license file 2023-07-05 14:40:49 +02:00 vim command 2023-07-05 14:26:44 +02:00
deepl fix: Stop appending newlines to the output 2023-07-05 13:57:42 +02:00


Use Deepl's API to translate from the command line.

Get an API account on



Copy or symlink deepl to a directory in your $PATH, like ~/.local/bin/.


# ~/.config/deepl/config
# The default target language is used when not using the command line flag `-t`

# The API key can either be set directly, or fetched on-the-fly from a command
#deepl_key="$(pass show deepl)"

# Set to '' to use a paid plan

All the examples below assume that you have set the API key in the config file. Otherwise, add a -k <key> argument.


From the command-line:

deepl -t FR <<< "Integrate the worlds best machine translation technology directly into your own products and platforms."

Replace the current Vim buffer with its French translation:

:% !deepl -t FR

Set a command in Vim or neovim

Once deepl is somewhere in your $PATH, add this to your init.vim:

command -nargs=? -range=% Translate <line1>,<line2>!deepl <args>

Then you can replace the whole current buffer (or just the selected lines) with its translation to the default target_lang:


Or with a language of your choice:

:Translate -t RU