-- This functions is to fix a bug in telescope -- that the fold not word if open file in telescope -- https://github.com/nvim-telescope/telescope.nvim/issues/559#issuecomment-1221001701 local function stopinsert(callback) return function(prompt_bufnr) vim.cmd.stopinsert() vim.schedule(function() callback(prompt_bufnr) end) end end return { { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" }, cmd = "Telescope", branch = "0.1.x", config = function() local actions = require("telescope.actions") require("telescope").setup({ defaults = { mappings = { i = { [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = actions.preview_scrolling_down, [""] = actions.preview_scrolling_up, [""] = actions.close, -- As we don't use normal node in telescope [""] = stopinsert(actions.select_default), [""] = stopinsert(actions.select_vertical), [""] = stopinsert(actions.select_horizontal), [""] = stopinsert(actions.select_tab), }, n = { [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = actions.preview_scrolling_down, [""] = actions.preview_scrolling_up, ["q"] = actions.close, }, }, }, pickers = { colorscheme = { enable_preview = true, theme = "dropdown", }, }, }) end, keys = { { "ff", "Telescope find_files", desc = "Find File", }, { "fg", "Telescope live_grep", desc = "Find Grep", }, { "fb", "Telescope buffers", desc = "Find Buffer", }, { "fh", "Telescope help_tags", desc = "Find Help", }, { "ft", "Telescope colorscheme", desc = "Find Theme", }, }, }, }