summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/internal.lua
diff options
context:
space:
mode:
authorfdschmidt93 <39233597+fdschmidt93@users.noreply.github.com>2021-08-23 15:27:11 +0200
committerGitHub <noreply@github.com>2021-08-23 15:27:11 +0200
commit79dc995f820150d5de880c08e814af327ff7e965 (patch)
treee1eeea904e97b48200a2fadcf294f1a1d2189376 /lua/telescope/builtin/internal.lua
parent03c2b8f6bb8027ecdf10acc6d803886c80f99037 (diff)
fix: (terminal) buffer previewer (#1120)
Use existing buffers for buffer previewer to allow previewing special buffer types
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
-rw-r--r--lua/telescope/builtin/internal.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua
index 226373b..4b2747b 100644
--- a/lua/telescope/builtin/internal.lua
+++ b/lua/telescope/builtin/internal.lua
@@ -655,9 +655,17 @@ internal.buffers = function(opts)
results = buffers,
entry_maker = opts.entry_maker or make_entry.gen_from_buffer(opts),
},
- previewer = conf.grep_previewer(opts),
+ previewer = previewers.buffers.new(opts),
sorter = conf.generic_sorter(opts),
default_selection_index = default_selection_idx,
+ attach_mappings = function(_, _)
+ action_set.select:enhance {
+ post = function()
+ local entry = action_state.get_selected_entry()
+ vim.api.nvim_win_set_cursor(0, { entry.lnum, entry.col or 0 })
+ end,
+ }
+ end,
}):find()
end