diff options
| author | Himanshu <himansingh24@gmail.com> | 2020-09-02 08:04:21 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-01 22:34:21 -0400 |
| commit | 9f906f03922907b95b71a8f57254e64ba9c76ce8 (patch) | |
| tree | 928fe0dcb8e7111bc785e8a5aea10177d6e8edbc /lua | |
| parent | 39096492aba5e2fe8a8c0bc11a040a90bb95280b (diff) | |
Added functionality to view and navigate loclist (#17)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index 2c59b14..42156f6 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -133,6 +133,28 @@ builtin.quickfix = function(opts) }):find() end +builtin.loclist = function(opts) + local locations = vim.fn.getloclist(0) + local filename = vim.api.nvim_buf_get_name(0) + + for _, value in pairs(locations) do + value.filename = filename + end + + local results = utils.quickfix_items_to_entries(locations) + + if vim.tbl_isempty(results) then + return + end + + pickers.new(opts, { + prompt = 'Loclist', + finder = finders.new_table(results), + previewer = previewers.qflist, + sorter = sorters.get_norcalli_sorter(), + }):find() +end + builtin.grep_string = function(opts) opts = opts or {} |
