vifm search files in subfolders
Asked Answered
U

1

13

How can I search files just like with / command but recursively scanning subfolders?

Or maybe there are other approaches to get a list of files that match some pattern in the current folder including all subfolders.

Unmusical answered 20/8, 2015 at 14:27 Comment(0)
H
16

:find command

There is :fin[d] command for that. Internally it invokes find utility (this is configurable via 'findprg' option), so you can do everything find is capable of. That said, in most cases the simple form of the command suffices:

:find *.sh

Note that by default argument is treated as regular file pattern (-name option of find), which is different from regular expressions accepted by /. For searching via regexp, use:

:find -regex '.*_.*'

If you want to scan only specific subfolders, just select them before running the command and search will be limited only to those directories.

:find command brings up a menu with search results. If you want to process them like regular files (e.g. delete, copy, move), hit b to change list representation.

Alternative that uses /

Alternatively you can populate current view with list of files in all subdirectories with command like (see %u):

:!find%u

and then use /, although this might be less efficient.

Hirsutism answered 20/8, 2015 at 14:49 Comment(2)
Once I have selected a file from the search results, I enter the file's directory. That's nice, but how do I get back to the search results?Hedwig
@MatthiasBraun Use :copen command.Hirsutism

© 2022 - 2024 — McMap. All rights reserved.