This is my vim configuration for frictionless ledger journal editing. It depends on the ledger.vim, UltiSnips and deoplete plugins.
after/ftplugin/ledger.vim
:
call deoplete#custom#option('omni_patterns', { 'ledger': ':' }) setlocal formatprg=fmt_ledgerThis file is sourced every time a ledger filetype is detected. It instructs deoplete to trigger account autocompletion when a colon is inserted. It also uses the
fmt_ledger
script to power vim's formatting action (see
:h gq
for more information).
fmt_ledger
:
ledger -f - print --sort date --date-format '%Y-%m-%d'This scripts reformats the ledger journal passed via
stdin
and
outputs it to stdout
. It sorts entries and uses the ISO 8601 date format. This allows me to always add entries at the end of my journal and let vim do the sorting/formatting for me.
mysnippets/ledger.snippets
:
snippet e "entry" `date +%Y-%m-%d` ${1:Name of a commonly visited place} ${2:Expenses:Common:Expense} ${0:0} ${3:Assets:My Bank:Checking} endsnippetThis defines a snippet that can be expanded after typing the letter
e
. It automatically fills in the current date and jumps between
the main elements of the entry.