dotfiles/nvim/after/plugin/telescope.lua

57 lines
1.2 KiB
Lua
Raw Normal View History

2023-01-01 14:16:21 +00:00
local _, telescope = pcall(require, "telescope")
local ok, builtin = pcall(require, "telescope.builtin")
if not ok then
return
end
2023-06-14 09:30:11 +00:00
telescope.setup {
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
local function project()
local exclusions = {
"**/.git/",
"*.svg",
"*.png",
"*.jpg",
}
2023-01-01 14:16:21 +00:00
2023-06-14 09:30:11 +00:00
local find_command = nil
2023-06-16 11:26:45 +00:00
if FD_EXISTS == 1 then
2023-06-14 09:30:11 +00:00
find_command = { "fd", "--hidden", "-t", "f" }
for _, value in ipairs(exclusions) do
table.insert(find_command, "--exclude")
table.insert(find_command, value)
end
2023-06-16 11:26:45 +00:00
elseif RIPGREP_EXISTS == 1 then
2023-06-14 09:30:11 +00:00
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" }
2023-01-01 14:16:21 +00:00
end
2023-06-14 09:30:11 +00:00
builtin.find_files {
find_command = find_command,
}
2023-01-01 14:16:21 +00:00
end
local function dotfiles()
builtin.git_files {
shorten_path = true,
prompt_title = " ~ dotfiles ~ ",
cwd = vim.env.DOTFILES_DIRECTORY,
}
end
telescope.load_extension("fzf")
require("my.keymaps").telescope_keymaps {
project = project,
dotfiles = dotfiles,
builtin = builtin,
}