From 81f2565da3984673c50f21455a1dd77da2f5e7f1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 8 Apr 2013 11:14:32 +0900 Subject: [PATCH] handling lines w/o delimiters --- autoload/lesser_align.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/lesser_align.vim b/autoload/lesser_align.vim index 1c5f210..a054cc9 100644 --- a/autoload/lesser_align.vim +++ b/autoload/lesser_align.vim @@ -11,6 +11,10 @@ function! s:do_align(fl, ll, pattern, nth, ml, mr, ljust, recursive) let pattern = '\s*\(' .a:pattern. '\)\s*' for line in range(a:fl, a:ll) let tokens = split(getline(line), pattern.'\zs') + if empty(tokens) + continue + endif + let max_tokens = len(tokens) > max_tokens ? len(tokens) : max_tokens let nth = match(tokens[0], '^\s*$') != -1 ? a:nth + 1 : a:nth