Skip to content

Commit

Permalink
Merge pull request #53 from lifepillar/dont-align-on-1st-col
Browse files Browse the repository at this point in the history
Do not align when number starts at first column.
  • Loading branch information
kljohann committed Jun 2, 2017
2 parents 9850f4d + 69b138e commit 7cb3e66
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 7cb3e66

Please sign in to comment.