From 12b57235a9f8dd15914d0b2133817259e80d63a1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 24 Jun 2023 13:14:20 +0200 Subject: [PATCH] feat(flash): telescope integration. Use `s` in normal and `` in insert mode --- lua/lazyvim/plugins/extras/editor/flash.lua | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) 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, + }, }