Description
Hey! Thanks for this great plugin!
Today after updating my neovim build to the latest nightly (neovim/neovim@6d52a29), I started seeing errors originating from the set_editor_opts
function executed by the LightspeedLeave
autocommand.
Error detected while processing User Autocommands for "LightspeedLeave":
Error executing lua callback: ...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2764: E487: Argument must be positive
stack traceback:
[C]: in function '__newindex'
...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2764: in function <...ite/pack/packer/start/lightspeed.nvim/lua/lightsp
eed.lua:2757>
[C]: in function 'exec_user_autocmds'
...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2047: in function '_396_'
...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2050: in function 'get_first_input'
...ite/pack/packer/start/lightspeed.nvim/lua/lightspeed.lua:2369: in function 'go'
...m/site/pack/packer/start/lightspeed.nvim/plugin/init.lua:3: in function <...m/site/pack/packer/start/lightspeed.nvim/plugin/init
.lua:3>
The line that fails is
lightspeed.nvim/lua/lightspeed.lua
Line 2762 in 8fb5ebb
Investigation
I added a print
to see which option cannot be set.
print({ scope = scope, name = name, val = val })
It turns out, this code tries to set vim.wo.scrolloff = -1
, which fails with that error.
{
name = "scrolloff",
scope = "wo",
val = -1
}
I checked the results of the following neovim commands:
:lua print(vim.wo.scrolloff)
0
:echo &scrolloff
0
:echo &l:scrolloff
-1
:setlocal scrolloff?
-1
I believe the result of &l:scrolloff
may be a problem. After all, this is the value that is requested in
lightspeed.nvim/lua/lightspeed.lua
Lines 2741 to 2742 in 8fb5ebb
Possibly related to neovim/neovim#18743
Possible solution
If &l:scrolloff
is -1
, then looks like setlocal scrolloff
is not set, so there is no need to restore it, unless I am mistaken.