feat(flash): telescope integration. Use s in normal and <c-s> in insert mode

This commit is contained in:
Folke Lemaitre
2023-06-24 13:14:20 +02:00
parent 1acad8be93
commit 12b57235a9

View File

@ -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 = { ["<c-s>"] = flash },
},
})
end,
},
}