Modal Mode


Modal-mode is an effort to provide modal editing to Emacs, but remain light, and not step too far into the territory of Vi emulation. Its default bindings are based on Vi, but its design accomodates the creation of other modality styles. It has explicit support for Vi-like text-objects through transient modes that turn movement keys into selection keys in order to provide compound commands like those of Vi's d, y, and c keys.


I am a longtime Emacs user always looking for more efficient (and less painful) ways to use the keyboard to go about my work. My appreciation for Vi started with wanting to be able to scroll and move the insertion point with unmodified keys. When I learned to use Vi, I quickly latched onto the good sense of another of its major features: text objects—having a set of verbs 'delete', 'change', 'copy', and a set of nouns 'word', 'line', 'sentence', and being able to combine them into two keystroke instructions for efficient editing that was easy on the hands. I used Viper for a couple of years, but found that emulation came at the expense of smothering many nice Emacs features. What I wanted was to bring the best concepts of Vi into the world of Emacs in a best-of-both approach.


You can browse the source or obtain modal-mode by download or by git in my git repository.


Here is an example of how to enable modal-mode.

;;; Modal-mode setup
(add-to-list 'load-path "/path/to/modal-mode")
(require 'modal-mode)
(setq default-major-mode 'modal-fundamental-mode)
(modal-mode 1)
(when window-system
  (modal-mode-line-background-mode 1))
;;; end modal-mode setup


How do I enable modal-mode in a fundamental-mode buffer?

Switch to modal-fundamental-mode.

What version of Emacs does modal-mode require?

Modal-mode requires GNU Emacs 24 or higher. It can work in Emacs 23, but you will need to configure modal-vilike-derived-whitelist with the list of modes that you want to enable it in.