Update documentation

This commit is contained in:
Junegunn Choi
2013-10-05 15:55:22 +09:00
parent fa26fd7b42
commit bab23a1917
2 changed files with 78 additions and 78 deletions

View File

@@ -77,7 +77,7 @@ For convenience, it is advised that you define a mapping for triggering it in
your `.vimrc`. your `.vimrc`.
```vim ```vim
vnoremap <silent> <Enter> :EasyAlign<cr> vnoremap <silent> <Enter> :EasyAlign<Enter>
``` ```
(Of course you can use any key combination as the trigger. e.g. `<Leader>a`) (Of course you can use any key combination as the trigger. e.g. `<Leader>a`)
@@ -160,6 +160,13 @@ keys listed below. The meaning of each option will be described in
| `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` | | `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` |
| `<Down>` | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }` | | `<Down>` | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }` |
After a successful alignment, you can repeat the same operation using the
repeatable, non-interactive command recorded in `g:easy_align_last_command`.
```vim
:<C-R>=g:easy_align_last_command<Enter><Enter>
```
--- ---
### *Intermission* ### *Intermission*
@@ -216,8 +223,26 @@ You can even omit spaces between the arguments, so concisely (or cryptically):
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}` - `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
The same thing can be done in the interactive mode as well with the following Nice. But let's make it even shorter. When you use write regular expression in
key combination. command line, option values can be written in shorthand notation.
- `:EasyAlign*/[:;]\+/s1l0`
The following table summarizes the shorthand notation.
| Option | Expression |
| ---------------- | ---------- |
| left_margin | `l[0-9]+` |
| right_margin | `r[0-9]+` |
| stick_to_left | `s[01]` |
| ignore_unmatched | `iu[01]` |
| ignore_groups | `ig\[.*\]` |
| delimiter_align | `d[lrc]` |
| mode_sequence | `m[lrc*]*` |
| indentation | `i[ksdn]` |
For your information, the same thing can be done in the interactive mode as well
with the following key combination.
- `<Enter>` - `<Enter>`
- `*` - `*`
@@ -225,32 +250,6 @@ key combination.
- `<CTRL-/>` (or `<CTRL-X>` on GVim) - `<CTRL-/>` (or `<CTRL-X>` on GVim)
- `[:;]\+` - `[:;]\+`
#### Options in shorthand notation
When you use regular expression in command line, options dictionary can be
written concisely using shorthand notation.
For example, the command we saw in the previous section,
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
can also be written as
- `:EasyAlign*/[:;]\+/s1l0`
Supported shorthand notations are listed below.
| Expression | Option |
| ---------- | ---------------- |
| `l[0-9]+` | left_margin |
| `r[0-9]+` | right_margin |
| `s[01]` | stick_to_left |
| `iu[01]` | ignore_unmatched |
| `ig\[.*\]` | ignore_groups |
| `d[lrc]` | delimiter_align |
| `m[lrc*]*` | mode_sequence |
| `i[ksdn]` | indentation |
### Partial alignment in blockwise-visual mode ### Partial alignment in blockwise-visual mode
In blockwise-visual mode (`CTRL-V`), EasyAlign command aligns only the selected In blockwise-visual mode (`CTRL-V`), EasyAlign command aligns only the selected
@@ -300,19 +299,19 @@ There are 4 ways to set alignment options (from lowest precedence to highest):
1. Some option values can be set with corresponding global variables 1. Some option values can be set with corresponding global variables
2. Option values can be specified in the definition of each alignment rule 2. Option values can be specified in the definition of each alignment rule
3. Option values can be given as a dictionary argument to `:EasyAlign` command 3. Option values can be given as arguments to `:EasyAlign` command
4. Option values can be set in interactive mode using special shortcut keys 4. Option values can be set in interactive mode using special shortcut keys
| Option | Shortcut key | Global variable | | Option name | Shortcut key | Abbreviated | Global variable |
| ------------------ | ------------------- | ------------------------------- | | ------------------ | ------------------- | ----------- | ------------------------------- |
| `left_margin` | `CTRL-L` | | | `left_margin` | `CTRL-L` | `l[0-9]+` | |
| `right_margin` | `CTRL-R` | | | `right_margin` | `CTRL-R` | `r[0-9]+` | |
| `stick_to_left` | `<Left>`, `<Right>` | | | `stick_to_left` | `<Left>`, `<Right>` | `s[01]` | |
| `ignore_groups` | `CTRL-G` | `g:easy_align_ignore_groups` | | `ignore_groups` | `CTRL-G` | `ig\[.*\]` | `g:easy_align_ignore_groups` |
| `ignore_unmatched` | `CTRL-U` | `g:easy_align_ignore_unmatched` | | `ignore_unmatched` | `CTRL-U` | `iu[01]` | `g:easy_align_ignore_unmatched` |
| `indentation` | `CTRL-I` | `g:easy_align_indentation` | | `indentation` | `CTRL-I` | `i[ksdn]` | `g:easy_align_indentation` |
| `delimiter_align` | `CTRL-D` | `g:easy_align_delimiter_align` | | `delimiter_align` | `CTRL-D` | `d[lrc]` | `g:easy_align_delimiter_align` |
| `mode_sequence` | `CTRL-O` | | | `mode_sequence` | `CTRL-O` | `m[lrc*]*` | |
### Ignoring delimiters in comments or strings ### Ignoring delimiters in comments or strings

View File

@@ -30,7 +30,7 @@ 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 a mapping for triggering it in
your `.vimrc`. your `.vimrc`.
vnoremap <silent> <Enter> :EasyAlign<cr> vnoremap <silent> <Enter> :EasyAlign<Enter>
With this mapping, you can align selected lines of text with a few keystrokes. With this mapping, you can align selected lines of text with a few keystrokes.
@@ -99,6 +99,13 @@ described in the following sections.
| <Right> | stick_to_left | { 'stick_to_left': 0, 'left_margin': 1 } | | <Right> | stick_to_left | { 'stick_to_left': 0, 'left_margin': 1 } |
| <Down> | *_margin | { 'left_margin': 0, 'right_margin': 0 } | | <Down> | *_margin | { 'left_margin': 0, 'right_margin': 0 } |
*g:easy_align_last_command*
After a successful alignment, you can repeat the same operation using the
repeatable, non-interactive command recorded in `g:easy_align_last_command`.
:<C-R>=g:easy_align_last_command<Enter><Enter>
Non-interactive mode (command line) Non-interactive mode (command line)
------------------------------------------------------------------------- -------------------------------------------------------------------------
@@ -143,8 +150,26 @@ You can even omit spaces between the arguments, so concisely (or cryptically):
:EasyAlign*/[:;]\+/{'s':1,'l':''} :EasyAlign*/[:;]\+/{'s':1,'l':''}
The same thing can be done in the interactive mode as well with the following Nice. But let's make it even shorter. When you use write regular expression in
key combination. command line, option values can be written in shorthand notation.
:EasyAlign*/[:;]\+/s1l0
The following table summarizes the shorthand notation.
| Option | Expression |
| -------------- | ---------- |
| left_margin | l[0-9]+ |
| right_margin | r[0-9]+ |
| stick_to_left | s[01] |
| ignore_unmatched | iu[01] |
| ignore_groups | ig\[.*\] |
| delimiter_align | d[lrc] |
| mode_sequence | m[lrc*]+ |
| indentation | i[ksdn] |
For your information, the same thing can be done in the interactive mode as well
with the following key combination.
- <Enter> - <Enter>
- * - *
@@ -152,30 +177,6 @@ key combination.
- <CTRL-/> (or <CTRL-X> on GVim) - <CTRL-/> (or <CTRL-X> on GVim)
- [:;]\+ - [:;]\+
When you use regular expression in command line, options dictionary can be
written concisely using shorthand notation.
For example, the command we saw in the previous section,
:EasyAlign*/[:;]\+/{'s':1,'l':0}
can also be written as
:EasyAlign*/[:;]\+/s1l0
Supported shorthand notations are listed below.
| Expression | Option |
| ---------- | -------------- |
| l[0-9]+ | left_margin |
| r[0-9]+ | right_margin |
| s[01] | stick_to_left |
| iu[01] | ignore_unmatched |
| ig\[.*\] | ignore_groups |
| d[lrc] | delimiter_align |
| m[lrc*]+ | mode_sequence |
| i[ksdn] | indentation |
Partial alignment in blockwise-visual mode Partial alignment in blockwise-visual mode
------------------------------------------------------------------------- -------------------------------------------------------------------------
@@ -207,19 +208,19 @@ There are 4 ways to set alignment options (from lowest precedence to highest):
1. Some option values can be set with corresponding global variables 1. Some option values can be set with corresponding global variables
2. Option values can be specified in the definition of each alignment rule 2. Option values can be specified in the definition of each alignment rule
3. Option values can be given as a dictionary argument to :EasyAlign command 3. Option values can be given as arguments to :EasyAlign command
4. Option values can be set in interactive mode using special shortcut keys 4. Option values can be set in interactive mode using special shortcut keys
| Option | Shortcut key | Global variable | | Option | Shortcut key | Abbreviated | Global variable |
| ---------------- | ------------------- | ------------------------------- | | ---------------- | --------------- | ----------- | ----------------------------- |
| left_margin | CTRL-L | | | left_margin | CTRL-L | l[0-9]+ | |
| right_margin | CTRL-R | | | right_margin | CTRL-R | r[0-9]+ | |
| stick_to_left | <Left>, <Right> | | | stick_to_left | <Left>, <Right> | s[01] | |
| ignore_groups | CTRL-G | `g:easy_align_ignore_groups` | | ignore_groups | CTRL-G | ig\[.*\] | `g:easy_align_ignore_groups` |
| ignore_unmatched | CTRL-U | `g:easy_align_ignore_unmatched` | | ignore_unmatched | CTRL-U | iu[01] | `g:easy_align_ignore_unmatched` |
| indentation | CTRL-I | `g:easy_align_indentation` | | indentation | CTRL-I | i[ksdn] | `g:easy_align_indentation` |
| delimiter_align | CTRL-D | `g:easy_align_delimiter_align` | | delimiter_align | CTRL-D | d[lrc] | `g:easy_align_delimiter_align` |
| mode_sequence | CTRL-O | | | mode_sequence | CTRL-O | m[lrc*]+ | |
Ignoring delimiters in comments or strings *g:easy_align_ignore_groups* Ignoring delimiters in comments or strings *g:easy_align_ignore_groups*