如何在 Neovim 中安装 vim-translate 插件

4

我正在尝试安装以下的neovim翻译应用程序: https://github.com/voldikss/vim-translator

我使用了pip3 install --user neovim

我的~/.config/nvim配置如下:

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

call plug#begin()
Plug 'roxma/nvim-completion-manager'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'voldikss/vim-translator'
call plug#end()

""" Example configuration
" Echo translation in the cmdline
nmap <silent> <Leader>t <Plug>Translate
vmap <silent> <Leader>t <Plug>TranslateV
" Display translation in a window
nmap <silent> <Leader>w <Plug>TranslateW
vmap <silent> <Leader>w <Plug>TranslateWV
" Replace the text with translation
nmap <silent> <Leader>r <Plug>TranslateR
vmap <silent> <Leader>r <Plug>TranslateRV

然后我做了:

nvim
:PlugInstall
:UpdateRemotePlugins
:q!
:q!

当尝试在nvim中执行示例命令时

:TranslateW -w test -e bing youdao -l zh

(编辑:现在这个问题已经解决了。维护者修复了错误)

我遇到了这个错误。

Error detected while processing function translator#translate:                                        
line   25:
E716: Key not present in Dictionary: to_lang . (g:translator_proxy_url ? (' --proxy ' . g:translator_proxy_url
) : '')
E15: Invalid expression: s:python_executable . ' ' . s:py_file . ' --text '      . shellescape(args_obj.word) 
. ' --engines '   . join(args_obj.engines, ' ') . ' --toLang '    . args_obj.to_lang . (g:translator_proxy_url
 ? (' --proxy ' . g:translator_proxy_url) : '')

我已经没有任何想法了。安装说明非常模糊。

python --version: Python 2.7.12

python3 --version: Python 3.5.2

nvim --version

nvim --version
NVIM v0.3.8
Build type: Release
LuaJIT 2.0.4
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -Wconversion -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-4YEfmh/neovim-0.3.8/build/config -I/build/neovim-4YEfmh/neovim-0.3.8/src -I/usr/include -I/build/neovim-4YEfmh/neovim-0.3.8/build/src/nvim/auto -I/build/neovim-4YEfmh/neovim-0.3.8/build/include

vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 07 2019 15:35:43)
Included patches: 1-1689
Extra patches: 8.0.0056

:checkhealth

health#translator#check
========================================================================
  - OK: Async check passed
  - ERROR: Floating window is missed on the current version Nvim
    - ADVICE:
      - Upgrade your Nvim")
  - OK: Using python3

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='4205'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xsel

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help provider-python
          /usr/bin/python2.7 does not have the "neovim" module. :help provider-python
          python2.6 not found in search path or not executable.
          /usr/bin/python does not have the "neovim" module. :help provider-python
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.5.2
  - INFO: pynvim version: 0.4.0
  - OK: Latest pynvim is installed.

1
听起来代码有一个错误或其他类型的问题。可能是版本问题。最好与插件的维护者交谈。 - D. Ben Knoble
1
@D.BenKnoble 谢谢!我提出了一个问题,维护者已经修复了这个 bug。https://github.com/voldikss/vim-translator/issues/35 - Paku
1
我会自己回答的!很高兴听到这个。 - D. Ben Knoble
1个回答

1
我向维护者提出了一个问题,该问题由维护者修复。github.com/voldikss/vim-translator/issues/35

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接