file-searchvifm

vifm search files in subfolders


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.


Solution

  • :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.