Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Features

There’re a couple of quick demos here.

Single-pane

Let’s get this out of the way: since fzf provides the UI, this cannot be a dual-pane file manager. It still does everything I used to do in vifm by using the notion of an “alternate directory” (ALT_DIR), and mapping F5 to copy and F6 to move selected files from the current directory to ALT_DIR, but, as they say, YMMV.

Features at a glance

Here are some top level features:

  • Standard fzf features: fuzzy matching, especially negative matching, TAB to select multiple items, etc.

  • Select files and run any command you like on them.

    • Either one at a time (using %c), or all at once (%f)
    • Comes with a dozen or so sample commands
    • See Running commands section for more
  • Use the output of any command to change the “view” (i.e., the file list in the main window).

    • Again, comes with a dozen or so example commands that change the view
    • E.g., fd -tf --newer 1hour changes the view to show files modified in the last hour
    • See Changing the view section for more
  • Add a hotkey to any command you use often

  • Learns my most frequently used commands and views as I use it

    • (note: no AI bullshit here; just standard Unix commands)
    • Fuzzy select these commands from their respective history files.

The “view” command

The “view” feature is similar to vifm’s %U modifier, or midnight commander’s “External panelise”, but it goes beyond those. First, it is this feature that provides even the default/initial file list you see when you run fzfm. Also, the command is re-applied every time the UI refreshes. (In contrast, mc and vifm recognise when files are deleted and remove them from the view, but they don’t notice newly added files unless you explicitly run the command again.)

What this means is that, if you, say, run :s<ENTER> to show the list sorted by du -sk size, then that is the mode it is in until you hit Escape. Edit a file and make it (much) larger and it will move up. Navigate to another directory, and it will recalculate for that. Same for :m (sort by descending mtime) or :c (ctime).

The “preview” command

We’re used to file managers’ preview being a view of the file. But you can have anything in the preview – a git log of the file is very useful when exploring a new project, for instance (and is just as useful when your cursor is on a directory). In “git” mode, files with changes can show a git diff --color in the preview. Or, in the “vimgrep” mode, the preview shows matched lines with context.

“Modes”

Increasingly, I find that fzfm’s ability to create custom modes for specific purposes is becoming very useful. For example, if you are in a git directory, type g and hit alt-m to get into fzfm’s git mode.

Almost all modes have builtin help, accessed by typing h then hitting alt-m while within that mode. I strongly suggest using this at least the first time you try a mode.

Documentation for modes is included in the demos page. Since “mode” and “demo” are anagrams, why not? :-)

In decreasing order of how often I use them, the current modes are:

  • t (or todotxt) – has jumped to top spot within a few hours of being coded!

    • I use it so much I got tired of typing “t” then “alt-m”; I added this to my cmd_hist file

      : key=alt-t todotxt mode          ; fzfm_mode_handler t
      
  • dd (or dirdiff) – differences between 2 directories

  • g (or git) – obvious

    • why is this lower? Because lazygit exists ;-)
  • ps – runs the ps command. Pretty powerful; check out the help at least!

  • vg (vimgrep)