Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locate hidden paths via Telescope #3

Open
makuche opened this issue Jan 16, 2025 · 0 comments
Open

Locate hidden paths via Telescope #3

makuche opened this issue Jan 16, 2025 · 0 comments

Comments

@makuche
Copy link
Owner

makuche commented Jan 16, 2025

Adding the following lua script as .nvim.lua to a projects root folder

-- Save this as .nvim.lua
local ok, telescope = pcall(require, "telescope.builtin")
if not ok then
	return
end

vim.api.nvim_create_user_command("TelescopeHidden", function()
	telescope.find_files({
		hidden = true,
		search_dirs = { "." },
		file_ignore_patterns = { "^.git/" },
	})
end, {})

vim.api.nvim_create_user_command("TelescopeHiddenGrep", function()
	telescope.live_grep({
		hidden = true,
		additional_args = function()
			return { "--hidden" }
		end,
		file_ignore_patterns = { "^.git/" },
	})
end, {})

vim.api.nvim_set_keymap("n", "<leader>sf", ":TelescopeHidden<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>sg", ":TelescopeHiddenGrep<CR>", { noremap = true, silent = true })

makes it possible to overwrite the standard settings and search files/folders in hidden locations. Add this script as template in a location.

In addition, the following option needs to be set to enable the usage of local config files for nvim:

vim.opt.exrc = true

This option should then be placed in nvim/lua/options.lua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant