From fb777534e02c50824f0afce810054c93947444f1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 8 Apr 2013 10:46:18 +0900 Subject: [PATCH] fix: handling empty line --- autoload/lesser_align.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/lesser_align.vim b/autoload/lesser_align.vim index d917ea1..1c5f210 100644 --- a/autoload/lesser_align.vim +++ b/autoload/lesser_align.vim @@ -12,12 +12,12 @@ function! s:do_align(fl, ll, pattern, nth, ml, mr, ljust, recursive) for line in range(a:fl, a:ll) let tokens = split(getline(line), pattern.'\zs') let max_tokens = len(tokens) > max_tokens ? len(tokens) : max_tokens + let nth = match(tokens[0], '^\s*$') != -1 ? a:nth + 1 : a:nth - if len(tokens) < a:nth + if len(tokens) < nth continue endif - let nth = match(tokens[0], '^\s*$') != -1 ? a:nth + 1 : a:nth let last = tokens[nth - 1] let before = (nth > 1 ? join(tokens[0 : nth - 2], '') : '') . substitute(last, pattern.'$', '', '') let after = join(tokens[nth : -1], '')