Sunrise Commander, an orthodox file manager for Emacs

My emacs instance running Sunrise Commander along with the exwm window manager (https://github.com/ch11ng/exwm)

The term “orthodox file manager” refers to a type of file manager most iconically adorned with the display of dual file panels. Manipulating the directory locations of these two panes serves as the building block for browsing, copying, and moving files on your file system.

This form factor represents an evolutionary branching path to the contemporary mainstream GUI file managers that ship with Windows, macOS, and Ubuntu alike.

Against their mainstream cousins, orthodox file managers uniquely offer a tight keyboard-driven workflow. Against the pure command-line, orthodox file managers offer simple keyboard shortcuts and a minimalist visualization of file management.

While Midnight Commander (mc ) in modern times has perhaps dominated the orthodox file manager scene, for Emacs users there is an elegant alternative: Sunrise Commander. Intriguingly, whereas Midnight Commander was an orthodox file manager with a built-in text editor, Sunrise Commander is an orthodox file manager built within a text editor.

The goal of this post is to speedily get an Emacs user up, running, and familiar with Sunrise Commander, so that they may enjoy an orthodox file manager.

A picture of Midnight Commander. Source: https://commons.wikimedia.org/wiki/File:Midnight_Commander_4.7.0.9_on_Ubuntu_11.04.png

Installation

Sunrise Commander is presently not available on MELPA. However, all the files that you’d probably ever want to include are found in this GitHub repository:

https://github.com/escherdragon/sunrise-commander

I have a directory in my .emacs.d/ called local where I store elisp from authors that are not me and not packaged by MELPA. I cloned the above repository into that folder, so I end up including elisp like this in my Emacs boot:

(add-to-list 'load-path "~/.emacs.d/local/sunrise-commander")
(require 'sunrise-commander)
(require 'sunrise-x-buttons)
(require 'sunrise-x-modeline)
(add-to-list 'auto-mode-alist '("\\.srvm\\'" . sr-virtual-mode))

I only end up including the standard package, the list of buttons (that you should consider removing once you’ve memorized most of the relevant keystrokes), and the simplified modeline displaying the current directory; there are other packages that you could choose to include as well. Additionally, and perhaps controversially, I replace my Emacs file opening keystroke with sunrise-cd :

(global-set-key "\C-x\C-f" 'sunrise-cd)

However you do it, run sunrise-cd and your orthodox file manager will be open.

Usage

The core of Sunrise Commander involves pressing TAB to switch between the panes, and then opening files and directories by hitting ENTER. Select a file or directory by navigating using the directional keys, or more quickly by hitting C-s.

Here are my seven most common Sunrise Commander exclusive keystrokes. If you can memorize these, you’ll know enough to have a smooth experience:

  • Open a file/directory: Enter
  • Switch panes: TAB
  • Create a directory: +
  • Delete a file/directory: D
  • Move file/directory (between panes): R
  • Move one directory up: Shift-J
  • Sync other pane to current pane: M-o

Next step? If you are still reading this post, I assume that you are aiming to experiment and innovate in your workflow: why not try managing your files and navigating your programming projects in Sunrise Commander for a couple weeks? The benefits of orthodox file management must be felt rather than explained. If given an honest chance, Sunrise Commander could very well become a pleasurable addition to your Emacs toolset.

You can learn the more advanced Sunrise Commander features on its homepage on the Emacs wiki:

https://www.emacswiki.org/emacs/Sunrise_Commander