Changing the filelist
The default list of files and directories shown comes from running ls -AN --color=always in the current directory. But pretty much any command that
produces a list of files/dirs can be used.
Unlike the examples so far (i.e., commands that run on selected files), this
cannot be done using the :!some-command method.
To change the view, you must first hit ctrl-v, which will show you the
view history file ~/.config/fzfm/view_hist. At this point, you can:
- pick one of the commands and hit enter
- type an entirely new command and hit alt-n
- ctrl-g (see previous section) also works
Some examples I use frequently are:
fd -tf --newer 1hourto show files modified in the last 1 hourgit ls-files -mto show changed and deleted files in the repo
Everything else is similar to the previous section (“Running commands”). This
includes hotkeys, and the behaviour of %c, %f, %d1, and %d2, with one
exception: regardless of what macros you use, the command only runs once. For
example, this view command produces all the files under CWD which have the
same extension as the current selected file:
fd -e (path extension %c)
# runs "fd -e txt" if you're on a text file
But if you selected more than one file, this will still run just once, with the first file you selected, and ignore the others.
In contrast, here’s one where you select several files, and it finds files matching any of their extensions:
eval fd (path extension %f | sort -u | sed -e 's/^/-e /')
# runs "fd -e txt -e md -e pdf" if you selected one or more txt, md, and pdf files.