dotfiles/nvim/after/plugin/telescope.lua
Nikos Papadakis e51e61ed5f
nix
2023-09-24 20:51:10 +03:00

56 lines
1.2 KiB
Lua

local _, telescope = pcall(require, "telescope")
local ok, builtin = pcall(require, "telescope.builtin")
if not ok then
return
end
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",
}
local find_command = nil
if FD_EXISTS == 1 then
find_command = { "fd", "--hidden", "-t", "f" }
for _, value in ipairs(exclusions) do
table.insert(find_command, "--exclude")
table.insert(find_command, value)
end
elseif RIPGREP_EXISTS == 1 then
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" }
end
builtin.find_files {
find_command = find_command,
}
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,
}