diff options
| author | August Masquelier <31262046+levouh@users.noreply.github.com> | 2021-04-04 05:04:06 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-04 13:04:06 +0200 |
| commit | d0cf646f65746415294f570ec643ffd0101ca3ab (patch) | |
| tree | 1e63bc1efc2ae71603ff85106203ca427bee1177 /lua/telescope/make_entry.lua | |
| parent | 0944c4a88f79ff45e5e750ebecdcb476ca221193 (diff) | |
feat: current buffer fuzzy find improvements (#694)
If you don't want to have a previewer disable it with `:Telescope current_buffer_fuzzy_find previewer=false`
To ignore empty lines do: `:Telescope current_buffer_fuzzy_find skip_empty_lines=true`
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index dd31193..e4b3d4e 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -680,6 +680,38 @@ function make_entry.gen_from_highlights() end end +function make_entry.gen_from_buffer_lines(opts) + local displayer = entry_display.create { + separator = ' │ ', + items = { + { width = 5 }, + { remaining = true }, + }, + } + + local make_display = function(entry) + return displayer { + { entry.lnum, opts.lnum_highlight_group or 'TelescopeResultsSpecialComment' }, + entry.line + } + end + + return function(entry) + if opts.skip_empty_lines and string.match(entry.line, '^$') then + return + end + + return { + valid = true, + ordinal = entry.line, + display = make_display, + filename = entry.filename, + lnum = entry.lnum, + line = entry.line, + } + end +end + function make_entry.gen_from_vimoptions() local process_one_opt = function(o) local ok, value_origin |
