Files
darcula_nvim/nvim/lua/darcula/setup/500_telescope.lua
2026-03-31 12:07:49 -05:00

102 lines
3.5 KiB
Lua

-- The MIT License (MIT)
--
-- Copyright © 2026 Scott E. Graves <scott.e.graves@protonmail.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-- and associated documentation files (the “Software”), to deal in the Software without restriction,
-- including without limitation the rights to use, copy, modify, merge, publish, distribute,
-- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all copies or
-- substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--
local symbols = require("darcula.utils.symbols")
local telescope_actions = require("telescope.actions")
require("telescope").setup {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--hidden",
"--smart-case"
},
mappings = {
i = {
["<C-b>"] = telescope_actions.preview_scrolling_up,
["<C-f>"] = telescope_actions.preview_scrolling_down,
["<C-d>"] = nil,
["<C-u>"] = nil
},
n = {
["<C-b>"] = telescope_actions.preview_scrolling_up,
["<C-f>"] = telescope_actions.preview_scrolling_down,
["<C-d>"] = nil,
["<C-u>"] = nil
}
},
prompt_prefix = " " .. symbols.search .. " ",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "normal",
selection_strategy = "reset",
sorting_strategy = "descending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {mirror = false},
vertical = {mirror = false},
height = 0.7,
width = 0.8,
preview_cutoff = 120
},
file_sorter = require "telescope.sorters".get_fuzzy_file,
file_ignore_patterns = {},
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter,
path_display = {smart = 1},
winblend = 0,
border = true,
borderchars = {" ", " ", " ", " ", " ", " ", " ", " "},
color_devicons = true,
use_less = true,
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
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,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case"
},
["ui-select"] = require("telescope.themes").get_dropdown(
{
width = 0.6,
previewer = false
}
)
}
}
require("telescope").load_extension("ui-select")
if NV_DARCULA_ENABLE_COC then
require("telescope").load_extension("coc")
end
if not NV_DARCULA_ENABLE_COC then
require("telescope").load_extension("flutter")
end