
Neovim translate popup
Neovim Translation with translate-shell and Custom Popup A guide to adding quick command-line translation in Neovim, with a visual popup styled like traditional translators. Creators: opencode and Sérgio Araújo Prerequisites 1. Install translate-shell translate-shell is a command-line translator powered by Google Translate, Bing, Yandex, and more. Direct download: wget git.io/trans chmod +x ./trans sudo mv trans /usr/local/bin/ Or via git: git clone https://github.com/soimort/translate-shell cd translate-shell && make && sudo make install Dependencies: gawk (4.0+) and bash or zsh (usually pre-installed on Linux). Neovim Implementation 1. Add the translation function In ~/.config/nvim/lua/core/utils/nvim_utils.lua , add the translate_popup function: function M . translate_popup () local text = '' local is_multiline = false local mode = vim . api . nvim_get_mode (). mode if mode == 'v' or mode == 'V' or mode == '\x16' then local start_pos = vim . api . nvim_buf_get_mark ( 0 , '<' ) local
Continue reading on Dev.to
Opens in a new tab



