From 8dd2daaa9e9940f335303734d2c68f7cd51b891f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 14 May 2013 00:41:56 +0900 Subject: [PATCH] fix to preserve trailing whitespaces from prefix when delimiter sticks to left --- autoload/easy_align.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 6abe3e9..9deb77d 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -31,7 +31,7 @@ function! s:do_align(just, fl, ll, fc, lc, pattern, nth, ml, mr, stick_to_left, let max_just_len = 0 let max_delim_len = 0 let max_tokens = 0 - let pattern = '\s*\(' .a:pattern. '\)\s\{-}' + let pattern = '\s*\(' .a:pattern. '\)\s' . (a:stick_to_left ? '*' : '\{-}') for line in range(a:fl, a:ll) let tokens = split(a:lc ? \ strpart(getline(line), a:fc - 1, a:lc - a:fc + 1) : @@ -58,7 +58,7 @@ function! s:do_align(just, fl, ll, fc, lc, pattern, nth, ml, mr, stick_to_left, let nth = len(tokens) + a:nth endif - if nth < 0 + if nth < 0 || nth == len(tokens) continue endif endif