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

“git” mode

The Gif below (just over a minute long) shows fzfm’s “git” mode. However, it’s probably useful to have some notes as a refresher, so you don’t have to watch the gif if you don’t want to.

Basics

  • cd to a directory that contains a git repo, and type g + alt-m to get into git mode.
  • A “mode” indicator appears, showing mode: git, on the 5th line.
    • After that you get 4 numbers in colors; the count of deleted files is in. red, modified in yellow, new (untracked) in green, and ignored in blue.
      • Sadly, at the moment, this does not show staged file counts, only un-staged.
    • After this is the branch name.
  • The preview changes to a git log --stat for the file or directory the cursor is on. Toggle between that and the normal view using alt+m.
    • You can hit alt-p to toggle --patch in the preview window.
  • If the cursor is on a file that has un-staged changes, then the preview window shows a git diff before the git log --stat.
    • Scrolling the previews depends on how you’ve set your FZF_DEFAULT_OPTIONS

Changing the view

  • You can change the view by typing a command and then hitting alt+m.
    • alt-p still works to toggle --patch in any of these views.
  • i command shows you ignored files
  • Similarly m for modified, d for deleted, and n for new
  • all shows all files.
  • mrc shows all files in most recently committed order.
    • I find myself using this mode quite often; I may add a hot key for it.
    • See below for how
  • F5 resets the view to the default

Further customisation (not shown in the Gif)

  • To add a hotkey for a frequently used sub-command (e.g., in my case, mrc), add something like this to ~/.config/fzfm/cmd_hist

    : key=alt-R ; set fzfm_mode; fzfm_mode_handler g; fzfm_mode_handler mrc
    

    Then, pressing alt-shift-r will switch to git mode and get you the “most recently committed files” view.

    At present it’s not possible to add a hotkey only for a mode without touching the source code for the mode.