mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-16 13:53:50 -05:00
Generic operator function with interactive mode
This commit is contained in:
16
README.md
16
README.md
@@ -294,6 +294,19 @@ since the same can be easily done using the negative N-th parameter: `<Enter>-=`
|
|||||||
You can define an operator function which executes EasyAlign command, so that it
|
You can define an operator function which executes EasyAlign command, so that it
|
||||||
can be used with a Vim movement.
|
can be used with a Vim movement.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
function! s:easy_align_op(type, ...)
|
||||||
|
'[,']EasyAlign
|
||||||
|
endfunction
|
||||||
|
nnoremap <Leader>a :set opfunc=<SID>easy_align_op<Enter>g@
|
||||||
|
```
|
||||||
|
|
||||||
|
Now without going into visual mode, you can align the lines in the paragraph by
|
||||||
|
`<Leader>aip=` or `<Leader>aip:`.
|
||||||
|
|
||||||
|
Or you can be more specific as follows, so you can do `<Leader>=ip` or
|
||||||
|
`<Leader>:ip`.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
function! s:easy_align_1st_eq(type, ...)
|
function! s:easy_align_1st_eq(type, ...)
|
||||||
'[,']EasyAlign=
|
'[,']EasyAlign=
|
||||||
@@ -306,9 +319,6 @@ endfunction
|
|||||||
nnoremap <Leader>: :set opfunc=<SID>easy_align_1st_colon<Enter>g@
|
nnoremap <Leader>: :set opfunc=<SID>easy_align_1st_colon<Enter>g@
|
||||||
```
|
```
|
||||||
|
|
||||||
Now without going into visual mode, you can align the lines in the paragraph
|
|
||||||
by `<Leader>=ip` or `<Leader>:ip`.
|
|
||||||
|
|
||||||
Alignment options
|
Alignment options
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user