From bab23a19173663c972a469f0cbc9e6851b2ad9df Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 5 Oct 2013 15:55:22 +0900 Subject: [PATCH] Update documentation --- README.md | 79 +++++++++++++++++++++++----------------------- doc/easy_align.txt | 77 ++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 0beb92d..ad79b23 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ For convenience, it is advised that you define a mapping for triggering it in your `.vimrc`. ```vim -vnoremap :EasyAlign +vnoremap :EasyAlign ``` (Of course you can use any key combination as the trigger. e.g. `a`) @@ -160,6 +160,13 @@ keys listed below. The meaning of each option will be described in | `` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` | | `` | `*_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 +:=g:easy_align_last_command +``` + --- ### *Intermission* @@ -216,8 +223,26 @@ You can even omit spaces between the arguments, so concisely (or cryptically): - `:EasyAlign*/[:;]\+/{'s':1,'l':0}` -The same thing can be done in the interactive mode as well with the following -key combination. +Nice. But let's make it even shorter. When you use write regular expression in +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. - `` - `*` @@ -225,32 +250,6 @@ key combination. - `` (or `` 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 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 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 -| Option | Shortcut key | Global variable | -| ------------------ | ------------------- | ------------------------------- | -| `left_margin` | `CTRL-L` | | -| `right_margin` | `CTRL-R` | | -| `stick_to_left` | ``, `` | | -| `ignore_groups` | `CTRL-G` | `g:easy_align_ignore_groups` | -| `ignore_unmatched` | `CTRL-U` | `g:easy_align_ignore_unmatched` | -| `indentation` | `CTRL-I` | `g:easy_align_indentation` | -| `delimiter_align` | `CTRL-D` | `g:easy_align_delimiter_align` | -| `mode_sequence` | `CTRL-O` | | +| Option name | Shortcut key | Abbreviated | Global variable | +| ------------------ | ------------------- | ----------- | ------------------------------- | +| `left_margin` | `CTRL-L` | `l[0-9]+` | | +| `right_margin` | `CTRL-R` | `r[0-9]+` | | +| `stick_to_left` | ``, `` | `s[01]` | | +| `ignore_groups` | `CTRL-G` | `ig\[.*\]` | `g:easy_align_ignore_groups` | +| `ignore_unmatched` | `CTRL-U` | `iu[01]` | `g:easy_align_ignore_unmatched` | +| `indentation` | `CTRL-I` | `i[ksdn]` | `g:easy_align_indentation` | +| `delimiter_align` | `CTRL-D` | `d[lrc]` | `g:easy_align_delimiter_align` | +| `mode_sequence` | `CTRL-O` | `m[lrc*]*` | | ### Ignoring delimiters in comments or strings diff --git a/doc/easy_align.txt b/doc/easy_align.txt index 7770350..7938a38 100644 --- a/doc/easy_align.txt +++ b/doc/easy_align.txt @@ -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 your `.vimrc`. - vnoremap :EasyAlign + vnoremap :EasyAlign With this mapping, you can align selected lines of text with a few keystrokes. @@ -99,6 +99,13 @@ described in the following sections. | | stick_to_left | { 'stick_to_left': 0, 'left_margin': 1 } | | | *_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`. + + :=g:easy_align_last_command + 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':''} -The same thing can be done in the interactive mode as well with the following -key combination. +Nice. But let's make it even shorter. When you use write regular expression in +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. - - * @@ -152,30 +177,6 @@ key combination. - (or 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 ------------------------------------------------------------------------- @@ -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 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 -| Option | Shortcut key | Global variable | -| ---------------- | ------------------- | ------------------------------- | -| left_margin | CTRL-L | | -| right_margin | CTRL-R | | -| stick_to_left | , | | -| ignore_groups | CTRL-G | `g:easy_align_ignore_groups` | -| ignore_unmatched | CTRL-U | `g:easy_align_ignore_unmatched` | -| indentation | CTRL-I | `g:easy_align_indentation` | -| delimiter_align | CTRL-D | `g:easy_align_delimiter_align` | -| mode_sequence | CTRL-O | | +| Option | Shortcut key | Abbreviated | Global variable | +| ---------------- | --------------- | ----------- | ----------------------------- | +| left_margin | CTRL-L | l[0-9]+ | | +| right_margin | CTRL-R | r[0-9]+ | | +| stick_to_left | , | s[01] | | +| ignore_groups | CTRL-G | ig\[.*\] | `g:easy_align_ignore_groups` | +| ignore_unmatched | CTRL-U | iu[01] | `g:easy_align_ignore_unmatched` | +| indentation | CTRL-I | i[ksdn] | `g:easy_align_indentation` | +| delimiter_align | CTRL-D | d[lrc] | `g:easy_align_delimiter_align` | +| mode_sequence | CTRL-O | m[lrc*]+ | | Ignoring delimiters in comments or strings *g:easy_align_ignore_groups*