Search Integration

To display search results on the scrollbar, this plugin integrates with nvim-hlslens.

Setup

There are two main ways to set this up, depending on how you manage your configuration.

Method 1: Using the Scrollbar Setup Wrapper

If you use packer.nvim, you can configure the scrollbar's search handler to override hlslens config automatically.

use {
  "kevinhwang91/nvim-hlslens",
  config = function()
    -- require('hlslens').setup() is not required
    require("scrollbar.handlers.search").setup({
        -- hlslens config overrides here
    })
  end,
}

Method 2: Manual Setup

If you prefer to setup hlslens manually, you must attach the scrollbar handler to the build_position_cb of hlslens.

use {
  "kevinhwang91/nvim-hlslens",
  config = function()
    require("hlslens").setup({
       build_position_cb = function(plist, _, _, _)
            require("scrollbar.handlers.search").handler.show(plist.start_pos)
       end,
    })

    -- Optional: Hide marks when search is cleared
    vim.cmd([[
        augroup scrollbar_search_hide
            autocmd!
            autocmd CmdlineLeave : lua require('scrollbar.handlers.search').handler.hide()
        augroup END
    ]])
  end,
}

Disabling Virtual Text

If you want to leave only the scrollbar marks and disable the virtual text in the buffer area:

require("scrollbar.handlers.search").setup({
    override_lens = function() end,
})