31 lines
982 B
Lua
31 lines
982 B
Lua
|
local status, telescope = pcall(require, "telescope")
|
||
|
if not status then return end
|
||
|
|
||
|
local telescopeConfig = require("telescope.config")
|
||
|
|
||
|
-- Clone the default Telescope configuration
|
||
|
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||
|
|
||
|
-- I want to search in hidden/dot files.
|
||
|
table.insert(vimgrep_arguments, "--hidden")
|
||
|
-- I don't want to search in the `.git` directory.
|
||
|
table.insert(vimgrep_arguments, "--glob")
|
||
|
table.insert(vimgrep_arguments, "!**/.git/*")
|
||
|
|
||
|
-- Keyboard shortcuts
|
||
|
vim.keymap.set("n", "<C-f>", ":Telescope find_files<CR>", {})
|
||
|
vim.keymap.set("i", "<C-f>", "<ESC>:Telescope find_files<CR>", {})
|
||
|
|
||
|
telescope.setup({
|
||
|
defaults = {
|
||
|
-- `hidden = true` is not supported in text grep commands.
|
||
|
vimgrep_arguments = vimgrep_arguments,
|
||
|
},
|
||
|
pickers = {
|
||
|
find_files = {
|
||
|
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
|
||
|
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||
|
},
|
||
|
},
|
||
|
})
|