FS#65331 - powerline-vim has a problem

Attached to Project: Community Packages
Opened by Sherlock Holo (SherlockHolo) - Thursday, 30 January 2020, 16:22 GMT
Last edited by Jiachen Yang (farseerfc) - Monday, 10 February 2020, 02:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jiachen Yang (farseerfc)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Install `powerline-vim` and `vim`, when run `vim` will display a warning message

Traceback (most recent call last):
File "<string>", line 9, in <module>
ImportError: No module named powerline.vim
An error occurred while importing powerline module.
This could be caused by invalid sys.path setting,
or by an incompatible Python version (powerline requires
Python 2.6, 2.7 or 3.2 and later to work). Please consult
the troubleshooting section in the documentation for
possible solutions.
Unable to import powerline, is it installed?
Press ENTER or type command to continue


Additional info:
* package version(s) `powerline-vim`: 2.7-4. `vim`: 8.2.0148-1
* config and/or log files etc. no `.vimrc` in `$HOME`

Steps to reproduce:
`pacman -S powerline-vim vim`
`vim`
This task depends upon

Closed by  Jiachen Yang (farseerfc)
Monday, 10 February 2020, 02:59 GMT
Reason for closing:  Works for me
Additional comments about closing:  reporter fixed the problem locally by apply changes to .vimrc documented in https://wiki.archlinux.org/index.php/Pow erline#Vim
Comment by Antonio Rojas (arojas) - Thursday, 30 January 2020, 16:30 GMT
Needs python2-powerline
Comment by Sherlock Holo (SherlockHolo) - Thursday, 30 January 2020, 17:31 GMT
I install python2-powerline now, but it doesn't display anything different, I run :scriptnames and it prints

1: /etc/vimrc
2: /usr/share/vim/vimfiles/archlinux.vim
3: /usr/share/vim/vim82/defaults.vim
4: /usr/share/vim/vim82/syntax/syntax.vim
5: /usr/share/vim/vim82/syntax/synload.vim
6: /usr/share/vim/vim82/syntax/syncolor.vim
7: /usr/share/vim/vim82/filetype.vim
8: /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim
9: /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
10: /usr/share/vim/vim82/ftplugin.vim
11: /usr/share/vim/vim82/indent.vim
12: /usr/share/vim/vimfiles/plugin/powerline.vim
13: /usr/share/vim/vim82/plugin/getscriptPlugin.vim
14: /usr/share/vim/vim82/plugin/gzip.vim
15: /usr/share/vim/vim82/plugin/logiPat.vim
16: /usr/share/vim/vim82/plugin/manpager.vim
17: /usr/share/vim/vim82/plugin/matchparen.vim
18: /usr/share/vim/vim82/plugin/netrwPlugin.vim
19: /usr/share/vim/vim82/plugin/rrhelper.vim
20: /usr/share/vim/vim82/plugin/spellfile.vim
21: /usr/share/vim/vim82/plugin/tarPlugin.vim
22: /usr/share/vim/vim82/plugin/tohtml.vim
23: /usr/share/vim/vim82/plugin/vimballPlugin.vim
24: /usr/share/vim/vim82/plugin/zipPlugin.vim

in /etc/vimrc I don't add any custom things.
Comment by Jiachen Yang (farseerfc) - Monday, 10 February 2020, 01:23 GMT
Please set `let g:powerline_pycmd = "py3"` in your ~/.vimrc, before anything else.
The installed vimscript (/usr/share/vim/vimfiles/plugin/powerline.vim) can be used with both python2 and python3, and it will load either version with `g:powerline_pycmd`.
You may also want `set laststatus =2` according to the official document of powerline.

Another way to setup powerline is to avoid installing powerline-vim package and initialize powerline from .vimrc by yourself.
It's documented here: https://powerline.readthedocs.io/en/master/usage/other.html#vim-statusline
The same vimscript is installed by python-powerline package in /usr/share/powerline/bindings/vim/plugin/powerline.vim , you will need to let vim load from there if you don't have powerline-vim package.

Loading...