Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nkakouros-original/scrollofffraction.nvim
scrolloff as a fraction of window height
https://github.com/nkakouros-original/scrollofffraction.nvim
Last synced: about 2 months ago
JSON representation
scrolloff as a fraction of window height
- Host: GitHub
- URL: https://github.com/nkakouros-original/scrollofffraction.nvim
- Owner: nkakouros-original
- Created: 2023-12-30T21:41:30.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2023-12-30T22:25:28.000Z (5 months ago)
- Last Synced: 2024-04-06T13:41:25.798Z (about 2 months ago)
- Language: Lua
- Size: 1000 Bytes
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-neovim - nkakouros-original/scrollofffraction.nvim - Scrolloff as a fraction of the window height. (Scrolling / Treesitter Based)
README
# scrollofffraction
This is Noevim port of https://github.com/drzel/vim-scrolloff-fraction. The
Vimscript code was ported to lua and this README was created all with ChatGPT.scrollofffraction is a Neovim plugin written in Lua that dynamically sets the
`scrolloff` option based on the current window height and specific file types.
This plugin enhances the editing experience by maintaining a customizable
number of lines above and below the cursor, providing a more comfortable visual
context.## Installation
To install scrollofffraction, use your favorite Neovim plugin manager.
### Using [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
'nkakouros-original/scrollofffraction',
config = function()
require('scrollofffraction').setup()
end
}
```### Using [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'nkakouros-original/scrollofffraction'
lua << EOF
require('scrollofffraction').setup()
EOF
```After adding the plugin, run `:PlugInstall` in Neovim.
## Usage
To configure the plugin, add a call to `setup` in your Neovim configuration:
```lua
require('scrollofffraction').setup({
-- Configuration options
})
```## Configuration
The plugin can be configured by passing a table to the `setup` function. The available options are:
- `scrolloff_fraction`: Decimal fraction of the window height to keep above and below the cursor (default `0.25`).
- `scrolloff_absolute_filetypes`: List of filetypes where an absolute `scrolloff` value is used instead of a fraction (default `{ 'qf' }`).
- `scrolloff_absolute_value`: Absolute number of lines to keep above and below the cursor for specified filetypes (default `0`).Example configuration:
```lua
require('scrollofffraction').setup({
scrolloff_fraction = 0.3,
scrolloff_absolute_filetypes = { 'qf', 'markdown' },
scrolloff_absolute_value = 5
})
```