diff --git a/lua/lazyvim/plugins/extras/editor/flash.lua b/lua/lazyvim/plugins/extras/editor/flash.lua index 68c1700e..b41ab2dd 100644 --- a/lua/lazyvim/plugins/extras/editor/flash.lua +++ b/lua/lazyvim/plugins/extras/editor/flash.lua @@ -33,4 +33,34 @@ return { }, }, }, + { + "nvim-telescope/telescope.nvim", + optional = true, + opts = function(_, opts) + local function flash(prompt_bufnr) + require("flash").jump({ + pattern = "^", + highlight = { label = { after = { 0, 0 } } }, + search = { + mode = "search", + exclude = { + function(win) + return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults" + end, + }, + }, + action = function(match) + local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr) + picker:set_selection(match.pos[1] - 1) + end, + }) + end + opts.defaults = vim.tbl_deep_extend("force", opts.defaults, { + mappings = { + n = { s = flash }, + i = { [""] = flash }, + }, + }) + end, + }, }