Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-ASCII account names #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions autoload/beancount.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function! beancount#align_commodity(line1, line2) abort
" - A price directive, i.e., the line starts with a date followed by
" the 'price' keyword and a currency.
let l:end_account = matchend(l:line, '\v' .
\ '^[\-/[:digit:]]+\s+balance\s+([A-Z][A-Za-z0-9\-]+)(:[A-Z0-9][A-Za-z0-9\-]*)+ ' .
\ '^[\-/[:digit:]]+\s+balance\s+([A-Z][A-Za-z0-9\-]+)(:[A-Z0-9]\S*)+ ' .
\ '|^[\-/[:digit:]]+\s+price\s+\S+ ' .
\ '|^\s+([!&#?%PSTCURM]\s+)?([A-Z][A-Za-z0-9\-]+)(:[A-Z0-9][A-Za-z0-9\-]*)+ '
\ '|^\s+([!&#?%PSTCURM]\s+)?([A-Z][A-Za-z0-9\-]+)(:[A-Z0-9]\S*)+ '
\ )
if l:end_account < 0
continue
Expand All @@ -41,7 +41,7 @@ function! beancount#align_commodity(line1, line2) abort
" align on the next column.
let l:separator = matchend(l:line, '^\v([-+])?[,[:digit:]]+', l:begin_number) + 1
if l:separator < 0 | continue | endif
let l:has_spaces = l:begin_number - l:end_account
let l:has_spaces = l:begin_number - strwidth(l:line[0 : l:end_account]) + 1
let l:need_spaces = g:beancount_separator_col - l:separator + l:has_spaces
if l:need_spaces < 0 | continue | endif
call setline(l:current_line, l:line[0 : l:end_account - 1] . repeat(' ', l:need_spaces) . l:line[ l:begin_number : -1])
Expand Down
2 changes: 1 addition & 1 deletion syntax/beancount.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ syn match beanAmount "\v[-+]?[[:digit:].,]+" nextgroup=beanCurrency contained
\ skipwhite
syn match beanCurrency "\v\w+" contained
" Account name: alphanumeric with at least one colon.
syn match beanAccount "\v[[:alnum:]]+:[-[:alnum:]:]+" contained
syn match beanAccount "\v[[:alnum:]]+:\S+" contained
syn match beanTag "\v#[-[:alnum:]]+" contained
syn match beanLink "\v\^\S+" contained
" We must require a space after the flag because you can have flags per
Expand Down