Skip to content

v1.2.0: range preview, :h numb and :checkhealth numb

Latest

Choose a tag to compare

@nacro90 nacro90 released this 02 Aug 07:49

Added

  • Range preview. Typing :N,M{cmd} now highlights the whole line range, so a
    destructive command such as :50,80d can be checked before it runs. Neovim
    previews :substitute through inccommand but nothing else, so :d, :y,
    :m, :t and :g previously had no preview at all. The lower bound is also
    peeked, so the start of the range is on screen; that is where :d leaves the
    cursor, while :y does not move it and :m, :t and :s finish near their
    destination. Reversed bounds
    are accepted, endpoints may use ., $ and arithmetic (:.,+5, :30,$),
    and mark or search ranges are left to Vim untouched. Both Ex separators work:
    , counts an offset from the cursor and ; counts it from the address before
    it, so :5;+3 is 5 through 8. When more than two addresses are given, Ex acts
    on the last two, so :5,10,15d highlights 10 through 15 rather than the lines
    that survive. Controlled by the new
    range_peek option, on by default; the highlight group is NumbRange, linked
    to Visual unless you define your own. The highlight belongs to the buffer,
    so it appears in every split showing that buffer, while the cursor and the
    window options stay per window as before.
  • Vimdoc help file, so :h numb works from inside Neovim. Every option and
    public function has its own tag (:h numb-options, :h numb.setup()), and CI
    derives the required tags from the Lua sources, so adding an option without
    documenting it fails the build. doc/tags is generated by your plugin manager
    and is not tracked.
  • require('numb').get_config(), returning a copy of the configuration in
    effect with defaults merged in. Statusline components and other integrations
    previously had no way to read it without reaching into plugin internals.
  • :checkhealth numb. Reports the Neovim version against the supported floor,
    where the plugin was loaded from and whether a second copy is shadowing it,
    whether it is set up, and the active configuration so a pasted health report
    is self-contained. Being disabled on purpose is reported as a warning, not an
    error.
  • disable_for_buftype and disable_for_filetype, lists of buftype and
    filetype values to leave alone. A window showing one of them is never peeked
    in, which is what you want for buffers a plugin owns. Both default to empty,
    terminal buffers included: Vim performs :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. Invalid values are reported like any other
    option, including a list that holds something other than strings.
  • A load guard and a way to opt out of loading. numb.nvim sets vim.g.loaded_numb
    when it loads and returns early when it is already set, so sourcing
    plugin/numb.lua again no longer calls setup() with no arguments and resets
    the options you had configured. Setting
    vim.g.loaded_numb = 1 before startup keeps the plugin from loading at all,
    including the :Numb command.
  • The Ex line symbols $ (last line) and . (current line) are now previewed,
    including arithmetic on either of them: :$, :$-3, :., :.+5. Previously
    only digits and signs were recognised, so :$ produced no preview at all.

Changed

  • setup() now reports invalid configuration instead of accepting it silently.
    An unknown option name is ignored with a warning, and a value of the wrong
    type falls back to its default with a warning. Previously both were accepted
    without any message, so a typo such as show_nubmers looked like it had
    worked (#26). Invalid configuration never raises, so a typo cannot leave the
    plugin uninstalled.

Removed

  • require('numb').on_cmdline_changed() and require('numb').on_cmdline_exit()
    are no longer part of the module. They are the plugin's own autocommand
    callbacks, exported only so the autocommands could reach them, and the help
    file said there was no reason to call them. They are now local and wired
    straight into the autocommands. If you were calling them, open an issue and
    they can come back.

Fixed

  • Confirming a command that deletes lines near the end of the buffer, such as
    :38,40d in a 40 line buffer, no longer reports
    Invalid cursor line: out of range. The jump is applied after the command has
    run, so the target is now clamped to the buffer as it is at that point.
  • disable() during an active peek no longer leaves the peeking window behind.
    Previously the number, cursorline, foldenable and relativenumber
    values used while peeking stayed applied, the cursor stayed on the peeked
    line, and vim.w.numb_peeking stayed set, so a statusline using
    is_peeking() reported a peek forever.
  • Peeking in a background window no longer scrolls the window you are actually
    in. View restoration and centering now target the peeked window rather than
    the current one.
  • Closing a window while it is peeking no longer leaves its saved state behind
    for the rest of the session.