vim: highlight account names
This helps to avoid confusion when an account is not seperated from the amount by two spaces or a tab but only by one space. In these cases the amount will now be highlighted as if it belongs to the account name. Thanks to user 'plaindocs' for reporting this.
This commit is contained in:
parent
b96df34d75
commit
9701548f7e
2 changed files with 11 additions and 5 deletions
|
|
@ -85,7 +85,7 @@ function! s:multibyte_strlen(text) "{{{2
|
|||
return strlen(substitute(a:text, ".", "x", "g"))
|
||||
endfunction "}}}
|
||||
|
||||
function s:get_columns(win) "{{{2
|
||||
function! s:get_columns(win) "{{{2
|
||||
" As long as vim doesn't provide a command natively,
|
||||
" we have to compute the available columns.
|
||||
" see :help todo.txt -> /Add argument to winwidth()/
|
||||
|
|
|
|||
|
|
@ -26,15 +26,21 @@ endif
|
|||
syntax clear
|
||||
|
||||
" region: a transaction containing postings
|
||||
syn region transNorm start=/^\d/ skip=/^\s/ end=/^/
|
||||
\ fold keepend transparent contains=transDate, Metadata
|
||||
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 Comment SpecialKey
|
||||
highlight default link Metadata SpecialKey
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue