mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 19:03:50 -05:00
Make user confirm regular expression on live interactive mode
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 [|
|
||||
|
||||
Reference in New Issue
Block a user