diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-12-17 16:58:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-17 16:58:48 +0100 |
| commit | e5155a4aa3a0aa7875e8f0627e1c2ad00e52a4fe (patch) | |
| tree | 267761573d789ee93ec08172a92a1da48bccf7d9 | |
| parent | f078d149a1cfb9e98d9be400b6660dbaa6a58ce9 (diff) | |
Fix builtin.builtin again and add TelescopePreviewMatch hlgroup (#342)
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 10 | ||||
| -rw-r--r-- | lua/telescope/previewers.lua | 9 | ||||
| -rw-r--r-- | plugin/telescope.vim | 3 |
3 files changed, 16 insertions, 6 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index ca3b86f..7132bad 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -34,7 +34,15 @@ internal.builtin = function(opts) prompt_title = 'Telescope Builtin', finder = finders.new_table { results = objs, - entry_maker = make_entry.gen_from_quickfix(opts), + entry_maker = function(entry) + return { + value = entry, + text = entry.text, + display = entry.text, + ordinal = entry.text, + filename = entry.filename, + } + end }, previewer = previewers.builtin.new(opts), sorter = conf.generic_sorter(opts), diff --git a/lua/telescope/previewers.lua b/lua/telescope/previewers.lua index eb55c43..b83192a 100644 --- a/lua/telescope/previewers.lua +++ b/lua/telescope/previewers.lua @@ -608,7 +608,7 @@ previewers.ctags = defaulter(function(_) vim.cmd "norm! gg" vim.fn.search(scode) - self.state.hl_id = vim.fn.matchadd('TelescopePreviewLine', scode) + self.state.hl_id = vim.fn.matchadd('TelescopePreviewMatch', scode) end) end } @@ -647,7 +647,7 @@ previewers.builtin = defaulter(function(_) vim.cmd "norm! gg" vim.fn.search(text) - self.state.hl_id = vim.fn.matchadd('TelescopePreviewLine', text) + self.state.hl_id = vim.fn.matchadd('TelescopePreviewMatch', text) end) end } @@ -711,7 +711,7 @@ previewers.help = defaulter(function(_) vim.cmd "norm! gg" vim.fn.search(query, "W") - self.state.hl_id = vim.fn.matchadd('TelescopePreviewLine', query) + self.state.hl_id = vim.fn.matchadd('TelescopePreviewMatch', query) end) end } @@ -843,9 +843,10 @@ previewers.highlights = defaulter(function(_) vim.cmd "norm! gg" vim.fn.search(entry.value .. ' ') local lnum = vim.fn.line('.') + -- That one is actually a match but its better to use it like that then matchadd vim.api.nvim_buf_add_highlight(self.state.bufnr, previewer_ns, - "TelescopePreviewLine", + "TelescopePreviewMatch", lnum - 1, 0, #entry.value) diff --git a/plugin/telescope.vim b/plugin/telescope.vim index b9d99ee..f01474c 100644 --- a/plugin/telescope.vim +++ b/plugin/telescope.vim @@ -21,7 +21,8 @@ highlight default link TelescopeMatching Special highlight default link TelescopePromptPrefix Identifier " Used for highlighting the matched line inside Previewer. Works only for (vim_buffer_ previewer) -highlight default link TelescopePreviewLine Search +highlight default link TelescopePreviewLine Visual +highlight default link TelescopePreviewMatch Search " This is like "<C-R>" in your terminal. " To use it, do `cmap <C-R> <Plug>(TelescopeFuzzyCommandSearch) |
