From 8591c888bfcff3c7abd07cc421759033d6c41312 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 6 May 2013 00:28:31 +0900 Subject: [PATCH] fix to process unmatched tokens in right-justficiation mode --- README.md | 2 +- autoload/easy_align.vim | 2 +- doc/easy_align.txt | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a30385..057919b 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ let g:easy_align_delimiters = { Handling unmatched lines ------------------------ -EasyAlign by default ignores lines without the matching delimiters. +EasyAlign by default ignores lines without the matching delimiters (except in right-justification mode). This is to ignore interleaved comments commonly found in code. For example, when aligning the following code block, diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 2f5e757..a7121fe 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -47,7 +47,7 @@ function! s:do_align(just, fl, ll, fc, lc, pattern, nth, ml, mr, stick_to_left, let suffix = join(tokens[nth + 1: -1], '') if match(last, pattern.'$') == -1 - if !exists("g:easy_align_ignore_unmatched") || g:easy_align_ignore_unmatched + if a:just == 0 && (!exists("g:easy_align_ignore_unmatched") || g:easy_align_ignore_unmatched) continue else let delim = '' diff --git a/doc/easy_align.txt b/doc/easy_align.txt index 10cb47b..aca27a4 100644 --- a/doc/easy_align.txt +++ b/doc/easy_align.txt @@ -79,7 +79,8 @@ Defining custom alignment rules *g:easy_align_delimiters* Handling unmatched lines *g:easy_align_ignore_unmatched* ------------------------------------------------------------------------- -EasyAlign by default ignores lines without the matching delimiters. +EasyAlign by default ignores lines without the matching delimiters +(except in right-justification mode). This is to ignore interleaved comments commonly found in code. For example, when aligning the following code,