1
0
Fork 0
dotfiles/.config/nvim/lua/plugins/misc/telescope.lua

48 lines
1.4 KiB
Lua

local M = { "nvim-telescope/telescope.nvim" }
local icons = require("config.icons")
M.dependencies = { "telescope-fzf-native.nvim" }
M.cmd = "Telescope"
local opts = function()
local actions = require("telescope.actions")
return {
defaults = {
git_worktrees = vim.g.git_worktrees,
prompt_prefix = icons.Selected,
path_display = { "truncate" },
sorting_startegy = "ascending",
layout_config = {
horizontal = { prompt_position = "top", preview_width = 0.5 },
vertical = { mirror = false },
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
n = { q = actions.close },
},
},
}
end
M.config = function()
local telescope = require("telescope")
telescope.setup(opts())
if pcall(require, "aerial") then
telescope.load_extension("aerial")
end
if require("funcs").is_available("telescope-fzf-native.nvim") then
telescope.load_extension("fzf")
end
end
return M