Apply ignore_unmatched option on R/C mode if explicitly set

By default, unmatched trailing token from each line is also aligned in
right and center alignment modes unlike in left alignment mode. If
ignore_unmatched option is explicitly set to 1 by user, they will be ignored
even in right/center modes.
This commit is contained in:
Junegunn Choi
2013-10-05 12:23:44 +09:00
parent 98bd9fe6f0
commit a4a1e27395
3 changed files with 15 additions and 3 deletions

View File

@@ -312,7 +312,10 @@ function! s:split_line(line, nth, modes, cycle, fc, lc, pattern, stick_to_left,
let delims = []
" Append an empty item to enable right/center alignment of the last token
" - if the last token is not ignorable or ignorable but not the only token
elseif (mode ==? 'r' || mode ==? 'c') && (!ignorable || len(tokens) > 1) && a:nth >= 0 " includes -0
elseif a:ignore_unmatched != 1 &&
\ (mode ==? 'r' || mode ==? 'c') &&
\ (!ignorable || len(tokens) > 1) &&
\ a:nth >= 0 " includes -0
call add(tokens, '')
call add(delims, '')
endif
@@ -901,7 +904,7 @@ function! s:align(bang, first_line, last_line, expr)
\ get(dict, 'delimiter_align', get(g:, 'easy_align_delimiter_align', 'r'))[0],
\ get(dict, 'indentation', get(g:, 'easy_align_indentation', 'k'))[0],
\ get(dict, 'stick_to_left', 0),
\ get(dict, 'ignore_unmatched', get(g:, 'easy_align_ignore_unmatched', 1)),
\ get(dict, 'ignore_unmatched', get(g:, 'easy_align_ignore_unmatched', 2)),
\ get(dict, 'ignore_groups', get(dict, 'ignores', s:ignored_syntax())),
\ recur)

View File

@@ -1064,3 +1064,12 @@ aaa, b,
111 22 333 444 55555 6666 7 88888
1111 2 33 444 555 66 777 8
a = 1
bb = 2
ccccc
ddd = 3
a = 1
bb = 2
ccccc
ddd = 3

View File

@@ -1 +1 @@
4Gvipjyvip
4Gvipjyvip