File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -501,8 +501,12 @@ endf
501
501
function ! ledger#autocomplete_and_align ()
502
502
if pumvisible ()
503
503
return " \<c-n> "
504
- " See http://stackoverflow.com/questions/23323747/vim-vimscript-get-exact-character-under-the-cursor
505
- elseif matchstr (getline (' .' ), ' \%' . (col (' .' )-1 ) . ' c.' ) = ~ ' \d'
504
+ endif
505
+ " Align an amount only if there is a digit immediately before the cursor and
506
+ " such digit is preceded by at least one space (the latter condition is
507
+ " necessary to avoid situations where a date starting at the first column is
508
+ " confused with a commodity to be aligned).
509
+ if match (getline (' .' ), ' \s.*\d\%' .col (' .' ).' c' ) > -1
506
510
norm h
507
511
call ledger#align_amount_at_cursor ()
508
512
return " \<c-o> A"
You can’t perform that action at this time.
0 commit comments