Skip to content

Global minor mode for entering Emacs commands without modifier keys

License

Notifications You must be signed in to change notification settings

magnars/god-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

God Mode

This is a global minor mode for entering Emacs commands without modifier keys. It's similar to Vim's separation of commands and insertion mode. Activate for all buffers by running M-x god-mode.

Toggle between God mode and non-God mode using ESC:

(global-set-key (kbd "<escape>") 'god-local-mode)

Mapping

This library defines the following mapping:

  • All commands are assumed to be C-<something> unless otherwise indicated. Examples:

    • aC-a
    • sC-s
    • aknyC-a C-k C-n C-y
    • xsC-x C-s
    • x sC-x s

    Note the use of space to produce C-x s.

  • g is a special key to indicate M-<something>. This means that there is no way to write C-g in this mode, you must therefore type C-g directly. Examples:

    • gfM-f
    • gxM-x
  • G is a special key to indicate C-M-<something>. Example:

    • GxC-M-x
  • Digit arguments:

    • 12fM-12 C-f
  • Repetition:

    • gfzzM-f M-f M-f
  • Universal boolean argument:

    • ucoC-u C-c C-o
  • There is a key (default i - think insert) to disable God mode, similar to Vim's i.

Global god-mode and excempt major modes

If you do M-x god-mode, then all buffers will be started in God mode. If you don't like that behavior, just use the god-local-mode toggler with a keybinding.

Sometimes god-mode is enabled in buffers where it makes no sense. In that case you can add the major mode to god-excempt-major-modes:

(add-to-list 'god-excempt-major-modes 'dired-mode)

Since dired-mode is already in the list, that's a noop, but you get the idea. Consider opening an issue or pull request if you find a major mode that should be on the official list.

Not implemented yet

  • C- with backspace and arrow keys don't quite work, not looked into it yet.

About

Global minor mode for entering Emacs commands without modifier keys

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%