vim-easy-align

This commit is contained in:
Junegunn Choi
2013-04-13 01:07:03 +09:00
parent 8dcba21260
commit 503c8c860f
6 changed files with 88 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
vim-lesser-align *vim-lesser-align* *lesser-align*
vim-easy-align *vim-easy-align* *easy-align*
=========================================================================
Author: Junegunn Choi <https://github.com/junegunn>
@@ -6,36 +6,37 @@ Author: Junegunn Choi <https://github.com/junegunn>
Yet another Vim alignment plugin without too much ambition.
This plugin clearly has less features than the other pre-existing ones
with the similar goals, but it is simpler, easier to use, and good enough
(or even better) for the most of the cases.
with the similar goals, but it is simpler, easier to use,
and just good enough for the most of the cases.
https://github.com/junegunn/vim-lesser-align
https://github.com/junegunn/vim-easy-align
LesserAlign *LesserAlign*
EasyAlign *EasyAlign*
-------------------------------------------------------------------------
Vim-lesser-align defines `LesserAlign` command in the visual mode.
For convenience, it is advised that you define a mapping for triggering
it in your .vimrc.
Vim-easy-align defines `:EasyAlign` command in the visual mode.
vnoremap <silent> <Enter> :LesserAlign<cr>
For convenience, it is advised that you define a mapping for triggering it
in your `.vimrc`.
Then a key sequence becomes a combination of 3 parts.
vnoremap <silent> <Enter> :EasyAlign<cr>
1. <Enter>
- Shortcut for `:LesserAssign<cr>`
2. Integer (optional, default: 1)
1 Alignment around 1st delimiter
2 Alignment around 2nd delimiter
With this mapping, you can align selected lines with a few keystrokes.
1. <Enter> key to start EasyAlign command
2. Optional field number (default: 1)
1 Alignment around 1st delimiter
2 Alignment around 2nd delimiter
...
* Alignment around all delimiters (tabularize)
* Alignment around all delimiters (recursive)
3. Delimiter
= Operators containing equals sign (=, ==, !=, +=, &&=, ...)
<space>
:
,
|
<space> General alignment around whitespaces
= Operators containing equals sign (=, ==, !=, +=, &&=, ...)
: Suitable for formatting JSON or YAML
. Multi-line method chaining
, Multi-line method arguments. CSV.
| Table markdown
Examples:
@@ -51,7 +52,8 @@ Examples:
Defining custom alignment rules
-------------------------------------------------------------------------
let g:lesser_align_delimiters = {
let g:easy_align_delimiters = {
\ '/': { 'pattern': '//*' },
\ 'x': {
\ 'pattern': '[xX]',
\ 'margin_left': ' <<<',
@@ -59,3 +61,4 @@ Defining custom alignment rules
\ 'stick_to_left': 0
\ }
\ }