Usability improvements

- Preserve indentation when a line starts with a delimiter
  - Useful for aligning multi-line method chains
- Renamed `margin_{left,right}` to `{left,right}_margin
  - Makes it easier to type in (`l`, `r`)
  - `margin_{left,right}` is still supported
- Margins can be specified as the number of spaces, or as an arbitrary string
This commit is contained in:
Junegunn Choi
2013-08-05 23:41:31 +09:00
parent 20124bc622
commit 2486b9c6df
9 changed files with 223 additions and 49 deletions

View File

@@ -95,7 +95,7 @@ try these commands:
Notice that you can't append `\zs` to your regular expression to put delimiters
on the left. It can be done by providing additional options.
- :EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'margin_left': '' }
- :EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'left_margin': '' }
Then we get:
@@ -104,21 +104,21 @@ Then we get:
Options keys are fuzzy-matched, so you can write as follows:
- :EasyAlign * /[:;]\+/ { 'stl': 1, 'ml': '' }
- :EasyAlign * /[:;]\+/ { 'stl': 1, 'l': '' }
You can even omit spaces between the arguments, so concisely (or cryptically):
- :EasyAlign*/[:;]\+/{'stl':1,'ml':''}
- :EasyAlign*/[:;]\+/{'s':1,'l':''}
Available options for each alignment are as follows.
| Atrribute | Type | Default |
| ---------------- | ------- | ----------------------- |
| margin_left | string | `' '` |
| margin_right | string | `' '` |
| stick_to_left | boolean | 0 |
| ignore_unmatched | boolean | 1 |
| ignores | array | `['String', 'Comment']` |
| Atrribute | Type | Default |
| ---------------- | ---------------- | ----------------------- |
| left_margin | number or string | 0 |
| right_margin | number or string | 0 |
| stick_to_left | boolean | 0 |
| ignore_unmatched | boolean | 1 |
| ignores | array | `['String', 'Comment']` |
Partial alignment in blockwise-visual mode
@@ -231,14 +231,14 @@ Extending alignment rules *g:easy_align_delimiters*
\ '#': { 'pattern': '#\+' },
\ ']': {
\ 'pattern': '[\[\]]',
\ 'margin_left': '',
\ 'margin_right': '',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ ')': {
\ 'pattern': '[()]',
\ 'margin_left': '',
\ 'margin_right': '',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ }
\ }