mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-17 22:33:41 -05:00
<Plug>(EasyAlign) / <Plug>(LiveEasyAlign) for vim-repeat integration
This commit is contained in:
@@ -27,14 +27,19 @@ Interactive mode
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
The command will go into the interactive mode when no argument is given.
|
||||
For convenience, it is advised that you define a mapping for triggering it in
|
||||
For convenience, it is advised that you define mappings for triggering it in
|
||||
your `.vimrc`.
|
||||
|
||||
vnoremap <silent> <Enter> :EasyAlign<Enter>
|
||||
" For visual mode (e.g. vip<Enter>)
|
||||
vmap <Enter> <Plug>(EasyAlign)
|
||||
|
||||
" For normal mode, with Vim movement (e.g. <Leader>aip)
|
||||
nmap <Leader>a <Plug>(EasyAlign)
|
||||
|
||||
With this mapping, you can align selected lines of text with a few keystrokes.
|
||||
|
||||
1. <Enter> key to start interactive EasyAlign command
|
||||
1. <Enter> key (or <Leader>a followed by a Vim movement) to start interactive
|
||||
EasyAlign command
|
||||
2. Optional: Enter keys to select alignment mode (left, right, or center)
|
||||
3. Optional: N-th delimiter (default: 1)
|
||||
1 Around the 1st occurrences of delimiters
|
||||
@@ -108,6 +113,20 @@ repeatable, non-interactive command recorded in `g:easy_align_last_command`.
|
||||
:<C-R>=g:easy_align_last_command<Enter><Enter>
|
||||
|
||||
|
||||
EasyAlign as Vim operator *<Plug>(EasyAlign)*
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
With normal-mode map to `<Plug>(EasyAlign)`, EasyAlign command becomes
|
||||
a Vim operator that can be used with any Vim movement.
|
||||
|
||||
nmap <leader>a <Plug>(EasyAlign)
|
||||
|
||||
Now without going into visual mode, you can align the lines in the
|
||||
paragraph with "<Leader>aip=", "<Leader>aip*|", or "<Leader>aip:".
|
||||
And if you have installed vim-repeat by Tim Pope, the exact alignment
|
||||
can be repeated with "." key.
|
||||
|
||||
|
||||
Live interactive mode *:LiveEasyAlign* *:LiveEasyAlign!*
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
@@ -115,11 +134,12 @@ If you're performing a complex alignment where multiple options should be
|
||||
carefully adjusted, try "live interactive mode" which aligns the text
|
||||
on-the-fly as you type in.
|
||||
|
||||
Live interactive mode can be started with `:LiveEasyAlign` command which
|
||||
takes the same parameters as `:EasyAlign`. I suggest you define the
|
||||
following mapping in addition to the one for `:EasyAlign` command.
|
||||
Live interactive mode can be started with `:LiveEasyAlign` command which takes
|
||||
the same parameters as `:EasyAlign`. I suggest you define mappings such as
|
||||
follows in addition to the ones for `:EasyAlign` command.
|
||||
|
||||
vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
|
||||
vmap <Leader><Enter> <Plug>(LiveEasyAlign)
|
||||
nmap <leader>A <Plug>(LiveEasyAlign)
|
||||
|
||||
In live interactive mode, you have to type in the same delimiter (or
|
||||
`CTRL-X` on regular expression) again to finalize the alignment. This
|
||||
@@ -228,18 +248,6 @@ In blockwise-visual mode (CTRL-V), EasyAlign command aligns only
|
||||
the selected text in the block, instead of the whole lines in the range.
|
||||
|
||||
|
||||
EasyAlign as Vim operator *<Plug>(EasyAlignOperator)*
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
With `<Plug>(EasyAlignOperator)` map, EasyAlign command becomes a Vim
|
||||
operator that can be used with any Vim movement.
|
||||
|
||||
nmap <leader>a <Plug>(EasyAlignOperator)
|
||||
|
||||
Now without going into visual mode, you can align the lines in the
|
||||
paragraph with "<Leader>aip=", "<Leader>aip*|", or "<Leader>aip:".
|
||||
|
||||
|
||||
Alignment options
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user