Skip to content
More Evil in ledger-mode.
Emacs Lisp
Branch: master
Clone or download
atheriel Merge pull request #1 from syl20bnr/fix_dependencies
Add dependency on ledger-mode
Latest commit 7a9f9f5 Aug 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Adds MELPA badge and minor edits to the README. Sep 13, 2017
evil-ledger.el Add dependency on ledger-mode Aug 2, 2018

README.md

Making ledger-mode more Evil

MELPA

The evil-ledger package provides a minor mode for Emacs that adds Evil motions and operators to ledger-mode buffers. It allows you to treat transactions as text objects while in evil-mode -- selecting, deleting, and changing around and inside them as a unit.

For example, given the transaction and cursor (indicated by |) below

2000/01/01 * Landlord
    Expenses:Rent      |                     $500.00
    Assets::Chequing

vax selects the transaction around point and all whitespace up to the next transaction. This makes for easy copying, moving, and deletion of transactions as a whole, instead of by selecting a series of lines.

Installation

evil-ledger is available from MELPA.

Usage

evil-ledger-mode is a self-contained minor mode, so you can simply enable it in a ledger-mode buffer to try it out, and disable it when you don't need it.

Using Transactions as Text Objects

evil-ledger-mode adds ix and ax to the visual and operator states for selecting inside and around transactions, respectively. This means you can, for example

  • Select the transaction at point with vix, and include surrounding whitespace with vax.
  • Delete the current transaction with dax, or replace it with cax.

evil-ledger-mode supports repeated invocations, so for example vaxax selects the transaction at point, plus the next one as well, and so on.

Commands also support numerical prefixes, so d3ax deletes the current and next two transactions.

Navigation

evil-ledger-mode also provides navigation aids gj and gk for jumping to the next and previous transactions, respectively. Of course, 3gj will work as expected.

Alignment and Sorting

evil-ledger-mode adds an evil-ledger-align operator to visual state with the keybinding =, so that, for example, v3ax= will select the next three transactions and align all postings in them.

There is also an evil-ledger-sort operator that will sort transactions by date (as per ledger-sort-region), although it does not have a keybinding by default. You can add one with

(evil-define-key* 'visual evil-ledger-mode-map
                  "S" #'evil-ledger-sort)

or by setting evil-ledger-sort-key.

Configuration

To make the minor mode start automatically in Ledger buffers, you can add it as a hook in your configuration, e.g.

(add-hook 'ledger-mode-hook #'evil-ledger-mode))

For use-package users, the following is a sample configuration:

(use-package evil-ledger
  :ensure t
  :after ledger-mode
  :config
  (setq evil-ledger-sort-key "S")
  (add-hook 'ledger-mode-hook #'evil-ledger-mode))

License

All code is made available under the GPLv3, the same license as Emacs itself.

You can’t perform that action at this time.