diff options
author | John Wiegley <johnw@newartisans.com> | 2009-06-17 16:55:42 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-06-17 16:55:42 +0100 |
commit | 6374b308b25eff2289347edc94d3a450dda348ac (patch) | |
tree | e306e8cc17474774d03de7578b31fede15507f4b /contrib/vim/syntax/ledger.vim | |
parent | cb2e596725585c73ad8a7958773839966225d850 (diff) | |
parent | 9701548f7e634f9a19295e34f624264343b78f0b (diff) | |
download | fork-ledger-6374b308b25eff2289347edc94d3a450dda348ac.tar.gz fork-ledger-6374b308b25eff2289347edc94d3a450dda348ac.tar.bz2 fork-ledger-6374b308b25eff2289347edc94d3a450dda348ac.zip |
Merge commit 'kljohann/master' into next
Diffstat (limited to 'contrib/vim/syntax/ledger.vim')
-rw-r--r-- | contrib/vim/syntax/ledger.vim | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/contrib/vim/syntax/ledger.vim b/contrib/vim/syntax/ledger.vim new file mode 100644 index 00000000..1c1968e4 --- /dev/null +++ b/contrib/vim/syntax/ledger.vim @@ -0,0 +1,49 @@ +" Vim syntax file +" filetype: ledger +" Version: 0.1.0 +" by Johann Klähn; Use according to the terms of the GPL>=2. +" by Stefan Karrmann; Use according to the terms of the GPL>=2. +" by Wolfgang Oertl; Use according to the terms of the GPL>=2. +" Revision history +" 2009-06-12 J. Klähn: Use all available columns for foldtext +" 2009-03-25 J. Klähn: Allow Metadata +" in transactions and postings (Ledger 3.0) +" Also fixed alignment for multi-byte-characters +" 2009-01-28 S.Karrmann: minor fixes +" 2009-01-27 third version by S.Karrmann. +" better extraction of the amount of the posting +" decimal separator can be one of '.' and ','. +" 2005-02-05 first version (partly copied from ledger.vim 0.0.1) +" vim:ts=2:sw=2:sts=2:foldmethod=marker + +if version < 600 + syntax clear +elseif exists("b:current_sytax") + finish +endif + +" for debugging +syntax clear + +" region: a transaction containing postings +syn region transNorm start=/^[[:digit:]~]/ skip=/^\s/ end=/^/ + \ fold keepend transparent contains=transDate, Metadata, Posting +syn match transDate /^\d\S\+/ contained +syn match Metadata /^\s\+;.*/ contained +syn match Comment /^;.*$/ +" every space in an account name shall be surrounded by two non-spaces +" every account name ends with a tab, two spaces or the end of the line +syn match Account /^\s\+\zs\%(\S\|\S \S\)\+\ze\%([ ]\{2,}\|\t\s*\|\s*$\)/ contained +syn match Posting /^\s\+[^[:blank:];].*$/ contained transparent contains=Account + + +highlight default link transDate Question +highlight default link Metadata PreProc +highlight default link Comment Comment +highlight default link Account Identifier + +" syncinc is easy: search for the first transaction. +syn sync clear +syn sync match ledgerSync grouphere transNorm "^\d" + +let b:current_syntax = "ledger" |