Add support for NeoVim #1287

Open
abstiles opened this Issue Jan 27, 2015 · 43 comments

Comments

Projects
None yet
@abstiles

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

This comment has been minimized.

Show comment
Hide comment
@ZyX-I

ZyX-I Jan 27, 2015

Contributor

@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.

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

This comment has been minimized.

Show comment
Hide comment
@pdf

pdf Feb 10, 2015

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@ZyX-I

ZyX-I Feb 10, 2015

Contributor

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/python-client#85, neovim/python-client#84, neovim/python-client#87.

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/python-client#85, neovim/python-client#84, neovim/python-client#87.

@pdf

This comment has been minimized.

Show comment
Hide comment
@pdf

pdf Feb 10, 2015

Contributor

Oh right, ugly. Thanks for the links.

Contributor

pdf commented Feb 10, 2015

Oh right, ugly. Thanks for the links.

@abstiles

This comment has been minimized.

Show comment
Hide comment
@abstiles

abstiles Jun 20, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@kierun

kierun Sep 29, 2015

Contributor

Might I add my vote for this feature as well?

Contributor

kierun commented Sep 29, 2015

Might I add my vote for this feature as well?

@catskul

This comment has been minimized.

Show comment
Hide comment

catskul commented Oct 31, 2015

+1

@ruslanosipov

This comment has been minimized.

Show comment
Hide comment

+1

@Determinant

This comment has been minimized.

Show comment
Hide comment
@Determinant

Determinant Nov 12, 2015

Contributor

+1

Contributor

Determinant commented Nov 12, 2015

+1

@p-groarke

This comment has been minimized.

Show comment
Hide comment

+1

@bezhermoso

This comment has been minimized.

Show comment
Hide comment

+1

@ZyX-I ZyX-I referenced this issue Dec 5, 2015

Open

[WIP] Refactor editors code #1507

6 of 13 tasks complete
@danihodovic

This comment has been minimized.

Show comment
Hide comment

+1

@mseri

This comment has been minimized.

Show comment
Hide comment

mseri commented Dec 12, 2015

+1

@philbert

This comment has been minimized.

Show comment
Hide comment
@philbert

philbert Dec 18, 2015

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

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

@aarobc

This comment has been minimized.

Show comment
Hide comment
@philbert

This comment has been minimized.

Show comment
Hide comment
@philbert

philbert Dec 19, 2015

Nice! That works! Thanks @aarobc!

Nice! That works! Thanks @aarobc!

@gkze

This comment has been minimized.

Show comment
Hide comment

gkze commented Feb 5, 2016

+1

@nomasprime

This comment has been minimized.

Show comment
Hide comment

+1

@ghost

This comment has been minimized.

Show comment
Hide comment

ghost commented Feb 23, 2016

+1

@sassanh

This comment has been minimized.

Show comment
Hide comment

sassanh commented Mar 4, 2016

+1

@zabolotnov87

This comment has been minimized.

Show comment
Hide comment

+1

@Goddard

This comment has been minimized.

Show comment
Hide comment

Goddard commented Mar 8, 2016

+1

@ofw

This comment has been minimized.

Show comment
Hide comment

ofw commented Mar 11, 2016

+1

@g3d

This comment has been minimized.

Show comment
Hide comment

g3d commented Mar 22, 2016

+1

@code-hunger

This comment has been minimized.

Show comment
Hide comment
@code-hunger

code-hunger Mar 23, 2016

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

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

@kierun

This comment has been minimized.

Show comment
Hide comment
@kierun

kierun Mar 23, 2016

Contributor

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

Contributor

kierun commented Mar 23, 2016

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

@code-hunger

This comment has been minimized.

Show comment
Hide comment
@code-hunger

code-hunger Mar 23, 2016

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

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

@Goddard

This comment has been minimized.

Show comment
Hide comment
@Goddard

Goddard 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.

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

This comment has been minimized.

Show comment
Hide comment
@sassanh

sassanh 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.

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.

@centosGit

This comment has been minimized.

Show comment
Hide comment

+1

@mkp7

This comment has been minimized.

Show comment
Hide comment

mkp7 commented Jun 12, 2016

+1

@wkoomson

This comment has been minimized.

Show comment
Hide comment

wkoomson commented Aug 2, 2016

+1

@Happykat

This comment has been minimized.

Show comment
Hide comment

Happykat commented Aug 7, 2016

+1

@0xC0D3D00D

This comment has been minimized.

Show comment
Hide comment

+1

@rafee

This comment has been minimized.

Show comment
Hide comment

rafee commented Sep 11, 2016

+1

@imirzadeh

This comment has been minimized.

Show comment
Hide comment

+1

@adam-m-jcbs

This comment has been minimized.

Show comment
Hide comment
@adam-m-jcbs

adam-m-jcbs Sep 20, 2016

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

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

@melrief

This comment has been minimized.

Show comment
Hide comment

melrief commented Sep 21, 2016

+1

@leifwickland

This comment has been minimized.

Show comment
Hide comment

+1

@notrev

This comment has been minimized.

Show comment
Hide comment

notrev commented Oct 13, 2016

+1

@X-dark

This comment has been minimized.

Show comment
Hide comment
@X-dark

X-dark Oct 20, 2016

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

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

This comment has been minimized.

Show comment
Hide comment
@smichel17

smichel17 Dec 23, 2016

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

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

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Apr 24, 2017

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Apr 29, 2017

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue May 20, 2017

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jun 2, 2017

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jun 30, 2017

Fix some problems
This variant also supports Neovim, ref #1287.

ZyX-I added a commit to ZyX-I/powerline that referenced this issue Jul 13, 2017

Fix some problems
This variant also supports Neovim, ref #1287.
@TaylorDennisLee

This comment has been minimized.

Show comment
Hide comment

+1

lhanson added a commit to lhanson/dotfiles that referenced this issue May 1, 2018

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