diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-12-29 21:05:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-29 21:05:59 +0100 |
| commit | 1d40ab5ccda6be3680fd809d34d93366b11c4ef8 (patch) | |
| tree | 5f3c3bec21da9ecb5d4b7361bee71279cd87b2f0 /lua/telescope/make_entry.lua | |
| parent | e555cd375f6c1e384a1c39a9c7c445a1c3aff8e0 (diff) | |
feat: All buffer previewers are now async and more config options (#354)
Configure preview window with:
autocmd User TelescopePreviewerLoaded setlocal wrap
autocmd User TelescopePreviewerLoaded setlocal number
file_maker example: Use regex highlighting for certain filetype like `*min.js` because they slow
down things with treesitter highlighter. Just a snippet for tests. We will do an extension :)
local previewers = require('telescope.previewers')
local putils = require('telescope.previewers.utils')
local pfiletype = require('plenary.filetype')
local _bad = { '.*%.min%.js' }
local bad_files = function(filepath)
for _, v in ipairs(_bad) do
if filepath:match(v) then
return true
end
end
return false
end
local new_maker = function(filepath, bufnr, bufname, use_ft_detect, callback)
if use_ft_detect == nil then use_ft_detect = true end
if bad_files(filepath) then
previewers.buffer_previewer_maker(filepath, bufnr, bufname, false, callback)
local ft = pfiletype.detect(filepath)
putils.regex_highlighter(bufnr, ft)
else
previewers.buffer_previewer_maker(filepath, bufnr, bufname, use_ft_detect, callback)
end
end
require('telescope').setup {
defaults = {
buffer_previewer_maker = new_maker,
}
}
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index dba6762..c1a4f66 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -270,7 +270,7 @@ function make_entry.gen_from_git_commits() local make_display = function(entry) return displayer { - {entry.value, "TelescopeResultsNumber"}, + {entry.value, "TelescopeResultsIdentifier"}, entry.msg } end |
