lightspeed.nvim
lightspeed.nvim copied to clipboard
Error executing lua vim.lua:0: attempt to call method 'byte' (a nil value)
Hi,
I'm using neovim version v0.7.0-dev, along with packer and this plugin, but I can't use the s command an the Scommand cause an exception is thrown. The f and the F command is working properly.
Mi packer config is just:
use { "ggandor/lightspeed.nvim" }
Here is the error:
E5108: Error executing lua vim.lua:0: attempt to call method 'byte' (a nil value)
stack traceback:
vim.lua: in function 'region'
/usr/share/nvim/runtime/lua/vim/highlight.lua:37: in function 'grey_out_search_area'
.../site/pack/packer/opt/lightspeed.nvim/lua/lightspeed.lua:2139: in function 'go'
[string ":lua"]:1: in main chunk
Thanks for your time!
(Fortunately) I cannot reproduce with the latest nightly. But I have no clue about the problem.
In Lightspeed, grey-out-search-area calls highlight-range-compat, with "v" passed in as regtype:
https://github.com/ggandor/lightspeed.nvim/blob/3a8759e10c315d4fe36bfb15a7e243fdee5f33e7/fnl/lightspeed.fnl#L343-L349
highlight-range-compat calls vim.highlight.range (that even defaults to "v" if the regtype argument is missing, so it actually shouldn't matter at all what we are doing in the plugin's code),
https://github.com/neovim/neovim/blob/e383543342db8e9dcf40f7d5237edeab29638880/runtime/lua/vim/highlight.lua#L38-L49
that in turn calls vim.region (passing on regtype to it), which throws the exception, when trying to call the byte method on "v".
https://github.com/neovim/neovim/blob/e383543342db8e9dcf40f7d5237edeab29638880/src/nvim/lua/vim.lua#L319-L332.
At least, if I'm not missing anything.
Ok, I think I have found it. #126, again :D It's insane how could both me and the author overlook so many errors, in such a small PR (and not test it...). There are three tables passed in, instead of one, in grey-out-search-area, in the single-window branch. Fixing this right now. (Now I'm actually wondering, why does it work for me, and apparently, for others, without errors? Edit: Because {regtype :v} is a perfectly valid opts table in itself, and the following ones are simply ignored. So, while it is good that we corrected this, it's not relevant.)
Hi, unfortunately this issue persists for me.

As the original author i use an unconfigured lightspeed.

I'm using latest neovim nightly and (surely) this plugin after fix commit
Okay, then first test it with stable Nvim, and then try older commits of Lightspeed...
The regtype argument apparently exists (not nil), because otherwise we'd have a message of "attempt to index... a nil value".
As a desperate sanity check, try lua local a = "v"; print(a:byte()) on the Nvim command line first.
FWIW, I got this error until I updated to the latest neovim master.
Sorry for late response.
Latest version works on nvim v0.6.1.
Commit 005320ff9e128de8689c6e675fa64ed5963e2d1c seems to be the last working with ~~0.7.1~~ 0.7.0 for me. Commit 8fd73360e89a219b5701339c08a469f5703cf163 doesn't make any keymaps. Commit e53a14b2b279e92fbca9646ec14188ab76dd009a shows error described above.
Could you give me the exact version of the nightly you are using? Is it possible that you are not using the actual latest one, but one that is before merging https://github.com/neovim/neovim/pull/17462, not including the breaking change in the signature of vim.highlight.range?
NVIM v0.7.0-dev+995-g255935903
Build type: Release
LuaJIT 2.1.0-beta3
Just realized two neovims were installed on the system, and older one was chosen. It works on the true latest version.
I apologize and thanks.
Okay, great, no problem!
This occurs for me with (an older) Neovim nightly NVIM v0.7.0-dev+1032-g01e58fb14 making the plugin unusable, so does this mean that the minimum required Neovim version has changed? The readme still mentions 0.5+.
@smjonas No. The plugin works with any stable Nvim (0.5+), but if you are on the nightly branch, you should always update to the current latest release.
This still happens for me on the absolute latest master branch.
NVIM v0.7.0-dev+e23af71d3 Build type: Debug LuaJIT 2.1.0-beta3
@mattdemichele-pearson I cannot reproduce. At least on
NVIM v0.7.0-dev+1182-ge23af71d3
Build type: RelWithDebInfo
Maybe it has something to do with the Debug build(?)
I'm having this problem as well since today, I build from source, did it just now.

@yngwi And you're pretty sure that you're using the latest Lightspeed too?
@yngwi And you're pretty sure that you're using the latest Lightspeed too?
I thought I was as I am using a docker container that automatically updates everything on command, but apparently I was mistaken. I tried again today (updating my environment) and the error is gone now. Thanks and sorry for the confusion.
I removed and reinstalled it and still get this error.
E5108: Error executing lua vim.lua:0: attempt to call method 'byte' (a nil value)
stack traceback:
vim.lua: in function 'region'
/usr/local/share/nvim/runtime/lua/vim/highlight.lua:37: in function 'grey_out_search_area'
...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2145: in function 'go'
[string ":lua"]:1: in main chunk
@h3ndry This should work now, double-check that it's the latest Nvim nightly and the latest Lightspeed you're using.
Same error here and updated from v0.7.0-dev+1077-g2c4efc034 to v0.7.0-dev+1237-g76769b8a1 and now it works like a charm :)
I reverted to the neovim stable version https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable and that seemed to fix it too
@h3ndry This should work now, double-check that it's the latest Nvim nightly and the latest Lightspeed you're using.
Thank you. I updated neovim to v0.7.0-dev+1245-gf291a0339. and that seemed to fix it.
I have this issue in NVIM v0.7.0-dev+1280-gf2e5f509d.
Is anyone able to repro?
@vidjul Update Lightspeed too.
I was using neovim version v0.7.0-dev+882-g9304ee387. Uninstalled then installed stable (0.6.1) and this now works like a charm. Thanks!
Same here, Ubuntu with latest neovim from ppa, lightspeed updated.
Reverting to 005320ff9e128de8689c6e675fa64ed5963e2d1c fixes the problem
Issue remains on latest release.
:version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld
switching to Commit 005320ff9e128de8689c6e675fa64ed5963e2d1c fixed it for me
` NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az316-460
Features: +acl +iconv +tui See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/share/nvim"
Run :checkhealth for more info `