diff --git a/lua/telescope/actions/set.lua b/lua/telescope/actions/set.lua index 06e2301..4faf947 100644 --- a/lua/telescope/actions/set.lua +++ b/lua/telescope/actions/set.lua @@ -133,14 +133,21 @@ action_set.edit = function(prompt_bufnr, command) local picker = action_state.get_current_picker(prompt_bufnr) require("telescope.actions").close(prompt_bufnr) local win_id = picker.get_selection_window(picker, entry) - if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then - vim.api.nvim_set_current_win(win_id) - end if picker.push_cursor_on_edit then vim.cmd "normal! m'" end + if picker.push_tagstack_on_edit then + local from = { vim.fn.bufnr "%", vim.fn.line ".", vim.fn.col ".", 0 } + local items = { { tagname = vim.fn.expand "", from = from } } + vim.fn.settagstack(vim.fn.win_getid(), { items = items }, "t") + end + + if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then + vim.api.nvim_set_current_win(win_id) + end + if entry_bufnr then if not vim.api.nvim_buf_get_option(entry_bufnr, "buflisted") then vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true) diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index e0dc9b9..75626c9 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -1042,6 +1042,7 @@ internal.marks = function(opts) previewer = conf.grep_previewer(opts), sorter = conf.generic_sorter(opts), push_cursor_on_edit = true, + push_tagstack_on_edit = true, }):find() end diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index af3b5d4..2ec9f2d 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -47,6 +47,7 @@ lsp.references = function(opts) previewer = conf.qflist_previewer(opts), sorter = conf.generic_sorter(opts), push_cursor_on_edit = true, + push_tagstack_on_edit = true, }):find() end) end @@ -93,6 +94,8 @@ local function list_or_jump(action, title, opts) }, previewer = conf.qflist_previewer(opts), sorter = conf.generic_sorter(opts), + push_cursor_on_edit = true, + push_tagstack_on_edit = true, }):find() end end) @@ -154,6 +157,7 @@ lsp.document_symbols = function(opts) sorter = conf.generic_sorter(opts), }, push_cursor_on_edit = true, + push_tagstack_on_edit = true, }):find() end) end diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 98d4a18..e7c4c7c 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -117,6 +117,7 @@ function Picker:new(opts) selection_strategy = get_default(opts.selection_strategy, config.values.selection_strategy), push_cursor_on_edit = get_default(opts.push_cursor_on_edit, false), + push_tagstack_on_edit = get_default(opts.push_tagstack_on_edit, false), layout_strategy = layout_strategy, layout_config = config.smarter_depth_2_extend(opts.layout_config or {}, config.values.layout_config or {}),