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

Fzfm’s “modes”

Fzfm has “modes”; I’ll explain what and how using the “dirdiff” mode as an example.

The “dirdiff” mode is essentially a TUI wrapper around the output of diff -qr dir1 dir2

General intro to modes

Fzfm modes are useful to provide specific functionality that you may not need all the time.

  • You enter a mode by typing in the mode name or short name (e.g., dirdiff, or dd for short), and hitting alt-m. This performs some sort of initialisation, and then the display changes.
    • You can also directly enter a mode while starting fzfm. E.g., the Gif below uses fzfm -m dd dir1 dir2.
  • When you enter a mode, a mode indicator appears on the fifth line. In addition, some other information might appear. For example, in the dirdiff mode you will see three numbers prefixed by d, l, and r.
    • They are, respectively, the number of files which are different, unique to the left side, and unique to the right side.
  • Most modes have their own commands and hotkeys which only work within that mode. A command must be followed by alt-m. Hotkeys stand on their own.
    • Hotkeys example: in “dirdiff” mode, alt-m runs vimdiff of the left file and the right file. In “git” mode, alt-p toggles between showing and not showing --patch in the git log output.
    • Commands example: in “dirdiff” mode, typing d, then alt-m will show you only the files that are different on both sides. In “git” mode, mrc + alt-m shows all files in most recently committed order.
  • Most modes also respond to help or h (+ alt-m) to show you a brief help.
  • Some modes may also respond to F5 to refresh the mode. This reruns the initialisation (in “dirdiff”, this would rerun the diff -qr command), and also resets the display to the default.
  • Finally, you exit a mode by hitting Escape (not shown in Gif below).

Here’s a brief Gif that shows off all this.