A simple Telescope extension to search through the lines in the current buffer.
Using packer.nvim:
use({
"neanias/telescope-lines.nvim",
requires = "nvim-telescope/telescope.nvim",
})
To enable the extension, add this to your config:
require("telescope").load_extension("lines")
To configure the plugin, you can add to the telescope setup:
local telescope = require("telescope")
telescope.setup({
-- ...
extensions = {
-- These are the default values.
lines = {
hide_empty_lines = true,
trim_lines = true,
},
},
})
-- `load_extension` must be called after `telescope.setup`
telescope.load_extension("lines")
The two configuration fields are hide_empty_lines
and trim_lines
as noted above.
hide_empty_lines
will hide any lines that are just whitespace from being in the picker, whilst
trim_lines
will trim leading & trailing whitespace from the lines before sending them to the
picker.
This can be run as a Telescope command
:Telescope lines
or called directly in lua
:lua require("telescope").extensions.lines.lines()