Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NeoVim #1287

Open
abstiles opened this issue Jan 27, 2015 · 27 comments
Open

Add support for NeoVim #1287

abstiles opened this issue Jan 27, 2015 · 27 comments

Comments

@abstiles
Copy link

I understand that this may not be immediately feasible due to the still-unstable nature of NeoVim, but I'd like to make the request anyway.

First, powerline fails when it tries to access the bindeval method which NeoVim does not support. I attempted to do some initial debugging, and discovered that Powerline relies on Vim's 7.4 Python API when it detects a version greater than 703. NeoVim reports as version 704 right now, but has not added support for Vim's 7.4 Python API (see discussion on neovim/neovim#1898), which apparently includes the bindeval method. After attempting to work around this by modifying powerline's version checking, I'm still seeing the following issue:

Error detected while processing function PowerlinePyeval..provider#python#Call:
line    1:
NameError("name 'powerline' is not defined",)

I'm not sure what's going on here that it cannot find "powerline". Executing :py import sys; print sys.path seems to indicate that the right paths can be found, and I can execute :py import powerline without complaint.

For the record, I'm running the latest NeoVim (NVIM 0.0.0-alpha+201501262108) on Mac OS 10.10, with Python 2.7 installed through homebrew, and powerline 2.0 installed through pip.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ZyX-I
Copy link
Contributor

ZyX-I commented Jan 27, 2015

@abstiles powerline that is not found has nothing to do with powerline module. It is an instance of powerline.vim.VimPowerline class that is expected to live in __main__ module. If

python foo = 1

will add variable foo to something other then __main__ module bindings will not work. But in any case you should not try to use bindings for old Vim because the very reason pyeval was added in first place is that other ways around are fucking slow (well, they are not that slow for powerline because I wrote them for transmitting files a few KiBs to a few MiBs in one turn and powerline was never close to that data rate, but there is still much overhead for dumping strings). NeoVim is using msgpack over sockets and this is going to be way slower. I was not going to add NeoVim support any time soon because this needs a major rewrite of Vim bindings since

&statusline
   \/
pyeval
   \/
…
   \/
segment function
   \/
vim.eval
   \/
result
   \/
displayed statusline

is fine, but

&statusline
  \/
:python          --------msgpack-rpc------>  … > segment function
                                                \/
vim_eval         <-------msgpack-rpc-------  vim.eval
  \/
eval result (C)  --------msgpack-rpc------>  result (Python)
                                                \/
displayed stl    <-------msgpack-rpc-------  segment function result

(in all cases: repeated for each segment function which bothers to use some interface with Vim) is not and I do not need tests to say that this would not work.

The only alternative approach I can see is

startup notification  -------msgpack-rpc------->  powerline
                                                     \/
                                                     …
                                                     \/
                                                  segment.startup
                                                     \/
&statusline function  <------msgpack-rpc--------  list of things needed from NeoVim
  \/
computed list of things ----------msgpack-rpc-----------------------------+
                                                                          |
&statusline                                                               |
  \/                                                                      |
:python (+computed list of things)  -------msgpack-rpc------->  renderer  |    ----->  … > segment function
                                                                   \/     \/                    \/
displayed statusline                <------msgpack-rpc--------  cached result                result
                                                                                                |
&statusline                                                               +---------------------+
  \/                                                                      |
:python (+computed list of things)  -------msgpack-rpc------->  renderer  |    ----->  … > segment function
                                                                   \/     \/                    \/
displayed statusline                <------msgpack-rpc--------  cached result                result
                                                                                                |
…

, but as you see there will be a lag between when things needed from NeoVim are computed and when they are displayed. In this case it may though can appear that I can afford waiting until computed things are processed, so there will be no lag, but I am not sure. Rewrite is needed in any case.

There is also an alternative where statusline function constantly computes things and sends them to powerline and powerline constantly sends back an updates to &statusline when they are ready, but this is no different regarding how segment functions need to be rewritten and this variant is rather not compatible with Vim.

Some things in a list may be replaced with NeoVim events which is a bit faster.

@pdf
Copy link
Contributor

pdf commented Feb 10, 2015

Is there not some way to at least get this working, even if it doesn't perform optimally? I tried bumping the version conditionals from 703 to 704, but all that got me was:

Error detected while processing function provider#python#Call:
line    1:
NameError("name 'powerline' is not defined",)

Instead of:

Error detected while processing function provider#python#Call:
line    1:
AttributeError("'Nvim' object has no attribute 'bindeval'",)
NameError("name 'powerline_setup' is not defined",)
NameError("name 'powerline_setup' is not defined",)

If I add a test for hasattr(vim, 'bindeval') before the calls to bindeval that don't have any, I just get:

Error detected while processing function provider#python#Call:
line    1:
NvimError('Key not found',)

So, I'm wondering exactly what features are broken and/or whether <=703 do currently work, and if so, how to properly force Powerline to use the older bindings with NeoVim.

@ZyX-I
Copy link
Contributor

ZyX-I commented Feb 10, 2015

NeoVim does not support full Python API even from version 7.0. There is a patch for powerline which I used to get it working to have some performance measurements and it is more then just adding a few ifs. I.e. see neovim/pynvim#85, neovim/pynvim#84, neovim/pynvim#87.

@pdf
Copy link
Contributor

pdf commented Feb 10, 2015

Oh right, ugly. Thanks for the links.

@abstiles
Copy link
Author

I've noticed no new activity on this issue or the related Neovim issues. Are there simply irreconcilable differences between Neovim and Powerline such that there are no plans for Powerline to support Neovim?

I'd like to know if you see any hope of resolving the problems here, or if I should give up my hope of using Powerline in Neovim.

@kierun
Copy link
Contributor

kierun commented Sep 29, 2015

Might I add my vote for this feature as well?

@philbert
Copy link

Is there a good alternative to powerline that works with neovim?

@aarobc
Copy link

aarobc commented Dec 18, 2015

@Phiche check out https://github.com/bling/vim-airline

@philbert
Copy link

Nice! That works! Thanks @aarobc!

@code-hunger
Copy link

Very hard to choose between neovim and powerline...
+∞

@kierun
Copy link
Contributor

kierun commented Mar 23, 2016

@code-hunger vim-airline offers similar functionality to powerline and works fine with neovim.

@code-hunger
Copy link

@kierun thanks, it seems to do quite the same job.

@Goddard
Copy link

Goddard commented Mar 23, 2016

The only downside with airline is you have to configure it apart from powerline and if you already use powerline in bash, weechat/irssi, tmux, etc... it is just a little annoying to do that.

@sassanh
Copy link

sassanh commented Mar 24, 2016

@Goddard Take a look at these:

https://github.com/edkolev/promptline.vim
https://github.com/edkolev/tmuxline.vim

Above projects generate scripts for bash, zsh, fish and tmux and the generated script is native code that doesn't call any external program like python.

@adam-m-jcbs
Copy link

I'm making the switch to nvim, and would love to see Powerline support for it.

@X-dark
Copy link

X-dark commented Oct 20, 2016

Could you just stop spamming this bug report with useless "+1". Just use the "reaction" github feature on the first post.

@smichel17
Copy link

Likewise, you can go back and delete your "+1" comments to make this issue easier to follow.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Apr 1, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue Apr 24, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue Apr 29, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue May 20, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jun 2, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jun 30, 2017
This variant also supports Neovim, ref powerline#1287.
ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jul 13, 2017
This variant also supports Neovim, ref powerline#1287.
lhanson added a commit to lhanson/dotfiles that referenced this issue May 1, 2018
@powerline powerline deleted a comment from mseri Jun 27, 2020
@powerline powerline deleted a comment from gkze Jun 27, 2020
@powerline powerline deleted a comment from nomasprime Jun 27, 2020
@powerline powerline deleted a comment Jun 27, 2020
@powerline powerline deleted a comment from sassanh Jun 27, 2020
@powerline powerline deleted a comment from zabolotnov87 Jun 27, 2020
@powerline powerline deleted a comment from Goddard Jun 27, 2020
@powerline powerline deleted a comment from ofw Jun 27, 2020
@powerline powerline deleted a comment from g3d Jun 27, 2020
@powerline powerline deleted a comment from iocentos Jun 27, 2020
@powerline powerline deleted a comment from mkp7 Jun 27, 2020
@powerline powerline deleted a comment from wkoomson Jun 27, 2020
@powerline powerline deleted a comment from hroussille Jun 27, 2020
@powerline powerline deleted a comment from 0xC0D3D00D Jun 27, 2020
@powerline powerline deleted a comment from rafee Jun 27, 2020
@powerline powerline deleted a comment from imirzadeh Jun 27, 2020
@powerline powerline deleted a comment from melrief Jun 27, 2020
@powerline powerline deleted a comment from leifwickland Jun 27, 2020
@powerline powerline deleted a comment from notrev Jun 27, 2020
@powerline powerline deleted a comment from qtleeq Jun 27, 2020
@PH111P
Copy link
Member

PH111P commented Jun 27, 2020

5 1/2 years, and still doesn't work at all? Is there an update on the status of this, or the likelihood this will work at some point in the future?

Sadly, there is no progress towards supporting NeoVim and looking at @ZyX-I original comments on this issue, I'm not very optimistic regarding the future. Perhaps NeoVim changed something regarding its python support in the meantime (which I don't know) so it would make sense to look at this again; if not and if they don't do so, I'm not very optimistic that NeoVim support will be added (at least by me) in the near future, sorry.

Unrelated: I just removed the plethora of “+1” comments to make this issue somewhat more readable.

@matheusfillipe
Copy link

matheusfillipe commented Jul 16, 2020

Is there a way to hide this error at least? In my case i want to have both neovim an vim with powerline.

@PH111P
Copy link
Member

PH111P commented Jul 17, 2020

Is there a way to hide this error at least? In my case i want to have both neovim an vim with powerline.

You can try the following: In your .vimrc, put all powerline-related code in a if !has('nvim') ... endif block.

@Farzat07
Copy link

5 1/2 years, and still doesn't work at all? Is there an update on the status of this, or the likelihood this will work at some point in the future?

Sadly, there is no progress towards supporting NeoVim and looking at @ZyX-I original comments on this issue, I'm not very optimistic regarding the future. Perhaps NeoVim changed something regarding its python support in the meantime (which I don't know) so it would make sense to look at this again; if not and if they don't do so, I'm not very optimistic that NeoVim support will be added (at least by me) in the near future, sorry.

Unrelated: I just removed the plethora of “+1” comments to make this issue somewhat more readable.

Maybe making use of the pynvim package might add prospects?

@PH111P
Copy link
Member

PH111P commented Mar 28, 2021

After a quick look at that project, while it does look promising, getting powerline to work still seems to require some effort. (I'd be happy to be proven wrong though.)

JuanCrg90 added a commit to JuanCrg90/dotfiles that referenced this issue Nov 5, 2021
It's time to try new things this updates my dotfiles to use neovim

NOTE: Powerline is broken
https://www.reddit.com/r/neovim/comments/nlgva2/neovim_and_powerline/
powerline/powerline#1287
@macizomedia
Copy link

I am not python developer so no env for me I just wanted powerline for tmux but not for nvim so there is this woraround found this let g:powerline_loaded = 1

@mbanerjeepalmer
Copy link

Can this be made explicit in the docs? There's no indication that NeoVim doesn't work. So it's easy to spend a long time hunting down errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests