diff --git a/README.md b/README.md index 656ceae..9bf2815 100644 --- a/README.md +++ b/README.md @@ -183,9 +183,9 @@ in addition to the one for `:EasyAlign` command. vnoremap :LiveEasyAlign ``` -In live interactive mode, you have to type in the same delimiter or regular -expression again to finalize the alignment. This allows you to preview the -result of the alignment and freely change the delimiter using backspace key +In live interactive mode, you have to type in the same delimiter (or `CTRL-X` on +regular expression) again to finalize the alignment. This allows you to preview +the result of the alignment and freely change the delimiter using backspace key without leaving the interactive mode. ### Using `EasyAlign` in command line diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 067b605..61b66a0 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -690,16 +690,16 @@ function! s:interactive(range, modes, n, d, opts, rules, vis, live) silent! call remove(opts, 'm') endif elseif ch == "\" || ch == "\" - let pd = regx ? d : '' + if a:live && regx && !empty(d) + break + endif let prompt = 'Regular expression: ' - let ch = s:input(prompt, pd, a:vis) + let ch = s:input(prompt, '', a:vis) if !empty(ch) && s:valid_regexp(ch) let regx = 1 let d = ch - if !a:live || pd == d - break - endif + if !a:live | break | endif else let warn = 'Invalid regular expression: '.ch endif diff --git a/doc/easy_align.txt b/doc/easy_align.txt index 898ba0e..e8cc732 100644 --- a/doc/easy_align.txt +++ b/doc/easy_align.txt @@ -121,10 +121,10 @@ following mapping in addition to the one for `:EasyAlign` command. vnoremap :LiveEasyAlign -In live interactive mode, you have to type in the same delimiter or -regular expression again to finalize the alignment. This allows you to -preview the result of the alignment and freely change the delimiter using -backspace key without leaving the interactive mode. +In live interactive mode, you have to type in the same delimiter (or +`CTRL-X` on regular expression) again to finalize the alignment. This +allows you to preview the result of the alignment and freely change the +delimiter using backspace key without leaving the interactive mode. Left/right/center mode switch in interactive mode diff --git a/test/interactive.vader b/test/interactive.vader index a917184..76d666f 100644 --- a/test/interactive.vader +++ b/test/interactive.vader @@ -508,7 +508,7 @@ Do (live interactive mode!): \\ \|\ \ - \\ + \ Expect: [|] Option[|]Type [|]Default[|]Description [|