Dynamically sets scrolloff based on window height, keeping a proportional
number of context lines visible above and below the cursor regardless of
window size.
A Neovim port of vim-scrolloff-fraction.
Neovim 0.8+
The plugin auto-initialises with defaults via its plugin/ entry point. If
you want to customise options, pass them through your plugin manager's config
or call setup() explicitly.
{
"nkakouros-original/scrollofffraction.nvim",
opts = {},
}use {
"nkakouros-original/scrollofffraction.nvim",
config = function()
require("scrollofffraction").setup()
end,
}Shown below are the defaults:
require("scrollofffraction").setup({
-- Fraction of window height to keep above/below cursor
scrolloff_fraction = 0.25,
-- Filetypes that use a fixed scrolloff instead of the fraction
scrolloff_absolute_filetypes = { "qf" },
-- Fixed scrolloff value for the filetypes above
scrolloff_absolute_value = 0,
})scrolloff is recalculated on BufEnter, WinEnter, WinNew, and
VimResized.
Install stylua and format before submitting a PR:
stylua lua/The CI workflow checks formatting on every push and pull request.