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

Do not align when number starts at first column. #53

Merged
merged 1 commit into from
Jun 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions autoload/ledger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,12 @@ endf
function! ledger#autocomplete_and_align()
if pumvisible()
return "\<c-n>"
" See http://stackoverflow.com/questions/23323747/vim-vimscript-get-exact-character-under-the-cursor
elseif matchstr(getline('.'), '\%' . (col('.')-1) . 'c.') =~ '\d'
endif
" Align an amount only if there is a digit immediately before the cursor and
" such digit is preceded by at least one space (the latter condition is
" necessary to avoid situations where a date starting at the first column is
" confused with a commodity to be aligned).
if match(getline('.'), '\s.*\d\%'.col('.').'c') > -1
norm h
call ledger#align_amount_at_cursor()
return "\<c-o>A"
Expand Down