Open-source project
nacro90/numb.nvim avatar
nacro90/numb.nvim

numb.nvim: previewing the line you are about to jump to

Peek lines just when you intend

888 stars14 forksLuaMIT

At a glance

What is it?
numb.nvim is a Neovim plugin that peeks the destination while you type a line address on the command line, so you see where :120 goes before you commit to it, and it also previews destructive ranges like :50,80d. It suits anyone who has lost their place jumping around a long buffer.
Who is it for?
numb.nvim is a good fit for a Neovim user who jumps by line number constantly, because the plugin's whole premise is that a line address is a blind jump and it makes the destination visible first, and because it handles the cases Vim leaves uncovered, including destructive ranges and the arithmetic forms of the address.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 25 days ago.
What is it written in?
Mainly Lua, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The problem is that a line address is a blind jump

The pitch is stated in one sentence and it is a good one. Typing :120 in Vim is a blind jump, where you lose your place, look around and press control-o to crawl back. numb.nvim previews the destination as you type it, and confirming with the return key puts you there, while aborting with the escape key sends the window back to the cursor position, the window options and the vertical scroll position it had. That last detail is what separates this from a crude implementation. Restoring the scroll position and the window options rather than just the cursor line is the difference between a preview you can back out of and a preview that leaves your editor in a slightly different state than you found it. The plugin is also careful about the jumplist, with the entry pushed so that control-o still works afterwards, and it unfolds folds so the target is genuinely on screen, since a preview that lands inside a folded region is not a preview. The requirement is Neovim 0.10 or newer and nothing else, since the plugin uses only stock Neovim and Lua with no runtime dependencies.

It covers the address forms Vim's own preview leaves out

The feature list is precise about which address syntaxes are previewed. Absolute addresses such as :15, relative ones like :+5 and :-3, chained ones like :++, the line symbols :. and :$, and arithmetic on any of them, such as :.+5, :$-3 and :10-2. Out of bounds targets clamp to the first or last line instead of erroring, which is a small decision that avoids the failure mode where a peek on a bad address turns into an error message instead of a preview. Marks and searches, in the forms :'a and :/foo/, are deliberately left to Vim and are not previewed, and the reasoning is sound, since a mark and a search both need to resolve before there is anything to show. The plugin is also faithful to Ex semantics in a way that matters for the range case, since both separators are honoured, with a comma counting from the cursor and a semicolon from the previous address, and when more than two addresses are given the last two win, so :5,10,15d highlights the 10 to 15 that Ex will really act on. Getting that wrong would mean the preview shows something different from what the command does, which defeats the purpose.

Previewing a range before you delete it

The second headline feature is previewing destructive ranges, and the reason it exists is specific. :50,80d highlights lines 50 to 80 before you commit to the deletion, and the explanation for why this was needed is that Neovim previews :substitute through inccommand and nothing else, so the delete, yank, move, copy and global commands had no preview at all. That is a real gap in Vim's own behaviour, and a gap that matters most for exactly the commands where a mistake is expensive. The range preview is controlled by the range_peek option, which defaults to true and highlights the whole range while you are typing a range followed by a command. The other direction of this feature is the number_only option, which is false by default, and when it is true the plugin peeks only when the command line is nothing but an address, so :15 peeks but :15,20d does not. That option is a matter of taste, and turning it on gives you a quieter experience at the cost of losing the range preview, which is why both directions exist.

Float peeking leaves your window where it was

The peek_style option decides where the preview is drawn, and the three values correspond to three different compromises. The default window style draws the preview in the window itself, and the centred_peeking option that goes with it centres the previewed line the way the zz command does, except that near the end of the buffer the window stays full. The float style draws the target in a strip over the window while the window itself does not move, and confirming still lands on the target. The auto style is in place when the target is on screen and floats when it is not, which is the setting that gives you a preview without disorientation in the common case where the destination is a few lines away. The float option controls how that float looks, with a height as a fraction of the window or a number of rows, a position of bottom, top or auto, and an optional win_config function for the rest. The float style is the newer of the two, and it appears in the release notes for v1.3.0 alongside the peek API, which suggests it is the direction the project is moving.

An API for other plugins, and events to follow a peek

The plugin exposes an API so that other plugins can reuse the behaviour, which is the part that makes it more than a personal convenience. The require call with peek gives pickers and symbol lists the same preview, and there are User NumbPeek and User NumbUnpeek events to follow any peek, including one triggered by another plugin rather than by typing. That event pair is the important half, because it means a telescope picker or a tree of symbols can show you where a jump will land without the plugin needing to know anything about that picker. The runtime control is a single command with tab completed subcommands, so :Numb disable stops peeking, :Numb enable resumes peeking with the configuration already in effect, and :Numb toggle flips the current state, which is the default when no argument is given. The same operations are available from Lua through the enable, disable and toggle calls on the module, and the enable call takes an optional options argument that overrides the configuration for that call. There is also a statusline variable, vim.w.numb_peeking, and a checkhealth command for when something looks off.

Configuration errors are ignored rather than raised

The failure behaviour of the configuration system is unusual and worth knowing. A misspelled option name, or a value of the wrong type, is reported through vim.notify and ignored, so invalid configuration never raises an error, the affected option keeps its default and the rest of your table is applied as usual. For a plugin that runs setup() automatically, that is the right choice, because a typo in an option should not stop your editor from starting. The options themselves are a small table, and every one may be omitted with the rest keeping their defaults. There are options for showing numbers and the cursor line in the peeked window, and for hiding relative numbers so the numbers stop shifting, which is a detail that makes the preview readable rather than a wall of changing digits. There are the two exclusion lists, disable_for_buftype and disable_for_filetype, which default to empty, and the documentation explains the choice with a good argument, that Vim performs a :15 in a terminal buffer exactly as it does anywhere else, so excluding one means accepting a jump that happens with nothing shown before it, and you should exclude a type when that is the trade you want. The plugin is installed with the usual managers, and with lazy.nvim it is a single entry:

lua
{ 'nacro90/numb.nvim' }

The readme notes that it calls setup() itself from plugin/numb.lua, so it works as soon as it is on your runtimepath and calling setup() is only for passing options, which in lazy.nvim means passing an opts table.

Editorial conclusion

numb.nvim is a good fit for a Neovim user who jumps by line number constantly, because the plugin's whole premise is that a line address is a blind jump and it makes the destination visible first, and because it handles the cases Vim leaves uncovered, including destructive ranges and the arithmetic forms of the address. It is the wrong tool if you already have a plugin that does this, since the behaviour overlaps with existing line-number preview plugins, and it is the wrong tool if you do not use line addresses at all. It is also the wrong tool if you cannot accept a plugin that hooks the command line, because the mechanism is exactly that and the plugin cannot be used selectively per buffer type beyond the exclusion lists. Before adopting it, read the float peek section and try the auto peek style, because the window style centres the target and the float style does not move the window at all, and that choice matters more than the rest of the options. The project is MIT licensed, the last push was on 2026-09-28, and the current release is v1.3.0 from 2026-09-27.

Frequently asked questions

What does numb.nvim do in Neovim?

It peeks the destination while you type a line address on the command line, so :120 shows you where it goes before you commit. Confirming with the return key moves there, and aborting with the escape key restores the cursor position, the window options and the vertical scroll position you had.

Which command line address forms does numb.nvim preview?

Absolute addresses like :15, relative ones like :+5 and :-3, chained ones like :++, the line symbols :. and :$, and arithmetic on any of them such as :.+5 and :10-2. Out of bounds targets clamp to the first or last line rather than erroring, while marks and searches are left to Vim and are not previewed.

Can numb.nvim preview a destructive range such as :50,80d?

Yes, the range_peek option, on by default, highlights the whole range while you type it, before the command runs. This fills a gap, because Neovim previews :substitute through inccommand and nothing else, so the delete, yank, move, copy and global commands had no preview at all.

What is the difference between the window and float peek styles?

With peek_style set to window, the default, the preview is drawn in the window itself and the previewed line is centred the way zz does, except near the end of the buffer. With float, the target is shown in a strip over the window and the window does not move at all, and with auto it floats only when the target is off screen.

Can other plugins use the numb.nvim preview?

Yes, the plugin exposes an API, so a peek call gives pickers and symbol lists the same preview, and User NumbPeek and User NumbUnpeek events let anything follow a peek, including one triggered by another plugin. Runtime control is through the Numb command with disable, enable and toggle subcommands, and the same operations are available from Lua.

Official sources

  1. Issues
  2. License: MIT
  3. nacro90/numb.nvim on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/nacro90-numb-nvim.svg)](https://hysenlabs.com/projects/nacro90-numb-nvim)

Was this useful?