diff options
| author | caojoshua <33404808+caojoshua@users.noreply.github.com> | 2021-05-09 02:05:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-09 11:05:12 +0200 |
| commit | e2907fc0f225a7bf33ace6915bc6b55ed1e10b31 (patch) | |
| tree | 58a373535adf3d13947965e6a0b2f16f06737d52 /lua/telescope/builtin/internal.lua | |
| parent | 25a7ecc289dffaa3d45870b452fa1bfb83253ba9 (diff) | |
feat: jumplist picker and jump to row/col on existing buffers. (#813)
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index 9e1f26c..c412f69 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -917,16 +917,37 @@ internal.tagstack = function(opts) end pickers.new(opts, { - prompt_title = 'TagStack', - finder = finders.new_table { - results = tags, - entry_maker = make_entry.gen_from_quickfix(opts), - }, - previewer = previewers.vim_buffer_qflist.new(opts), - sorter = conf.generic_sorter(opts), - }):find() + prompt_title = 'TagStack', + finder = finders.new_table { + results = tags, + entry_maker = make_entry.gen_from_quickfix(opts), + }, + previewer = conf.qflist_previewer(opts), + sorter = conf.generic_sorter(opts), + }):find() end +internal.jumplist = function(opts) + opts = opts or {} + local jumplist = vim.fn.getjumplist()[1] + + -- reverse the list + local sorted_jumplist = {} + for i = #jumplist, 1, -1 do + jumplist[i].text = '' + table.insert(sorted_jumplist, jumplist[i]) + end + + pickers.new(opts, { + prompt_title = 'Jumplist', + finder = finders.new_table { + results = sorted_jumplist, + entry_maker = make_entry.gen_from_jumplist(opts), + }, + previewer = conf.qflist_previewer(opts), + sorter = conf.generic_sorter(opts), + }):find() +end local function apply_checks(mod) for k, v in pairs(mod) do |
