nyngwang / NeoZoom.lua

A simple usecase of floating window to help you focus.
MIT License
184 stars 15 forks source link

scrolloff error #5

Closed onelesd closed 2 years ago

onelesd commented 2 years ago

When zooming in or out of any buffer I get the following error. After zooming back out once I only get the error when zooming in. Looks like getting the scrolloff isn't working right:

https://github.com/nyngwang/NeoZoom.lua/blob/main/lua/neo-zoom.lua#L9

E5108: Error executing lua vim/_meta.lua:170: Value for option 'scrolloff' is out of range
stack traceback:
        [C]: in function 'nvim_set_option'
        vim/_meta.lua:170: in function 'set_scoped_option'
        vim/_meta.lua:682: in function '_set'
        vim/_meta.lua:724: in function '__newindex'
        ...nvim/site/pack/packer/start/NeoZoom.lua/lua/neo-zoom.lua:12: in function 'pin_to_80_percent_height'
        ...nvim/site/pack/packer/start/NeoZoom.lua/lua/neo-zoom.lua:45: in function 'maximize_current_split'
        [string ":lua"]:1: in main chunk

My config:

vim.opt.scrolloff = 5
nyngwang commented 2 years ago

Thanks for the report! Let me take a look now.

nyngwang commented 2 years ago

You might try it again. Since I cannot reproduce it, my approach is to eliminate the usage of vim.opt.scrolloff. If the problem still persists, please let me know!

onelesd commented 2 years ago

LGTM! Thanks!

nyngwang commented 2 years ago

Great :) You're welcome~