show hidden files, ignore special entries

This commit is contained in:
Baipyrus 2024-02-28 10:12:28 +01:00
parent 778776a45c
commit 32a74e1d54

View File

@ -19,6 +19,7 @@ pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
local builtin = require 'telescope.builtin' local builtin = require 'telescope.builtin'
local actions = require 'telescope.actions'
-- Telescope live_grep in git root -- Telescope live_grep in git root
-- Function to find the git root directory based on the current buffer's path -- Function to find the git root directory based on the current buffer's path
@ -76,7 +77,31 @@ end
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' }) vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', '<leader>sf', function()
builtin.find_files {
-- This will ignore the directories you specified
find_command = {
'rg',
'--files',
'--hidden',
'-u',
'-g',
'!{' .. table.concat({
'.git',
'target',
'node_modules',
'.svelte-kit',
'bin',
'obj',
}, ',') .. '}',
},
attach_mappings = function(_, map)
map('i', '<CR>', actions.select_default + actions.center)
return true
end,
desc = '[S]earch [F]iles',
}
end)
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })