practicalli / astro

Rich development workflow with Clojure support, using AstroNvim 4 and selected plugins
https://practical.li/neovim
3 stars 7 forks source link

search: find text pattern in specific files and file types #10

Closed practicalli-johnny closed 1 month ago

practicalli-johnny commented 1 month ago

AstroNvim SPC f w searches through all files in a project.

On larger projects it can be effective to search through specific files to minimise the list of results, e.g. only *.clj Clojure files

Add the telescope extension:

https://github.com/nvim-telescope/telescope-live-grep-args.nvim

NOTE: check if extension has been added to Astrocommunity and if not then submit a plugin config once its working locally. 🆗

Add key mapping

keymap.set("n", "<leader>fg", ":lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>")

References

https://miguelcrespo.co/posts/using-telescope-to-find-text-inside-paths

practicalli-johnny commented 1 month ago

AstroCommunity plugin config:

https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/utility/telescope-live-grep-args-nvim