natecraddock / nvim-find

A fast and simple finder plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Search Finder

natecraddock opened this issue · comments

Alongside files and buffers, one more finder would be nice to have before the first official release: a string search (ripgrep). There are two main uses for string finders:

  1. Search and replace throughout a project
  2. Finding a string in a file and then opening at that point

Though this could be easily done with two keybind and two finders, I wanted to simplify and make it as straightforward as possible. The current plan:

  • When the finder first opens no line is highlighted.
  • Entering a search query populates results from ripgrep as a preview.
  • If enter is pressed then the quickfix/locallist is filled with results and opened. This makes it easy to do a find and replace or do other things with the search results. This is the first main use of a search finder.
  • If a selection is made (ctrl-j for example) then a preview window opens and the finder becomes useful for the second main use of finders.
  • In this mode, selection with enter will open the selected result in the last window (or split/tab based on keyboard shortcut). The quickfix/location list is still populated, but not shown by default.

This hopefully creates a frictionless workflow for both find and replace, and just general project-wide search.


Note that this does add a preview window. In my original thoughts for nvim-find I was focused on file finding and I still believe a file finder does not need a buffer preview. But search and replace is one case where I do think a preview is beneficial.