diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-11-22 03:33:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-21 21:33:27 -0500 |
| commit | d153c006e76db4d56eeb03605698a23344cfadbd (patch) | |
| tree | 5733881aad9b86dcb2b961b8ff7d8ac5c36f4413 /lua/telescope/builtin/init.lua | |
| parent | 5bf53823eb7bff7031368dbfa659f0b9775b89e7 (diff) | |
feat: Add highlights builtin (#267)
Diffstat (limited to 'lua/telescope/builtin/init.lua')
| -rw-r--r-- | lua/telescope/builtin/init.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index 8bb082f..faef9d6 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -910,6 +910,30 @@ builtin.filetypes = function(opts) }):find() end +builtin.highlights = function(opts) + opts = opts or {} + + local highlights = vim.fn.getcompletion('', 'highlight') + + pickers.new({}, { + prompt_title = 'Highlights', + finder = finders.new_table { + results = highlights, + entry_maker = make_entry.gen_from_highlights(opts) + }, + sorter = conf.generic_sorter(), + attach_mappings = function(prompt_bufnr) + actions.goto_file_selection_edit:replace(function() + local selection = actions.get_selected_entry() + actions.close(prompt_bufnr) + vim.cmd('hi ' .. selection.value) + end) + return true + end, + previewer = previewers.display_content.new(opts), + }):find() +end + builtin.tags = function(opts) opts = opts or {} |
