mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 10:53:49 -05:00
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:
@@ -312,7 +312,10 @@ function! s:split_line(line, nth, modes, cycle, fc, lc, pattern, stick_to_left,
|
|||||||
let delims = []
|
let delims = []
|
||||||
" Append an empty item to enable right/center alignment of the last token
|
" 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
|
" - 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(tokens, '')
|
||||||
call add(delims, '')
|
call add(delims, '')
|
||||||
endif
|
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, 'delimiter_align', get(g:, 'easy_align_delimiter_align', 'r'))[0],
|
||||||
\ get(dict, 'indentation', get(g:, 'easy_align_indentation', 'k'))[0],
|
\ get(dict, 'indentation', get(g:, 'easy_align_indentation', 'k'))[0],
|
||||||
\ get(dict, 'stick_to_left', 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())),
|
\ get(dict, 'ignore_groups', get(dict, 'ignores', s:ignored_syntax())),
|
||||||
\ recur)
|
\ recur)
|
||||||
|
|
||||||
|
|||||||
@@ -1064,3 +1064,12 @@ aaa, b,
|
|||||||
111 22 333 444 55555 6666 7 88888
|
111 22 333 444 55555 6666 7 88888
|
||||||
1111 2 33 444 555 66 777 8
|
1111 2 33 444 555 66 777 8
|
||||||
|
|
||||||
|
a = 1
|
||||||
|
bb = 2
|
||||||
|
ccccc
|
||||||
|
ddd = 3
|
||||||
|
|
||||||
|
a = 1
|
||||||
|
bb = 2
|
||||||
|
ccccc
|
||||||
|
ddd = 3
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
4Gvipjyvip
|
4Gvipjyvip
|
||||||
|
|||||||
Reference in New Issue
Block a user