sindrets/winshift.nvim

"Invalid argument" when calling WinShift

Closed this issue ยท 13 comments

Howdy! Thanks for the plugin, it seems quite helpful.

I just set it up according to the README, copy/pasting the mappings and configuration exactly. I installed with vim-plug and I'm at commit cf436bd which seems to be the latest in the repo. I'm using neovim 0.5.0 on Linux.

If I open neovim with a few windows on different files, and then hit the mapping for WinShift, I get:

E5108: Error executing lua ...al/share/nvim/plugged/winshift.nvim/lua/winshift/lib.lua:623: E474: Invalid argument

That seems to point to:

I'm not very familiar with Vim's use of Lua, so I don't understand what's wrong, but naively that seems like a valid table.concat call..?

Note: that the WinShift swap and WinShift left/down/up/right mappings work fine and show no errors, it's just the main WinShift mode that fails. I assume that's because the error is coming from the highlight_win function, and swapping and moving directly don't highlight windows.

[edit] Same error with neovim 0.5.1.

@tjkirch Sorry about that. The bug was occurring because I was applying window highlights for LineNrAbove and LineNrBelow. These highlights were introduced in a vim patch that is not included in the 0.5 release. I wasn't aware of that. Should be fixed now.

Thanks, working great!

Not sure what I'm missing here, but I'm getting the error message as well ๐Ÿ™

@farzadmf Please provide the exact error message you're getting, and your nvim version.

Sorry @sindrets , my bad, I didn't mention the actual error:

E5108: Error executing lua ...e/farzad/.vim/plugged/winshift.nvim/lua/winshift/lib.lua:660: E474: Invalid argument

And my neovim version is:

NVIM v0.6.0-dev+43-g02bf251bb
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Not sure if it's important or not, but I don't think I have setup any settings for the plugin (it was working fine before; that's why I didn't mention it)

@farzadmf I can't reproduce this. Please try to reproduce it with this minimal config.

If you can reproduce it with the minimal config, please open a new issue. If not, then it's somehow related to your config.

Not sure if it's important or not, but I don't think I have setup any settings for the plugin

It shouldn't matter. The plugin should work without setup.

Thank you @sindrets , I was suspecting my config as well, although I haven't changed anything major recently, except updating neovim and my plugins, and it was working fine before.

I'll try to see if I can find what's causing the issue.

Do you have a pointer to give me? What is that function expecting that's not being passed to it (or, as the error suggests, is Invalid)?

Do you have a pointer to give me? What is that function expecting that's not being passed to it (or, as the error suggests, is Invalid)?

@farzadmf It means that one of the highlight groups I'm trying to set as a :h 'winhl' is not recognized as a builtin highlight group.

I now suspect that you just have an old 0.6 build. LineNrAbove and LineNrBelow was merged in August: neovim/neovim@3202478

Try updating your Neovim. If you're using 0.6 you should at least be using the tagged release: neovim/neovim@e65b724

Hey @sindrets , sorry for the delayed response.

When I run :h 'winhl' in my neovim, I do see the help topic. I guess that means that I have that highlight group, right?

@farzadmf no. If you read the documentation you will see that 'winhl' is a window local setting for overriding highlights in a window. It's not a highlight group. The actual highlight group is documented in :h hl-LineNrAbove.

But again, I'm pretty sure you just need to update your neovim. NVIM v0.6.0-dev+43 is very old (for a 0.6 build), and the full version 0.6 has been released. I can't support nightly releases between full releases. I'm doing feature detection, but when your nvim reports that it is version 0.6, I have to be able to assume that you have all the features from 0.6.

It's not a highlight group

Yup, I just realized after I asked the (stupid) question ๐Ÿคฆโ€โ™‚๏ธ

NVIM v0.6.0-dev+43 is very old

Didn't know that. I was using the nightly builds in Manjaro, thinking that they're more up-to-date than the "stable" ones. I will change to use the stable one

I can't support nightly releases between full releases

That completely makes sense @sindrets , it would be a huge pain if you wanted to do that

@farzadmf If you're using neovim-git from the AUR you have to manually update with

[AUR-helper-of-choice] -S neovim-git

As is the standard for all *-git packages on Arch, as these always just pull down the newest sources on install. Git packages won't show up as needing updating unless the maintainer manually bumps the version number in the package repo. They might do this from time to time for convenience, but if you want to stay up to date you shouldn't rely on that.

Thank you @sindrets for the info. For now, I switched to using the one in brew (I guess until I see the next error and forced to switch to something else ๐Ÿ˜†)