neovimlazyvim

Change window focus of search results in LazyVim


In LazyVim, when I press <leader>/ it opens a window that allows me to search files using grep. There're 2 windows: the input field and the results.

How can I switch focus from the left to the right window (i.e. the input field to the results) so that I can select and copy text, scroll etc.?

LazyVim search picker window


Solution

  • The window you are referring to is called a "picker" in LazyVim. You can cycle between the windows in the picker by using a-w.

    Other default shortcuts are listed in the configuration section of the picker help/description file. Another shortcut of interest might be to change change the layout of the window via <c-w> then J K H or L.

    Additional information that may also be of use to you:

    From section 4.1 of the manual pertaining to opening files and the picker:

    You can use the up and down arrow keys to select a different file in the search results...

    If you need to scroll the results window to see something lower down in the list, use the Control-d and Control-u keys. If you want to scroll the preview window, use Control-f, and Control-b instead.

    From a tip in section 12.4 of the manual pertaining to search:

    ...you can press Alt-t while it (the picker) is open to put all the search results into the Trouble window so you can navigate them while editing (using ]q and [q).