Hyprland-dotfiles/nvim/lua/modules/configs/tool/telescope.lua
2024-07-21 02:51:17 -04:00

103 lines
3.1 KiB
Lua

return function()
local icons = { ui = require("modules.utils.icons").get("ui", true) }
local lga_actions = require("telescope-live-grep-args.actions")
require("modules.utils").load_plugin("telescope", {
defaults = {
vimgrep_arguments = {
"rg",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
initial_mode = "insert",
prompt_prefix = " " .. icons.ui.Telescope .. " ",
selection_caret = icons.ui.ChevronRight,
scroll_strategy = "limit",
results_title = false,
layout_strategy = "horizontal",
path_display = { "absolute" },
selection_strategy = "reset",
sorting_strategy = "ascending",
color_devicons = true,
file_ignore_patterns = { ".git/", ".cache", "build/", "%.class", "%.pdf", "%.mkv", "%.mp4", "%.zip" },
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.85,
height = 0.92,
preview_cutoff = 120,
},
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
aerial = {
show_lines = false,
show_nesting = {
["_"] = false, -- This key will be the default
lua = true, -- You can set the option for specific filetypes
},
},
fzf = {
fuzzy = false,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
frecency = {
show_scores = true,
show_unindexed = true,
ignore_patterns = { "*.git/*", "*/tmp/*" },
},
live_grep_args = {
auto_quoting = true, -- enable/disable auto-quoting
mappings = { -- extend mappings
i = {
["<C-k>"] = lga_actions.quote_prompt(),
["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
},
},
},
undo = {
side_by_side = true,
mappings = {
i = {
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
["<C-cr>"] = require("telescope-undo.actions").restore,
},
},
},
advanced_git_search = {
diff_plugin = "diffview",
git_flags = { "-c", "delta.side-by-side=true" },
entry_default_author_or_date = "author", -- one of "author" or "date"
},
},
})
require("telescope").load_extension("frecency")
require("telescope").load_extension("fzf")
require("telescope").load_extension("live_grep_args")
require("telescope").load_extension("notify")
require("telescope").load_extension("projects")
require("telescope").load_extension("undo")
require("telescope").load_extension("zoxide")
require("telescope").load_extension("persisted")
require("telescope").load_extension("aerial")
require("telescope").load_extension("advanced_git_search")
end