From 8951e13cf8f5499d83ba38af80c72e712fdde427 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 17 Sep 2013 23:32:41 +0900 Subject: [PATCH] Update documentation --- README.md | 50 +++++++++++++++++++++++++--------------------- doc/easy_align.txt | 40 ++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 70a40e9..02f8ffe 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,8 @@ Alignment rules for the following delimiters have been defined to meet the most | | | 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. +`g:easy_align_delimiters`, which will be described in +[the later section](https://github.com/junegunn/vim-easy-align#extending-alignment-rules). #### Example command sequences @@ -139,9 +140,9 @@ For example, if you want to align text around all occurrences of numbers: #### Alignment options in interactive mode -While in interactive mode, you can switch some of the alignment options using -special shortcut keys listed below. The meanings of the options will be -described in the following sections. +While in interactive mode, you can set alignment options using special shortcut +keys listed below. The meaning of each option will be described in +[the following sections](https://github.com/junegunn/vim-easy-align#alignment-options). | Key | Option | Values | | -------- | ------------------ | -------------------------------------------------- | @@ -152,8 +153,8 @@ described in the following sections. | `CTRL-U` | `ignore_unmatched` | 0, 1 | | `CTRL-G` | `ignore_groups` | [], ['String'], ['Comment'], ['String', 'Comment'] | | `CTRL-O` | `mode_sequence` | Input string of `/[lrc]+\*{0,2}/` | -| `` | `stick_to_left` | Set stick_to_left and set left_margin to zero | -| `` | `stick_to_left` | Unset stick_to_left and set left_margin to one | +| `` | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }` | +| `` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` | --- @@ -250,20 +251,14 @@ since the same can be easily done using the negative field number: `-=` Alignment options ----------------- -Option values can be 1) specified as global variables, 2) set on each alignment -rule in `g:easy_align_delimiters`, 3) or given to every `:EasyAlign` command. - -Command-line options have the highest precedence, and global variables have the -lowest precedence. - ### List of options | Option | Type | Default | Description | | ------------------ | ------- | --------------------- | ------------------------------------------------------- | -| `left_margin` | number | 0 | Number of spaces to attach before delimiter | -| `left_margin` | string | `''` | String to attach before delimiter | -| `right_margin` | number | 0 | Number of spaces to attach after delimiter | -| `right_margin` | string | `''` | String to attach after delimiter | +| `left_margin` | number | 1 | Number of spaces to attach before delimiter | +| `left_margin` | string | `' '` | String to attach before delimiter | +| `right_margin` | number | 1 | Number of spaces to attach after delimiter | +| `right_margin` | string | `' '` | String to attach after delimiter | | `stick_to_left` | boolean | 0 | Whether to position delimiter on the left-side | | `ignore_groups` | list | ['String', 'Comment'] | Delimiters in these syntax highlight groups are ignored | | `ignore_unmatched` | boolean | 1 | Whether to ignore lines without matching delimiter | @@ -271,14 +266,23 @@ lowest precedence. | `delimiter_align` | string | `r` | Determines how to align delimiters of different lengths | | `mode_sequence` | string | | Alignment modes for multiple occurrences of delimiters | -Some of the options can be specified using corresponding global variables. +There are 4 ways to set alignment options (from lowest precedence to highest): -| Option | Global variable | -| ------------------ | ------------------------------- | -| `ignore_groups` | `g:easy_align_ignore_groups` | -| `ignore_unmatched` | `g:easy_align_ignore_unmatched` | -| `delimiter_align` | `g:easy_align_delimiter_align` | -| `indentation` | `g:easy_align_indentation` | +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 +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` | | ### Ignoring delimiters in comments or strings diff --git a/doc/easy_align.txt b/doc/easy_align.txt index b933b4a..8601402 100644 --- a/doc/easy_align.txt +++ b/doc/easy_align.txt @@ -166,8 +166,8 @@ Available options are as follows. | Atrribute | Type | Default | | ---------------- | ---------------- | ----------------------------- | -| left_margin | number or string | 0 | -| right_margin | number or string | 0 | +| left_margin | number or string | 1 | +| right_margin | number or string | 1 | | stick_to_left | boolean | 0 | | ignore_unmatched | boolean | 1 | | ignore_groups | array | ['String', 'Comment'] | @@ -178,29 +178,23 @@ Available options are as follows. | mode_sequence | string | (Depends on field number and | | | | selected alignment mode) | +There are 4 ways to set alignment options (from lowest precedence to highest): -Some of the options can be specified using 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 +3. Option values can be given as a dictionary argument to :EasyAlign command +4. Option values can be set in interactive mode using special shortcut keys -| Option | Global variable | -| ------------------ | ------------------------------- | -| ignore_groups | `g:easy_align_ignore_groups` | -| ignore_unmatched | `g:easy_align_ignore_unmatched` | -| delimiter_align | `g:easy_align_delimiter_align` | -| indentation | `g:easy_align_indentation` | - - -In interactive mode, you can switch some of the alignment options using special -keys listed below. - -| Key | Option | Values | -| ------ | ---------------- | -------------------------------------------------- | -| CTRL-I | indentation | shallow, deep, none, keep | -| CTRL-L | left_margin | Input number or string | -| CTRL-R | right_margin | Input number or string | -| CTRL-D | delimiter_align | left, center, right | -| CTRL-U | ignore_unmatched | 0, 1 | -| CTRL-G | ignore_groups | [], ['String'], ['Comment'], ['String', 'Comment'] | -| CTRL-O | mode_sequence | Input string of l, r, and c characters | +| 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 | | Ignoring delimiters in comments or strings *g:easy_align_ignore_groups*