From 0cb6b98fc155717b0a56c110551ac57d1d951ddb Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 6 Mar 2016 13:47:17 +0900 Subject: [PATCH] Use search pattern as delimiter if empty regex is given Close #78 --- autoload/easy_align.vim | 7 ++++--- test/commandline.vader | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 1c09bf0..ededb60 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -829,10 +829,11 @@ function! s:valid_regexp(regexp) endfunction function! s:test_regexp(regexp) - if !s:valid_regexp(a:regexp) - call s:exit('Invalid regular expression: '. a:regexp) + let regexp = empty(a:regexp) ? @/ : a:regexp + if !s:valid_regexp(regexp) + call s:exit('Invalid regular expression: '. regexp) endif - return a:regexp + return regexp endfunction let s:shorthand_regex = diff --git a/test/commandline.vader b/test/commandline.vader index 36e49b0..dbb2b32 100644 --- a/test/commandline.vader +++ b/test/commandline.vader @@ -105,6 +105,14 @@ Expect: ap><:;><;b><:c>e da><;;><:;><::>