mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-15 21:33:48 -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
|
||||
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
|
||||
function! s:easy_align_1st_eq(type, ...)
|
||||
'[,']EasyAlign=
|
||||
@@ -306,9 +319,6 @@ endfunction
|
||||
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
|
||||
-----------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user