mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-12 20:03:49 -05:00
Update documentation
This commit is contained in:
@@ -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 <silent> <Enter> :EasyAlign<cr>
|
||||
vnoremap <silent> <Enter> :EasyAlign<Enter>
|
||||
|
||||
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 } |
|
||||
| <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)
|
||||
-------------------------------------------------------------------------
|
||||
@@ -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.
|
||||
|
||||
- <Enter>
|
||||
- *
|
||||
@@ -152,30 +177,6 @@ key combination.
|
||||
- <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
|
||||
-------------------------------------------------------------------------
|
||||
@@ -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 | <Left>, <Right> | |
|
||||
| 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 | <Left>, <Right> | 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*
|
||||
|
||||
Reference in New Issue
Block a user