vim错误设置中的电力线

Jor*_*dan 9 vim vimrc

我按照他们的安装建议使用 pip install 安装了电力线。我在 zsh 作为提示和 tmux 作为状态行都可以正常工作,但我无法让它在 vim 中工作。

当我将以下内容添加到我的 vimrc 时:

python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

Error detected while processing /home/jordan/.vimrc:
line    1:
E319: Sorry, the command is not available in this version: python from powerline.vim import setup as powerline_setup
line    2:
E319: Sorry, the command is not available in this version: python powerline_setup()
line    3:
E319: Sorry, the command is not available in this version: python del powerline_setup
Run Code Online (Sandbox Code Playgroud)

编辑:在检查我的 vim (vim.gnome) 版本是使用 python 支持编译后,我注意到它是 (python3)。所以我按照安装说明将 vimrc 更改为使用 python3 并得到以下内容:

Error detected while processing /home/jordan/.vimrc:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'powerline'
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
line    3:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
Run Code Online (Sandbox Code Playgroud)

任何想法,我都无能为力了!

已解决的编辑:我无法让它与 python3 一起使用,但它似乎是 vim.gnome 和 vim.basic 中唯一支持的 python 版本。

我安装apt install vim-nox-py2了支持 python 2 的vim.nox ,一切正常。希望这可以解决其他人的头疼问题。

小智 12

我将其修复如下:

  1. 在上述原始问题的 3 行中的每一行中编辑~/.vimrc并更改pythonpython3
  2. sudo apt-get install python3-pip
  3. pip3 install --user powerline-status