mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-09 02:13:49 -05:00
Update doc
This commit is contained in:
10
README.md
10
README.md
@@ -1,7 +1,7 @@
|
|||||||
vim-easy-align
|
vim-easy-align
|
||||||
==============
|
==============
|
||||||
|
|
||||||
A simple, easy-to-use Vim alignment plugin without too much ambition.
|
A simple, easy-to-use Vim alignment plugin.
|
||||||
|
|
||||||
Demo
|
Demo
|
||||||
----
|
----
|
||||||
@@ -46,10 +46,10 @@ _vim-easy-align_ defines `:EasyAlign` command (and the right-justification
|
|||||||
variant `:EasyAlign!`) in the visual mode.
|
variant `:EasyAlign!`) in the visual mode.
|
||||||
|
|
||||||
| Mode | Command |
|
| Mode | Command |
|
||||||
| ------------------------- | --------------------------------------------- |
|
| ------------------------- | ------------------------------------------------ |
|
||||||
| Interactive mode | `:EasyAlign` |
|
| Interactive mode | `:EasyAlign[!]` |
|
||||||
| Using predefined rules | `:EasyAlign [FIELD#] DELIMITER_KEY [OPTIONS]` |
|
| Using predefined rules | `:EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS]` |
|
||||||
| Using regular expressions | `:EasyAlign [FIELD#] /REGEXP/ [OPTIONS]` |
|
| Using regular expressions | `:EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS]` |
|
||||||
|
|
||||||
### Interactive mode
|
### Interactive mode
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
vim-easy-align *vim-easy-align* *easy-align*
|
vim-easy-align *vim-easy-align* *easy-align*
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
A simple, easy-to-use Vim alignment plugin without too much ambition.
|
A simple, easy-to-use Vim alignment plugin.
|
||||||
|
|
||||||
Author: Junegunn Choi
|
Author: Junegunn Choi
|
||||||
Source: https://github.com/junegunn/vim-easy-align
|
Source: https://github.com/junegunn/vim-easy-align
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
|
||||||
EasyAlign *:EasyAlign* *:EasyAlign!*
|
EasyAlign *:EasyAlign* *:EasyAlign!*
|
||||||
@@ -16,10 +17,10 @@ vim-easy-align defines `:EasyAlign` command in the visual mode.
|
|||||||
(:EasyAlign! is the right-justification version.)
|
(:EasyAlign! is the right-justification version.)
|
||||||
|
|
||||||
| Mode | Command |
|
| Mode | Command |
|
||||||
| ------------------------- | ------------------------------------------- |
|
| ------------------------- | ---------------------------------------------- |
|
||||||
| Interactive mode | :EasyAlign |
|
| Interactive mode | :EasyAlign[!] |
|
||||||
| Using predefined rules | :EasyAlign [FIELD#] DELIMITER_KEY [OPTIONS] |
|
| Using predefined rules | :EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS] |
|
||||||
| Using regular expressions | :EasyAlign [FIELD#] /REGEXP/ [OPTIONS] |
|
| Using regular expressions | :EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS] |
|
||||||
|
|
||||||
|
|
||||||
Interactive mode
|
Interactive mode
|
||||||
@@ -43,7 +44,7 @@ With this mapping, you can align selected lines of text with a few keystrokes.
|
|||||||
- Around the last occurrences of delimiters (-1)
|
- Around the last occurrences of delimiters (-1)
|
||||||
-2 Around the second to last occurrences of delimiters
|
-2 Around the second to last occurrences of delimiters
|
||||||
...
|
...
|
||||||
4. Delimiter key (a single keystroke)
|
4. Delimiter key for the predefined rules (a single keystroke)
|
||||||
<space> General alignment around whitespaces
|
<space> General alignment around whitespaces
|
||||||
= Operators containing equals sign (=, ==, !=, +=, &&=, ...)
|
= Operators containing equals sign (=, ==, !=, +=, &&=, ...)
|
||||||
: Suitable for formatting JSON or YAML
|
: Suitable for formatting JSON or YAML
|
||||||
@@ -51,6 +52,9 @@ With this mapping, you can align selected lines of text with a few keystrokes.
|
|||||||
, Multi-line method arguments. CSV.
|
, Multi-line method arguments. CSV.
|
||||||
| Table markdown
|
| Table markdown
|
||||||
|
|
||||||
|
(You can override these default rules or define your own rules with
|
||||||
|
`g:easy_align_delimiters`, which will be described in the later section.)
|
||||||
|
|
||||||
During the key sequence, <Enter> key will toggle right-justification mode.
|
During the key sequence, <Enter> key will toggle right-justification mode.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@@ -115,14 +119,16 @@ You can even omit spaces between the arguments, so concisely (or cryptically):
|
|||||||
Available options are as follows.
|
Available options are as follows.
|
||||||
|
|
||||||
| Atrribute | Type | Default |
|
| Atrribute | Type | Default |
|
||||||
| ---------------- | ---------------- | --------------------- |
|
| ---------------- | ---------------- | ----------------------------- |
|
||||||
| left_margin | number or string | 0 |
|
| left_margin | number or string | 0 |
|
||||||
| right_margin | number or string | 0 |
|
| right_margin | number or string | 0 |
|
||||||
| stick_to_left | boolean | 0 |
|
| stick_to_left | boolean | 0 |
|
||||||
| delimiter_align | string | 'r' |
|
|
||||||
| ignore_unmatched | boolean | 1 |
|
| ignore_unmatched | boolean | 1 |
|
||||||
| ignores | array | ['String', 'Comment'] |
|
| ignores | array | ['String', 'Comment'] |
|
||||||
|
| delimiter_align | string | 'r' |
|
||||||
|
| | | (right, left, center) |
|
||||||
| indentation | string | 'k' |
|
| indentation | string | 'k' |
|
||||||
|
| | | (keep, shallow, deep, none) |
|
||||||
|
|
||||||
|
|
||||||
Partial alignment in blockwise-visual mode
|
Partial alignment in blockwise-visual mode
|
||||||
@@ -155,7 +161,7 @@ For example, the following paragraph
|
|||||||
'grape:fruits': 3
|
'grape:fruits': 3
|
||||||
}
|
}
|
||||||
|
|
||||||
becomes as follows on '<Enter>:'
|
becomes as follows on '<Enter>:' (or `:EasyAlign:`)
|
||||||
|
|
||||||
{
|
{
|
||||||
# Quantity of apples: 1
|
# Quantity of apples: 1
|
||||||
@@ -168,17 +174,13 @@ becomes as follows on '<Enter>:'
|
|||||||
|
|
||||||
Naturally, this feature only works when syntax highlighting is enabled.
|
Naturally, this feature only works when syntax highlighting is enabled.
|
||||||
|
|
||||||
You can change the default rule by either defining global `g:easy_align_ignores`
|
You can change the default rule by using one of these 3 methods.
|
||||||
array,
|
|
||||||
|
|
||||||
" Ignore nothing!
|
1. Define global `g:easy_align_ignores` list
|
||||||
let g:easy_align_ignores = []
|
2. Define a custom rule in `g:easy_align_delimiters` with 'ignores' option
|
||||||
|
3. Provide 'ignores' option to `:EasyAlign` command. e.g. :EasyAlign:{'is':[]}
|
||||||
|
|
||||||
or providing 'ignores' option directly to :EasyAlign command
|
For example if you set 'ignores' option to be an empty list, you get
|
||||||
|
|
||||||
:EasyAlign:{'is':[]}
|
|
||||||
|
|
||||||
Then you get,
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# Quantity of apples: 1
|
# Quantity of apples: 1
|
||||||
@@ -216,17 +218,13 @@ this is usually what we want.
|
|||||||
grapefruits: 3
|
grapefruits: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
However, this default behavior is also configurable.
|
However, this default behavior is also configurable by using one of these 3
|
||||||
|
methods.
|
||||||
One way is to set the global `g:easy_align_ignore_unmatched` variable to 0.
|
|
||||||
|
|
||||||
let g:easy_align_ignore_unmatched = 0
|
|
||||||
|
|
||||||
Or in non-interactive mode, you can provide 'ignore_unmatched' option to
|
|
||||||
`:EasyAlign` command as follows.
|
|
||||||
|
|
||||||
:EasyAlign:{'iu':0}
|
|
||||||
|
|
||||||
|
1. Set the global `g:easy_align_ignore_unmatched` variable to 0
|
||||||
|
2. Define a custom alignment rule with 'ignore_unmatched' option set to 0
|
||||||
|
3. Provide 'ignore_unmatched' option to `:EasyAlign` command.
|
||||||
|
e.g. :EasyAlign:{'iu':0}
|
||||||
|
|
||||||
Then we get,
|
Then we get,
|
||||||
|
|
||||||
@@ -329,7 +327,7 @@ you can extend the rules by setting a dictionary named
|
|||||||
\ '/': { 'pattern': '//\+\|/\*\|\*/', 'ignores': ['String'] },
|
\ '/': { 'pattern': '//\+\|/\*\|\*/', 'ignores': ['String'] },
|
||||||
\ '#': { 'pattern': '#\+', 'ignores': ['String'] },
|
\ '#': { 'pattern': '#\+', 'ignores': ['String'] },
|
||||||
\ ']': {
|
\ ']': {
|
||||||
\ 'pattern': '[\[\]]',
|
\ 'pattern': '[[\]]',
|
||||||
\ 'left_margin': 0,
|
\ 'left_margin': 0,
|
||||||
\ 'right_margin': 0,
|
\ 'right_margin': 0,
|
||||||
\ 'stick_to_left': 0
|
\ 'stick_to_left': 0
|
||||||
|
|||||||
Reference in New Issue
Block a user