Make user confirm regular expression on live interactive mode

This commit is contained in:
Junegunn Choi
2013-10-25 02:11:43 +09:00
parent c3a7842b0d
commit a76cfdb8ae
4 changed files with 13 additions and 13 deletions

View File

@@ -183,9 +183,9 @@ in addition to the one for `:EasyAlign` command.
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
```
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
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.
### Using `EasyAlign` in command line

View File

@@ -690,16 +690,16 @@ function! s:interactive(range, modes, n, d, opts, rules, vis, live)
silent! call remove(opts, 'm')
endif
elseif ch == "\<C-_>" || ch == "\<C-X>"
if a:live && regx && !empty(d)
break
endif
let pd = regx ? d : ''
let prompt = 'Regular expression: '
let ch = s:input(prompt, '', a:vis)
let ch = s:input(prompt, pd, a:vis)
if !empty(ch) && s:valid_regexp(ch)
let regx = 1
let d = ch
if !a:live | break | endif
if !a:live || pd == d
break
endif
else
let warn = 'Invalid regular expression: '.ch
endif

View File

@@ -121,10 +121,10 @@ following mapping in addition to the one for `:EasyAlign` command.
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
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.
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.
Left/right/center mode switch in interactive mode

View File

@@ -508,7 +508,7 @@ Do (live interactive mode!):
\<C-I>\<C-I>
\<C-X>|\<Enter>
\<Enter>
\<C-X>
\<C-X>\<Enter>
Expect:
[|] Option[|]Type [|]Default[|]Description [|