/curlod

Lock your Neovim cursor down in a specified region of lines

Primary LanguageLuaMIT LicenseMIT

Curlod

Lock your Neovim cursor down in a specified region of lines.

The effect is limited to the active Neovim window, making this useful for having a separate, restricted view of a long document, while working on one part, while often referring to another part.

Usage

This will keep the cursor in the region starting at line 20, and ending at the first line that starts with END:

:CurlodEnable 20 /^END/

Arguments are optional, and can be line numbers, or Lua patterns passed to string.match, and wrapped in /s.

Alternatively, make a visual selection and run CurlodEnableRange on it:

:'<,'>CurlodEnableRange

Free your cursor again:

:CurlodDisable

Installation

Using vim-plug:

Plug 'walterl/curlod'

Development

Curlod was developed with Conjure and Aniseed.

Change log level

:CurlodLogLevel debug

Or info (default) or error.

Known limitations

Out-of-region changes are still possible

There are many ways to change text in Vim without moving the cursor. Curlod won't take on the Herculean task of trying to prevent that from happening outside of the Curlod region.

This is considered out of scope for Curlod, since the primary motivation is to keep the cursor bound to the specified region, in order to limit a window's view on a buffer.

Attempts to prevent out-of-region edits are likely to degrade overall user experience with an explosion in corner cases caused by combinations of hard to predict effects.

License

MIT