mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-11 03:13:48 -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>
|
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
|
||||||
```
|
```
|
||||||
|
|
||||||
In live interactive mode, you have to type in the same delimiter (or `CTRL-X` on
|
In live interactive mode, you have to type in the same delimiter or regular
|
||||||
regular expression) again to finalize the alignment. This allows you to preview
|
expression again to finalize the alignment. This allows you to preview the
|
||||||
the result of the alignment and freely change the delimiter using backspace key
|
result of the alignment and freely change the delimiter using backspace key
|
||||||
without leaving the interactive mode.
|
without leaving the interactive mode.
|
||||||
|
|
||||||
### Using `EasyAlign` in command line
|
### 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')
|
silent! call remove(opts, 'm')
|
||||||
endif
|
endif
|
||||||
elseif ch == "\<C-_>" || ch == "\<C-X>"
|
elseif ch == "\<C-_>" || ch == "\<C-X>"
|
||||||
if a:live && regx && !empty(d)
|
let pd = regx ? d : ''
|
||||||
break
|
|
||||||
endif
|
|
||||||
|
|
||||||
let prompt = 'Regular expression: '
|
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)
|
if !empty(ch) && s:valid_regexp(ch)
|
||||||
let regx = 1
|
let regx = 1
|
||||||
let d = ch
|
let d = ch
|
||||||
if !a:live | break | endif
|
if !a:live || pd == d
|
||||||
|
break
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let warn = 'Invalid regular expression: '.ch
|
let warn = 'Invalid regular expression: '.ch
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -121,10 +121,10 @@ following mapping in addition to the one for `:EasyAlign` command.
|
|||||||
|
|
||||||
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
|
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
|
||||||
|
|
||||||
In live interactive mode, you have to type in the same delimiter (or
|
In live interactive mode, you have to type in the same delimiter or
|
||||||
`CTRL-X` on regular expression) again to finalize the alignment. This
|
regular expression again to finalize the alignment. This allows you to
|
||||||
allows you to preview the result of the alignment and freely change the
|
preview the result of the alignment and freely change the delimiter using
|
||||||
delimiter using backspace key without leaving the interactive mode.
|
backspace key without leaving the interactive mode.
|
||||||
|
|
||||||
|
|
||||||
Left/right/center mode switch in interactive mode
|
Left/right/center mode switch in interactive mode
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ Do (live interactive mode!):
|
|||||||
\<C-I>\<C-I>
|
\<C-I>\<C-I>
|
||||||
\<C-X>|\<Enter>
|
\<C-X>|\<Enter>
|
||||||
\<Enter>
|
\<Enter>
|
||||||
\<C-X>
|
\<C-X>\<Enter>
|
||||||
|
|
||||||
Expect:
|
Expect:
|
||||||
[|] Option[|]Type [|]Default[|]Description [|
|
[|] Option[|]Type [|]Default[|]Description [|
|
||||||
|
|||||||
Reference in New Issue
Block a user