my dotfiles for arch
1return { -- Fuzzy Finder (files, lsp, etc)
2 "nvim-telescope/telescope.nvim",
3 event = "VimEnter",
4 dependencies = {
5 "nvim-lua/plenary.nvim",
6 { -- If encountering errors, see telescope-fzf-native README for installation instructions
7 "nvim-telescope/telescope-fzf-native.nvim",
8
9 -- `build` is used to run some command when the plugin is installed/updated.
10 -- This is only run then, not every time Neovim starts up.
11 build = "make",
12
13 -- `cond` is a condition used to determine whether this plugin should be
14 -- installed and loaded.
15 cond = function()
16 return vim.fn.executable("make") == 1
17 end,
18 },
19 { "nvim-telescope/telescope-ui-select.nvim" },
20
21 -- Useful for getting pretty icons, but requires a Nerd Font.
22 { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
23 },
24 config = function()
25 -- Telescope is a fuzzy finder that comes with a lot of different things that
26 -- it can fuzzy find! It's more than just a "file finder", it can search
27 -- many different aspects of Neovim, your workspace, LSP, and more!
28 --
29 -- The easiest way to use Telescope, is to start by doing something like:
30 -- :Telescope help_tags
31 --
32 -- After running this command, a window will open up and you're able to
33 -- type in the prompt window. You'll see a list of `help_tags` options and
34 -- a corresponding preview of the help.
35 --
36 -- Two important keymaps to use while in Telescope are:
37 -- - Insert mode: <c-/>
38 -- - Normal mode: ?
39 --
40 -- This opens a window that shows you all of the keymaps for the current
41 -- Telescope picker. This is really useful to discover what Telescope can
42 -- do as well as how to actually do it!
43
44 -- [[ Configure Telescope ]]
45 -- See `:help telescope` and `:help telescope.setup()`
46 require("telescope").setup({
47 -- You can put your default mappings / updates / etc. in here
48 -- All the info you're looking for is in `:help telescope.setup()`
49 --
50 -- defaults = {
51 -- mappings = {
52 -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
53 -- },
54 -- },
55 defaults = {
56 file_ignore_patterns = { "node_modules", ".git" },
57 },
58 pickers = {
59 find_files = {
60 hidden = true,
61 find_command = {
62 "fd",
63 "--type",
64 "f",
65 "--strip-cwd-prefix",
66 "--follow",
67 "--hidden",
68 "--exclude",
69 ".git",
70 },
71 },
72 },
73 extensions = {
74 ["ui-select"] = {
75 require("telescope.themes").get_dropdown(),
76 },
77 fzf = {
78 fuzzy = true,
79 override_generic_sorter = true,
80 override_file_sorter = true,
81 case_mode = "smart_case",
82 },
83 },
84 })
85
86 -- Enable Telescope extensions if they are installed
87 pcall(require("telescope").load_extension, "fzf")
88 pcall(require("telescope").load_extension, "ui-select")
89
90 -- See `:help telescope.builtin`
91 local builtin = require("telescope.builtin")
92 -- vim.keymap.set("n", "<leader>t", ":Telescope<CR>", {})
93 -- vim.keymap.set("n", "<leader>pf", function()
94 -- builtin.find_files({
95 -- file_ignore_patterns = { "node%_modules/.*", ".git/.*" },
96 -- })
97 -- end, { desc = "Find [F]iles" })
98 -- vim.keymap.set("n", "<leader>ph", builtin.help_tags, { desc = "Search [H]elp" })
99 -- vim.keymap.set("n", "<leader>pk", builtin.keymaps, { desc = "Search [K]eymaps" })
100 -- vim.keymap.set("n", "<leader>ps", builtin.builtin, { desc = "Search [S]elect Telescope" })
101 -- vim.keymap.set("n", "<leader>ps", function()
102 -- -- builtin.live_grep()
103 -- builtin.grep_string({ search = vim.fn.input("Grep > ") })
104 -- end, { desc = "[P]roject [S]earch" })
105 -- vim.keymap.set("n", "<leader>pw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
106 -- vim.keymap.set("n", "<leader>pg", builtin.live_grep, { desc = "Search by [G]rep" })
107 -- vim.keymap.set("n", "<leader>pd", builtin.diagnostics, { desc = "Search [D]iagnostics" })
108 -- vim.keymap.set("n", "<leader>pr", builtin.resume, { desc = "Search [R]esume" })
109 -- vim.keymap.set("n", "<leader>p.", builtin.oldfiles, { desc = 'Search Recent Files ("." for repeat)' })
110 -- vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
111
112 -- Slightly advanced example of overriding default behavior and theme
113 -- vim.keymap.set("n", "<leader>/", function()
114 -- -- You can pass additional configuration to Telescope to change the theme, layout, etc.
115 -- builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
116 -- winblend = 10,
117 -- previewer = false,
118 -- }))
119 -- end, { desc = "[/] Fuzzily search in current buffer" })
120 --
121 -- vim.keymap.set("n", "<leader>ch", builtin.command_history, { desc = "[C]ommand [H]istory" })
122 -- vim.keymap.set("n", "<leader>cc", builtin.commands, { desc = "[C]ommands" })
123 end,
124}