Emacs text editor

approved

by Klojer

Partial emulation of Emacs text editor.

29 stars7,581 downloadsUpdated 7d agoGPL-3.0
View on GitHub

Emacs Text Editor for Obsidian

This plugin adds a few commands to use Obsidian with Emacs-like keybindings.

Purpose of the project

What is this plugin:

  1. Basic imitation of Emacs commands to make text editing for Emacs users more smooth

What isn't this plugin:

  1. Implementation of complete GNU Emacs functionality and integration elisp into Obsidian
  2. Exact reproducing behavior of GNU Emacs commands

How to install

Run:

export OBSIDIAN_PLUGINS_DIR=/path/to/obsidian/vault/.obsidian/plugins
make install

How to uninstall

export OBSIDIAN_PLUGINS_DIR=/path/to/obsidian/vault/.obsidian/plugins
make uninstall

Example of keybindings configuration

HotkeyObisdian commandDescription
Ctrl + bBackward charMove cursor one character backward
Alt + BackspaceBackward kill wordDelete one word backward
Alt + Shift + [Backward paragraphMove cursor one paragraph backward
Alt + bBackward wordMove cursor one word backward
Alt + Shift + ,Beginning of bufferMove to the beginning of a buffer
Ctrl + dDelete charDelete the following char
Alt + Shift + .End of bufferMove to the end of a buffer
Ctrl + fForward charMove cursor one character forward
Alt + Shift + ]Forward paragraphMove cursor one paragraph forward
Alt + fForward wordMove cursor one word forward
Ctrl + gKeyboard quitSignal a ‘quit’ condition (works only for selection)
Ctrl + kKill lineKill the rest of the current line
Ctrl + wKill regionCut a selected region
Alt + wKill ring saveCopy a selected region
Alt + dKill wordDelete chars until end of a word
Ctrl + aMove beginning of lineMove cursor to beginning of line
Ctrl + eMove end of lineMove cursor to end of line
Ctrl + nNext lineMove cursor to next line
Ctrl + pPrevious lineMove cursor to previous line
Ctrl + lRecenterScroll window to center current line
Ctrl + Shift + -RedoRedo
Ctrl + SpaceSet mark commandMark the beginning of a selection
Ctrl + /UndoUndo
Ctrl + yYankPaste (Yank) a cut or copied a region
(not configured)Upcase wordMake entire next word uppercase, advance cursor
(not configured)Downcase wordMake entire next word lowercase, advance cursor
(not configured)Capitalize wordCapitalize next word or rest of current word, advance cursor
(not configured)Upcase regionMake entire selected region uppercase
(not configured)Downcase regionMake entire selected region lowercase
(not configured)Capitalize regionCapitalize each word in selected region
Alt + uUpcase dwimUppercase selection if selection exists, else word
Alt + lDowncase dwimLowercase selection if selection exists, else word
Alt + cCapitalize dwimCapitalize selection if selection exists, else word
Alt + xOpen command paletteOpen command palette

Key Repeat

When enabled in Settings → Community plugins → Emacs text editor, the following additional hotkeys will repeat when held down, as in emacs:

  • Character movement: Ctrl+F, Ctrl+B
  • Line movement: Ctrl+N, Ctrl+P
  • Word movement: Alt+F, Alt+B
  • Character, Word Deletion: Ctrl+D, Alt+D

In the Settings, you can also adjust the initial repeat delay or interval, or use quick presets (Slow/Medium/Fast). This repeat mechanism works around Obsidian API limitations which prevent changing ctrl or alt key repeats. It is separate from your OS keyboard repeat controls; changing repeat timing here affects only Obsidian hotkey behavior.

Known issues

  1. Move to beginning of line command (Ctrl + a) conflicts with select all action. Solution: Use Home/End + Shift.
  2. Conflicts with existing hotkeys. Solution: use additional plugin for custom bindings, for example https://github.com/tgrosinger/leader-hotkeys-obsidian
  3. Absent support of "kill-ring". Solution: use plugin https://github.com/Karakaz/obsidian-paste-from-history with Alt + y keybinding
  4. Absent support of scroll-up/scroll-down commands. Solution is not found

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.