numb.nvim is a Neovim plugin that peeks lines of the buffer in non-obtrusive way.
Peeking the buffer while entering command :{number}
The colorscheme is vim-substrata
use 'nacro90/numb.nvim'paq 'nacro90/numb.nvim'Plug 'nacro90/numb.nvim'{
'nacro90/numb.nvim',
}
-- or optionally pass `opts` to customize config
{
'nacro90/numb.nvim',
opts = {
-- customizable config here, see Options below
}
}Setup with default options:
require('numb').setup()If you are using a init.vim instead of init.lua, you will need to load the plugin like this:
:lua require('numb').setup()Disable the plugin globally:
require('numb').disable()You can also control the plugin at runtime through the :Numb user command,
which supports tab-completed subcommands:
:Numb disable " stop peeking
:Numb enable " resume peeking (preserves your config)
:Numb toggle " flip the current state (default when no argument is given)The matching Lua API is:
require('numb').disable()
require('numb').enable()
require('numb').is_enabled() -- returns boolean
require('numb').is_peeking(winnr?) -- returns boolean (current window if omitted)enable() preserves the options previously passed to setup{...}, so you do
not need to re-call setup() after a disable().
While a peek is active, numb.nvim sets the window-local flag
vim.w.numb_peeking = true. The flag is cleared (set back to nil) as soon
as the peek ends, whether confirmed or aborted. The scope is per window
so two splits viewing the same buffer never cross-flag each other.
A minimal lualine component using the flag:
require('lualine').setup{
sections = {
lualine_x = {
function() return vim.w.numb_peeking and 'peek' or '' end,
},
},
}Programmatic consumers can call require('numb').is_peeking() instead.
You can customize the behaviour with following:
require('numb').setup{
show_numbers = true, -- Enable 'number' for the window while peeking
show_cursorline = true, -- Enable 'cursorline' for the window while peeking
hide_relativenumbers = true, -- Enable turning off 'relativenumber' for the window while peeking
number_only = false, -- Peek only when the command is only a number instead of when it starts with a number
centered_peeking = true, -- Peeked line will be centered relative to window
}After running setup, you are good to go. You can try with entering a number to
the vim command line like :3.
When you disable numb, your options are kept in the module level. So after you
disable it, calling enable() (or setup() again) restores the plugin with
your customized options. You can override the options at any time by calling
setup{...} again or by passing them to enable{...}.
See CONTRIBUTING.md for the full workflow: setup, coding style, testing, commit conventions, and changelog discipline. Before opening a pull request, run scripts/check.sh to ensure Stylua formatting, the headless smoke test, and the automated regression tests all pass.
Release history is tracked in CHANGELOG.md following the Keep a Changelog format.
