mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-17 06:13:41 -05:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9815a55dbc | ||
|
|
12dd631697 | ||
|
|
1cd724dc23 | ||
|
|
14c693dfe5 | ||
|
|
d3f8e64261 | ||
|
|
3b395bd5ba | ||
|
|
05cc60d222 | ||
|
|
4be4101ad5 | ||
|
|
3800a5405c | ||
|
|
2e27fe55ad | ||
|
|
0cb6b98fc1 | ||
|
|
dd98d0a895 | ||
|
|
d1b68f9dd0 | ||
|
|
4fb4c1056c | ||
|
|
7cb559eb70 | ||
|
|
9ebd0e82da | ||
|
|
9e6207246c | ||
|
|
4732f10155 | ||
|
|
cd124c2c0b | ||
|
|
ed65b47f1b | ||
|
|
fac9f4dd75 |
91
DEMO.md
91
DEMO.md
@@ -1,91 +0,0 @@
|
||||
# vim: set buftype=nofile colorcolumn= scrolloff=0 noshowcmd:
|
||||
|
||||
vim-easy-align
|
||||
==============
|
||||
|
||||
Where's Lennon?
|
||||
---------------
|
||||
|
||||
Paul McCartney 1942
|
||||
George Harrison 1943
|
||||
Ringo Starr 1940
|
||||
Pete Best 1941
|
||||
|
||||
|
||||
Formatting table
|
||||
----------------
|
||||
```
|
||||
|
||||
| Option| Type | Default | Description |
|
||||
|--|--|--|--|
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
|queues |Fixnum | 1 | number of concurrent queues |
|
||||
|queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for processing |
|
||||
|batch | Boolean | false | enables batch processing mode |
|
||||
|batch_size | Fixnum | nil | maximum number of items in batch|
|
||||
|logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
```
|
||||
Operators with = sign
|
||||
---------------------
|
||||
```ruby
|
||||
|
||||
a =
|
||||
a = 1
|
||||
bbbb = 2
|
||||
ccccccc = 3
|
||||
ccccccccccccccc
|
||||
ddd = 4
|
||||
eeee === eee = eee = eee=f
|
||||
fff = ggg += gg &&= gg
|
||||
g != hhhhhhhh == 888
|
||||
i := 5
|
||||
i %= 5
|
||||
i *= 5
|
||||
j =~ 5
|
||||
j >= 5
|
||||
aa => 123
|
||||
aa <<= 123
|
||||
aa >>= 123
|
||||
bbb => 123
|
||||
c => 1233123
|
||||
d => 123
|
||||
dddddd &&= 123
|
||||
dddddd ||= 123
|
||||
dddddd /= 123
|
||||
gg <=> ee
|
||||
|
||||
```
|
||||
Formatting YAML (or JSON)
|
||||
-------------------------
|
||||
```yaml
|
||||
|
||||
mysql:
|
||||
# JDBC driver for MySQL database:
|
||||
driver: com.mysql.jdbc.Driver
|
||||
# JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE)
|
||||
url: jdbc:mysql://localhost/test
|
||||
database: test
|
||||
"user:pass":r00t:pa55
|
||||
|
||||
```
|
||||
Using blockwise-visual mode or negative N-th parameter
|
||||
------------------------------------------------------
|
||||
```ruby
|
||||
|
||||
options = { :caching => nil,
|
||||
:versions => 3,
|
||||
"cache=blocks" => false }.merge(options)
|
||||
|
||||
```
|
||||
Commas
|
||||
------
|
||||
|
||||
aaa, bb,c
|
||||
d,eeeeeee
|
||||
fffff, gggggggggg,
|
||||
h, , ii
|
||||
j,,k
|
||||
|
||||
|
||||
111
EXAMPLES.md
111
EXAMPLES.md
@@ -1,18 +1,23 @@
|
||||
vim-easy-align examples
|
||||
=======================
|
||||
easy-align examples
|
||||
===================
|
||||
|
||||
Open this document in your Vim and try it yourself.
|
||||
|
||||
This document assumes that you have defined the following mappings.
|
||||
This document assumes that you have the following mappings in your .vimrc.
|
||||
|
||||
```vim
|
||||
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
|
||||
vmap <Enter> <Plug>(EasyAlign)
|
||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
|
||||
" Start interactive EasyAlign for a motion/text object (e.g. <Leader>aip)
|
||||
nmap <Leader>a <Plug>(EasyAlign)
|
||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
```
|
||||
|
||||
You can use either of the maps. Place the cursor on the paragraph and press
|
||||
|
||||
- `gaip` "(ga) start easy-align on (i)nner (p)aragraph"
|
||||
- or `vipga` "(v)isual-select (i)nner (p)aragraph and (ga) start easy-align"
|
||||
|
||||
To enable syntax highlighting in the code blocks, define and call the following
|
||||
function.
|
||||
|
||||
@@ -37,15 +42,17 @@ Alignment around whitespaces
|
||||
|
||||
You can align text around whitespaces with `<space>` delimiter key.
|
||||
|
||||
Try these commands:
|
||||
Start the interactive mode as described above (`gaip` or `vipga`) and try
|
||||
these commands:
|
||||
|
||||
- `<space>`
|
||||
- `2<space>`
|
||||
- `*<space>`
|
||||
- `-<space>`
|
||||
- `-2<space>`
|
||||
- `<Enter><space>`
|
||||
- `<Enter>2<space>`
|
||||
- `<Enter>*<space>`
|
||||
- `<Enter>-<space>`
|
||||
- `<Enter>-2<space>`
|
||||
- `<Enter><Enter><space>`
|
||||
- `<Enter><Enter>*<space>`
|
||||
- `<Enter><Enter><Enter>*<space>`
|
||||
|
||||
### Example
|
||||
|
||||
@@ -61,12 +68,13 @@ Pete Best 1941
|
||||
Formatting table
|
||||
----------------
|
||||
|
||||
Try these commands:
|
||||
Again, start the interactive mode and try these commands:
|
||||
|
||||
- `*|`
|
||||
- `**|`
|
||||
- `<Enter>*|`
|
||||
- `<Enter>**|`
|
||||
- `<Enter><Enter>*|`
|
||||
- `<Enter><Enter>**|`
|
||||
- `<Enter><Enter><Enter>*|`
|
||||
|
||||
### Example
|
||||
|
||||
@@ -88,15 +96,16 @@ Try these commands:
|
||||
Alignment around =
|
||||
------------------
|
||||
|
||||
The default rule for delimiter key `=` aligns around a whole family of operators
|
||||
containing `=` character.
|
||||
The default rule for delimiter key `=` aligns around a whole family of
|
||||
operators containing `=` character.
|
||||
|
||||
Try these commands:
|
||||
- `<Enter>=`
|
||||
- `<Enter>*=`
|
||||
Try these commands in the interactive mode.
|
||||
|
||||
- `=`
|
||||
- `*=`
|
||||
- `**=`
|
||||
- `<Enter>**=`
|
||||
- `<Enter><Enter>**=`
|
||||
- `<Enter><Enter><Enter>*=`
|
||||
- `<Enter><Enter>*=`
|
||||
|
||||
### Example
|
||||
|
||||
@@ -132,8 +141,8 @@ gg <=> ee
|
||||
Formatting YAML (or JSON)
|
||||
-------------------------
|
||||
|
||||
Try `<Enter>:` here, to align text around only the first occurrences of colons.
|
||||
In this case, you don't want to align around all the colons: `<Enter>*:`.
|
||||
You can use `:`-rule here to align text around only the first occurrences of
|
||||
colons. In this case, you don't want to align around all the colons: `*:`.
|
||||
|
||||
```yaml
|
||||
mysql:
|
||||
@@ -148,7 +157,7 @@ mysql:
|
||||
Formatting multi-line method chaining
|
||||
-------------------------------------
|
||||
|
||||
Try `<Enter>.` or `<Enter>*.` on the following lines.
|
||||
Try `.` or `*.` on the following lines.
|
||||
|
||||
```ruby
|
||||
my_object
|
||||
@@ -174,8 +183,8 @@ Using blockwise-visual mode or negative N-th parameter
|
||||
------------------------------------------------------
|
||||
|
||||
You can try either:
|
||||
- select text around `=>` in blockwise-visual mode (`CTRL-V`) and `<Enter>=`
|
||||
- or `<Enter>-=`
|
||||
- select text around `=>` in blockwise-visual mode (`CTRL-V`) and `ga=`
|
||||
- or `gaip-=`
|
||||
|
||||
```ruby
|
||||
options = { :caching => nil,
|
||||
@@ -186,8 +195,7 @@ options = { :caching => nil,
|
||||
Commas
|
||||
------
|
||||
|
||||
There is also a predefined rule for commas, try `<Enter>*,` on the following
|
||||
lines.
|
||||
There is also a predefined rule for commas, try `*,`.
|
||||
|
||||
```
|
||||
aaa, bb,c
|
||||
@@ -201,7 +209,7 @@ Ignoring delimiters in comments or strings
|
||||
------------------------------------------
|
||||
|
||||
Delimiters highlighted as comments or strings are ignored by default, try
|
||||
`<Enter>*=` on the following lines.
|
||||
`gaip*=` on the following lines.
|
||||
|
||||
```c
|
||||
|
||||
@@ -226,9 +234,9 @@ apple = 1 # comment not aligned
|
||||
banana = 'Gros Michel' # comment 2
|
||||
```
|
||||
|
||||
So, how do we align the trailing comments in the above lines?
|
||||
Simply try `<Enter>-<space>`. The spaces in the comments are ignored, so the
|
||||
trailing comment in each line is considered to be a single chunk.
|
||||
So, how do we align the trailing comments in the above lines? Simply try
|
||||
`-<space>`. The spaces in the comments are ignored, so the trailing comment in
|
||||
each line is considered to be a single chunk.
|
||||
|
||||
But that doesn't work in the following case.
|
||||
|
||||
@@ -253,7 +261,7 @@ let g:easy_align_delimiters['#'] = { 'pattern': '#', 'ignore_groups': ['String']
|
||||
Notice that the rule overrides `ignore_groups` attribute in order *not to ignore*
|
||||
delimiters highlighted as comments.
|
||||
|
||||
Then on `<Enter>#`, we get
|
||||
Then on `#`, we get
|
||||
|
||||
```ruby
|
||||
apple = 1 # comment not aligned
|
||||
@@ -266,13 +274,16 @@ command:
|
||||
|
||||
```vim
|
||||
" Using regular expression /#/
|
||||
" - "is" is fuzzy-matched to "*i*gnore*s*"
|
||||
:EasyAlign/#/{'is':['String']}
|
||||
" - "ig" is a shorthand notation of "ignore_groups"
|
||||
:EasyAlign/#/{'ig':['String']}
|
||||
|
||||
" Or more concisely with the shorthand notation;
|
||||
:EasyAlign/#/ig['String']
|
||||
```
|
||||
|
||||
In this case, the second line is ignored as it doesn't contain a `#`. (The one
|
||||
highlighted as String is ignored.) If you don't want the second line to be
|
||||
ignored, there are three options:
|
||||
In this case, the second line is ignored as it doesn't contain a `#` (The one
|
||||
in `'F#AD'` is ignored as it's highlighted as String). If you don't want the
|
||||
second line to be ignored, there are three options:
|
||||
|
||||
1. Set global `g:easy_align_ignore_unmatched` flag to 0
|
||||
2. Use `:EasyAlign` command with `ignore_unmatched` option
|
||||
@@ -284,11 +295,13 @@ let g:easy_align_ignore_unmatched = 0
|
||||
|
||||
" 2. Using :EasyAlign command with ignore_unmatched option
|
||||
" 2-1. Using predefined rule with delimiter key #
|
||||
" - "iu" is fuzzy-matched to "*i*gnore_*u*nmatched"
|
||||
" - "iu" is expanded to "*i*gnore_*u*nmatched"
|
||||
:EasyAlign#{'iu':0}
|
||||
" or
|
||||
:EasyAlign#iu0
|
||||
|
||||
" 2-2. Using regular expression /#/
|
||||
:EasyAlign/#/{'is':['String'],'iu':0}
|
||||
:EasyAlign/#/ig['String']iu0
|
||||
|
||||
" 3. Update the alignment rule with ignore_unmatched option
|
||||
let g:easy_align_delimiters['#'] = {
|
||||
@@ -315,7 +328,7 @@ static double pi = 3.14;
|
||||
```
|
||||
|
||||
We can align these lines with the predefined `=` rule. Select the lines and
|
||||
press `<Enter>=`
|
||||
press `ga=`
|
||||
|
||||
```c
|
||||
const char* str = "Hello";
|
||||
@@ -325,7 +338,7 @@ static double pi = 3.14;
|
||||
|
||||
Not bad. However, the names of the variables, `str`, `count`, and `pi` are not
|
||||
aligned with each other. Can we do better? We can clearly see that simple
|
||||
`<Enter><space>` won't properly align those names.
|
||||
`<space>`-rule won't properly align those names.
|
||||
So let's define an alignment rule than can handle this case.
|
||||
|
||||
```vim
|
||||
@@ -336,7 +349,7 @@ let g:easy_align_delimiters['d'] = {
|
||||
```
|
||||
|
||||
This new rule aligns text around spaces that are *not* preceded by
|
||||
`const` or `static`. Let's try it with `<Enter>d`.
|
||||
`const` or `static`. Let's select the lines and try `gad`.
|
||||
|
||||
```c
|
||||
const char* str = "Hello";
|
||||
@@ -345,7 +358,7 @@ static double pi = 3.14;
|
||||
```
|
||||
|
||||
Okay, the names are now aligned. We select the lines again with `gv`, and then
|
||||
press `<Enter>=` to finish our alignment.
|
||||
press `ga=` to finish our alignment.
|
||||
|
||||
```c
|
||||
const char* str = "Hello";
|
||||
@@ -376,14 +389,14 @@ So what do we do? Let's try to improve our alignment rule.
|
||||
|
||||
```vim
|
||||
let g:easy_align_delimiters['d'] = {
|
||||
\ 'pattern': ' \(\S\+\s*[;=]\)\@=',
|
||||
\ 'pattern': ' \ze\S\+\s*[;=]',
|
||||
\ 'left_margin': 0, 'right_margin': 0
|
||||
\ }
|
||||
```
|
||||
|
||||
Now the new rule has changed to align text around spaces that are followed
|
||||
by some non-whitespace characters and then an equals sign or a semi-colon.
|
||||
Try `<Enter>d`
|
||||
Try `vipgad`
|
||||
|
||||
```c
|
||||
const char* str = "Hello";
|
||||
@@ -392,7 +405,7 @@ static double pi = 3.14;
|
||||
static std::map<std::string, float>* scores = pointer;
|
||||
```
|
||||
|
||||
We're right on track, now press `gv<Enter>=` and voila!
|
||||
We're right on track, now press `gvga=` and voila!
|
||||
|
||||
```c
|
||||
const char* str = "Hello";
|
||||
|
||||
308
README.md
308
README.md
@@ -3,29 +3,12 @@ vim-easy-align )
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Easy to use
|
||||
- Comes with a predefined set of alignment rules
|
||||
- Provides a fast and intuitive interface
|
||||
- Extensible
|
||||
- You can define your own rules
|
||||
- Supports arbitrary regular expressions
|
||||
- Optimized for code editing
|
||||
- Takes advantage of syntax highlighting feature to avoid unwanted alignments
|
||||

|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
User your favorite plugin manager.
|
||||
Use your favorite plugin manager.
|
||||
|
||||
Using [vim-plug](https://github.com/junegunn/vim-plug):
|
||||
|
||||
@@ -33,20 +16,20 @@ Using [vim-plug](https://github.com/junegunn/vim-plug):
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
```
|
||||
|
||||
TL;DR - One-minute guide
|
||||
------------------------
|
||||
Quick start guide
|
||||
-----------------
|
||||
|
||||
Add the following mappings to your .vimrc.
|
||||
|
||||
```vim
|
||||
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
|
||||
vmap <Enter> <Plug>(EasyAlign)
|
||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
|
||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
```
|
||||
|
||||
And with the following lines of text,
|
||||
Then with the following lines of text,
|
||||
|
||||
```
|
||||
apple =red
|
||||
@@ -56,80 +39,110 @@ sky-= blue
|
||||
|
||||
try these commands:
|
||||
|
||||
- `vip<Enter>=`
|
||||
- `vipga=`
|
||||
- `v`isual-select `i`nner `p`aragraph
|
||||
- Start EasyAlign command (`<Enter>`)
|
||||
- Start EasyAlign command (`ga`)
|
||||
- Align around `=`
|
||||
- `gaip=`
|
||||
- Start EasyAlign command (`ga`) for `i`nner `p`aragraph
|
||||
- Align around `=`
|
||||
|
||||
Notice that the commands are repeatable with `.` key if you have installed
|
||||
[repeat.vim](https://github.com/tpope/vim-repeat). Install
|
||||
[visualrepeat](https://github.com/vim-scripts/visualrepeat) as well if you want
|
||||
to repeat in visual mode.
|
||||
Demo
|
||||
----
|
||||
|
||||
*Click on each image to see from the beginning.*
|
||||
|
||||
### Using predefined alignment rules
|
||||
|
||||
An *alignment rule* is a predefined set of options for common alignment tasks,
|
||||
which is identified by a single character, such as `<Space>`, `=`, `:`, `.`,
|
||||
`|`, `&`, `#`, and `,`.
|
||||
|
||||
#### `=`
|
||||
|
||||

|
||||
|
||||
- `=` Around the 1st occurrences
|
||||
- `2=` Around the 2nd occurrences
|
||||
- `*=` Around all occurrences
|
||||
- `**=` Left/Right alternating alignment around all occurrences
|
||||
- `<Enter>` Switching between left/right/center alignment modes
|
||||
|
||||
#### `<Space>`
|
||||
|
||||

|
||||
|
||||
- `<Space>` Around the 1st occurrences of whitespaces
|
||||
- `2<Space>` Around the 2nd occurrences
|
||||
- `-<Space>` Around the last occurrences
|
||||
- `<Enter><Enter>2<Space>` Center-alignment around the 2nd occurrences
|
||||
|
||||
#### `,`
|
||||
|
||||

|
||||
|
||||
- The predefined comma-rule places a comma right next to the preceding token
|
||||
without margin (`{'stick_to_left': 1, 'left_margin': 0}`)
|
||||
- You can change it with `<Right>` arrow
|
||||
|
||||
### Using regular expression
|
||||
|
||||

|
||||
|
||||
You can use an arbitrary regular expression by
|
||||
- pressing `<Ctrl-X>` in interactive mode
|
||||
- or using `:EasyAlign /REGEX/` command in visual mode or in normal mode with
|
||||
a range (e.g. `:%`)
|
||||
|
||||
### Different ways to start
|
||||
|
||||

|
||||
|
||||
This demo shows how you can start interactive mode with visual selection or use
|
||||
non-interactive `:EasyAlign` command.
|
||||
|
||||
### Aligning table cells
|
||||
|
||||

|
||||
|
||||
Check out various alignment options and "live interactive mode".
|
||||
|
||||
### Syntax-aware alignment
|
||||
|
||||

|
||||
|
||||
Delimiters in strings and comments are ignored by default.
|
||||
|
||||
### Using blockwise-visual mode
|
||||
|
||||

|
||||
|
||||
You can limit the scope with blockwise-visual mode.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
### Concept of _alignment rule_
|
||||
### Flow of execution
|
||||
|
||||
Though easy-align can align lines of text around any delimiter, it provides
|
||||
shortcuts for the most common use cases with the concept of "_alignment rule_".
|
||||
|
||||
An *alignment rule* is a predefined set of options for common alignment tasks,
|
||||
which is identified by a single character, *DELIMITER KEY*, such as `<Space>`,
|
||||
`=`, `:`, `.`, `|`, `&`, `#`, and `,`.
|
||||
|
||||
Think of it as a shortcut. Instead of writing regular expression and setting
|
||||
several options, you can just type in a single character.
|
||||
|
||||
### Execution models
|
||||
<img src="https://raw.githubusercontent.com/junegunn/i/master/easy-align/usage.png" width="469">
|
||||
|
||||
There are two ways to use easy-align.
|
||||
|
||||
#### 1. Using `<Plug>` mappings
|
||||
#### 1. `<Plug>` mappings (interactive mode)
|
||||
|
||||
The recommended method is to use `<Plug>` mappings as described earlier.
|
||||
|
||||
| Mapping | Mode | Description |
|
||||
| ----------------------- | ------ | ---------------------------------------------------- |
|
||||
| `<Plug>(EasyAlign)` | normal | Start interactive mode for a motion/text object |
|
||||
| `<Plug>(EasyAlign)` | visual | Start interactive mode for the selection |
|
||||
| `<Plug>(LiveEasyAlign)` | normal | Start live-interactive mode for a motion/text object |
|
||||
| `<Plug>(LiveEasyAlign)` | visual | Start live-interactive mode for the selection |
|
||||
|
||||
#### 2. Using `:EasyAlign` command
|
||||
|
||||
If you prefer command-line or do not want to start interactive mode, you can use
|
||||
`:EasyAlign` command instead.
|
||||
|
||||
| Mode | Command |
|
||||
| ------------------------------------------ | ------------------------------------------------ |
|
||||
| Interactive mode | `:EasyAlign[!] [OPTIONS]` |
|
||||
| Live interactive mode | `:LiveEasyAlign[!] [...]` |
|
||||
| Non-interactive mode (predefined rules) | `:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]` |
|
||||
| Non-interactive mode (regular expressions) | `:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]` |
|
||||
|
||||
### Interactive mode
|
||||
|
||||
The following sections will assume that you have `<Plug>(EasyAlign)` mappings in
|
||||
your .vimrc as below:
|
||||
The recommended method is to use `<Plug>(EasyAlign)` mapping in normal and
|
||||
visual mode. They are usually mapped to `ga`, but you can choose any key
|
||||
sequences.
|
||||
|
||||
```vim
|
||||
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
|
||||
vmap <Enter> <Plug>(EasyAlign)
|
||||
|
||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
```
|
||||
|
||||
With these mappings, you can align text with only a few keystrokes.
|
||||
|
||||
1. `<Enter>` key in visual mode, or `ga` followed by a motion or a text
|
||||
1. `ga` key in visual mode, or `ga` followed by a motion or a text
|
||||
object to start interactive mode
|
||||
1. Optional: Enter keys to select alignment mode (left, right, or center)
|
||||
1. Optional: N-th delimiter (default: 1)
|
||||
1. (Optional) Enter keys to cycle between alignment mode (left, right, or center)
|
||||
1. (Optional) N-th delimiter (default: 1)
|
||||
- `1` Around the 1st occurrences of delimiters
|
||||
- `2` Around the 2nd occurrences of delimiters
|
||||
- ...
|
||||
@@ -138,58 +151,72 @@ With these mappings, you can align text with only a few keystrokes.
|
||||
- `-` Around the last occurrences of delimiters (`-1`)
|
||||
- `-2` Around the second to last occurrences of delimiters
|
||||
- ...
|
||||
1. Delimiter key (a single keystroke; `<Space>`, `=`, `:`, `.`, `|`, `&`, `#`, `,`)
|
||||
1. Delimiter key (a single keystroke; `<Space>`, `=`, `:`, `.`, `|`, `&`, `#`, `,`) or an arbitrary regular expression followed by `<CTRL-X>`
|
||||
|
||||
#### Predefined alignment rules
|
||||
#### 2. Using `:EasyAlign` command
|
||||
|
||||
| Delimiter key | Description/Use cases |
|
||||
| ------------- | -------------------------------------------------------------------- |
|
||||
| `<Space>` | General alignment around whitespaces |
|
||||
| `=` | Operators containing equals sign (`=`, `==,` `!=`, `+=`, `&&=`, ...) |
|
||||
| `:` | Suitable for formatting JSON or YAML |
|
||||
| `.` | Multi-line method chaining |
|
||||
| `,` | Multi-line method arguments |
|
||||
| `&` | LaTeX tables (matches `&` and `\\`) |
|
||||
| `#` | Ruby/Python comments |
|
||||
| `<Bar>` | Table markdown |
|
||||
If you prefer command-line, use `:EasyAlign` command instead.
|
||||
|
||||
You can override these default rules or define your own rules with
|
||||
`g:easy_align_delimiters`, which will be described in
|
||||
[the later section](https://github.com/junegunn/vim-easy-align#extending-alignment-rules).
|
||||
```vim
|
||||
" Using predefined rules
|
||||
:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]
|
||||
|
||||
#### Examples
|
||||
" Using regular expression
|
||||
:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]
|
||||
```
|
||||
|
||||
| With visual map | Description | Equivalent command |
|
||||
| ------------------- | ---------------------------------- | --------------------- |
|
||||
| `<Enter><Space>` | Around 1st whitespaces | `:'<,'>EasyAlign\ ` |
|
||||
| `<Enter>2<Space>` | Around 2nd whitespaces | `:'<,'>EasyAlign2\ ` |
|
||||
| `<Enter>-<Space>` | Around the last whitespaces | `:'<,'>EasyAlign-\ ` |
|
||||
| `<Enter>-2<Space>` | Around the 2nd to last whitespaces | `:'<,'>EasyAlign-2\ ` |
|
||||
| `<Enter>:` | Around 1st colon (`key: value`) | `:'<,'>EasyAlign:` |
|
||||
| `<Enter><Right>:` | Around 1st colon (`key : value`) | `:'<,'>EasyAlign:<l1` |
|
||||
| `<Enter>=` | Around 1st operators with = | `:'<,'>EasyAlign=` |
|
||||
| `<Enter>3=` | Around 3rd operators with = | `:'<,'>EasyAlign3=` |
|
||||
| `<Enter>*=` | Around all operators with = | `:'<,'>EasyAlign*=` |
|
||||
| `<Enter>**=` | Left-right alternating around = | `:'<,'>EasyAlign**=` |
|
||||
| `<Enter><Enter>=` | Right alignment around 1st = | `:'<,'>EasyAlign!=` |
|
||||
| `<Enter><Enter>**=` | Right-left alternating around = | `:'<,'>EasyAlign!**=` |
|
||||
### Regular expression vs. predefined rules
|
||||
|
||||
#### Using regular expressions
|
||||
You can use regular expressions but it's usually much easier to use predefined
|
||||
alignment rules that you can trigger with a single keystroke.
|
||||
|
||||
Instead of finishing the command with a predefined delimiter key, you can type
|
||||
in a regular expression after `<CTRL-/>` or `<CTRL-X>` key.
|
||||
For example, if you want to align text around all occurrences of numbers:
|
||||
| Key | Description/Use cases |
|
||||
| --------- | -------------------------------------------------------------------- |
|
||||
| `<Space>` | General alignment around whitespaces |
|
||||
| `=` | Operators containing equals sign (`=`, `==,` `!=`, `+=`, `&&=`, ...) |
|
||||
| `:` | Suitable for formatting JSON or YAML |
|
||||
| `.` | Multi-line method chaining |
|
||||
| `,` | Multi-line method arguments |
|
||||
| `&` | LaTeX tables (matches `&` and `\\`) |
|
||||
| `#` | Ruby/Python comments |
|
||||
| `"` | Vim comments |
|
||||
| `<Bar>` | Table markdown |
|
||||
|
||||
- `<Enter>`
|
||||
- `*`
|
||||
- `<CTRL-X>`
|
||||
- `[0-9]\+`
|
||||
You can also define your own rules with `g:easy_align_delimiters` which will
|
||||
be described in [the later section](#extending-alignment-rules).
|
||||
|
||||
----
|
||||
|
||||
### Interactive mode
|
||||
|
||||
Interactive mode is started either with `<Plug>(EasyAlign)` mapping or with
|
||||
`:EasyAlign` command with no argument.
|
||||
|
||||
#### Examples using predefined rules
|
||||
|
||||
| Keystrokes | Description | Equivalent command |
|
||||
| ------------ | ---------------------------------- | --------------------- |
|
||||
| `<Space>` | Around 1st whitespaces | `:'<,'>EasyAlign\ ` |
|
||||
| `2<Space>` | Around 2nd whitespaces | `:'<,'>EasyAlign2\ ` |
|
||||
| `-<Space>` | Around the last whitespaces | `:'<,'>EasyAlign-\ ` |
|
||||
| `-2<Space>` | Around the 2nd to last whitespaces | `:'<,'>EasyAlign-2\ ` |
|
||||
| `:` | Around 1st colon (`key: value`) | `:'<,'>EasyAlign:` |
|
||||
| `<Right>:` | Around 1st colon (`key : value`) | `:'<,'>EasyAlign:>l1` |
|
||||
| `=` | Around 1st operators with = | `:'<,'>EasyAlign=` |
|
||||
| `3=` | Around 3rd operators with = | `:'<,'>EasyAlign3=` |
|
||||
| `*=` | Around all operators with = | `:'<,'>EasyAlign*=` |
|
||||
| `**=` | Left-right alternating around = | `:'<,'>EasyAlign**=` |
|
||||
| `<Enter>=` | Right alignment around 1st = | `:'<,'>EasyAlign!=` |
|
||||
| `<Enter>**=` | Right-left alternating around = | `:'<,'>EasyAlign!**=` |
|
||||
|
||||
Instead of finishing the alignment with a delimiter key, you can type in
|
||||
a regular expression if you press `<CTRL-/>` or `<CTRL-X>`.
|
||||
|
||||
#### Alignment options in interactive mode
|
||||
|
||||
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).
|
||||
[the following sections](#alignment-options).
|
||||
|
||||
| Key | Option | Values |
|
||||
| --------- | ------------------ | -------------------------------------------------- |
|
||||
@@ -199,13 +226,13 @@ keys listed below. The meaning of each option will be described in
|
||||
| `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-G` | `ignore_groups` | `[]`, `['String']`, `['Comment']`, `['String', 'Comment']` |
|
||||
| `CTRL-A` | `align` | Input string (`/[lrc]+\*{0,2}/`) |
|
||||
| `<Left>` | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }` |
|
||||
| `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` |
|
||||
| `<Down>` | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }` |
|
||||
|
||||
### Live interactive mode
|
||||
#### Live interactive mode
|
||||
|
||||
If you're performing a complex alignment where multiple options should be
|
||||
carefully adjusted, try "live interactive mode" where you can preview the result
|
||||
@@ -215,15 +242,15 @@ Live interactive mode can be started with either `<Plug>(LiveEasyAlign)` map
|
||||
or `:LiveEasyAlign` command. Or you can switch to live interactive mode while
|
||||
in ordinary interactive mode by pressing `<CTRL-P>`. (P for Preview)
|
||||
|
||||
In live interactive mode, you have to type in the same delimiter (or `CTRL-X` on
|
||||
regular expression) again to finalize the alignment. This allows you to preview
|
||||
the result of the alignment and freely change the delimiter using backspace key
|
||||
without leaving the interactive mode.
|
||||
In live interactive mode, you have to type in the same delimiter (or
|
||||
`<CTRL-X>` on regular expression) again to finalize the alignment. This allows
|
||||
you to preview the result of the alignment and freely change the delimiter
|
||||
using backspace key without leaving the interactive mode.
|
||||
|
||||
### Non-interactive mode
|
||||
### :EasyAlign command
|
||||
|
||||
Instead of starting interactive mode, you can use declarative, non-interactive
|
||||
`:EasyAlign` command.
|
||||
Instead of starting interactive mode, you can use non-interactive `:EasyAlign`
|
||||
command.
|
||||
|
||||
```vim
|
||||
" Using predefined alignment rules
|
||||
@@ -242,8 +269,7 @@ Instead of starting interactive mode, you can use declarative, non-interactive
|
||||
```
|
||||
|
||||
A command can end with alignment options, [each of which will be discussed in
|
||||
detail later](https://github.com/junegunn/vim-easy-align#alignment-options),
|
||||
in Vim dictionary format.
|
||||
detail later](#alignment-options), in Vim dictionary format.
|
||||
|
||||
- `:EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'left_margin': 0 }`
|
||||
|
||||
@@ -254,11 +280,11 @@ left. So we get:
|
||||
apple;: banana:: cake
|
||||
data;; exchange:; format
|
||||
|
||||
Option names are fuzzy-matched, so you can write as follows:
|
||||
You don't have to write complete names as long as they're distinguishable.
|
||||
|
||||
- `:EasyAlign * /[:;]\+/ { 'stl': 1, 'l': 0 }`
|
||||
|
||||
You can even omit spaces between the arguments, so concisely (or cryptically):
|
||||
You can even omit spaces between the arguments.
|
||||
|
||||
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
|
||||
|
||||
@@ -281,15 +307,6 @@ The following table summarizes the shorthand notation.
|
||||
| `delimiter_align` | `d[lrc]` |
|
||||
| `indentation` | `i[ksdn]` |
|
||||
|
||||
For your information, the same operation can be done in interactive mode as
|
||||
follows:
|
||||
|
||||
- `<Enter>`
|
||||
- `*`
|
||||
- `<Left>`
|
||||
- `<CTRL-X>`
|
||||
- `[:;]\+`
|
||||
|
||||
### Partial alignment in blockwise-visual mode
|
||||
|
||||
In blockwise-visual mode (`CTRL-V`), EasyAlign command aligns only the selected
|
||||
@@ -389,7 +406,7 @@ highlighted as code comments or strings are ignored.
|
||||
```vim
|
||||
" Default:
|
||||
" If a delimiter is in a highlight group whose name matches
|
||||
" any of the followings, it will be ignored.
|
||||
" any of the following regular expressions, it will be ignored.
|
||||
let g:easy_align_ignore_groups = ['Comment', 'String']
|
||||
```
|
||||
|
||||
@@ -446,6 +463,19 @@ If a pattern in `ignore_groups` is prepended by a `!`, it will have the opposite
|
||||
meaning. For instance, if `ignore_groups` is given as `['!Comment']`, delimiters
|
||||
that are *not* highlighted as Comment will be ignored during the alignment.
|
||||
|
||||
To make `ignore_groups` work, and to debug the related issues, it is useful to
|
||||
know which highlight group a certain location in a file belongs to. A special
|
||||
function exists for this purpose, returning exactly the name of the highlight
|
||||
group that is used by the easy align plugin.
|
||||
|
||||
```vim
|
||||
" Highlight group name of the cursor position
|
||||
echo easy_align#get_highlight_group_name()
|
||||
|
||||
" Highlight group name of the line 10, column 20
|
||||
echo easy_align#get_highlight_group_name(10, 20)
|
||||
```
|
||||
|
||||
### Ignoring unmatched lines
|
||||
|
||||
`ignore_unmatched` option determines how EasyAlign command processes lines that
|
||||
|
||||
@@ -38,6 +38,7 @@ let s:easy_align_delimiters_default = {
|
||||
\ '|': { 'pattern': '|', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 },
|
||||
\ '.': { 'pattern': '\.', 'left_margin': 0, 'right_margin': 0, 'stick_to_left': 0 },
|
||||
\ '#': { 'pattern': '#\+', 'delimiter_align': 'l', 'ignore_groups': ['!Comment'] },
|
||||
\ '"': { 'pattern': '"\+', 'delimiter_align': 'l', 'ignore_groups': ['!Comment'] },
|
||||
\ '&': { 'pattern': '\\\@<!&\|\\\\',
|
||||
\ 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 },
|
||||
\ '{': { 'pattern': '(\@<!{',
|
||||
@@ -88,9 +89,30 @@ function! s:floor2(v)
|
||||
return a:v % 2 == 0 ? a:v : a:v - 1
|
||||
endfunction
|
||||
|
||||
function! s:get_highlight_group_name(line, col)
|
||||
let hl = synIDattr(synID(a:line, a:col, 0), 'name')
|
||||
|
||||
if hl == '' && has('nvim-0.9.0')
|
||||
let insp = luaeval('vim.inspect_pos and vim.inspect_pos( nil, ' .. (a:line-1) .. ', ' .. (a:col-1) .. ' ) or { treesitter = {} }')
|
||||
if !empty(insp.treesitter)
|
||||
let hl = insp.treesitter[0].hl_group_link
|
||||
endif
|
||||
endif
|
||||
|
||||
" and, finally
|
||||
return hl
|
||||
endfunction
|
||||
|
||||
function! easy_align#get_highlight_group_name(...)
|
||||
let l = get(a:, 1, line('.'))
|
||||
let c = get(a:, 2, col('.'))
|
||||
let hl = s:get_highlight_group_name(l, c)
|
||||
return { 'line': l, 'column': c, 'group': hl }
|
||||
endfunction
|
||||
|
||||
function! s:highlighted_as(line, col, groups)
|
||||
if empty(a:groups) | return 0 | endif
|
||||
let hl = synIDattr(synID(a:line, a:col, 0), 'name')
|
||||
let hl = s:get_highlight_group_name(a:line, a:col)
|
||||
for grp in a:groups
|
||||
if grp[0] == '!'
|
||||
if hl !~# grp[1:-1]
|
||||
@@ -657,7 +679,11 @@ function! s:interactive(range, modes, n, d, opts, rules, vis, bvis)
|
||||
let check = 0
|
||||
let warn = ''
|
||||
|
||||
let c = getchar()
|
||||
try
|
||||
let c = getchar()
|
||||
catch /^Vim:Interrupt$/
|
||||
let c = 27
|
||||
endtry
|
||||
let ch = nr2char(c)
|
||||
if c == 3 || c == 27 " CTRL-C / ESC
|
||||
if undo
|
||||
@@ -824,10 +850,11 @@ function! s:valid_regexp(regexp)
|
||||
endfunction
|
||||
|
||||
function! s:test_regexp(regexp)
|
||||
if !s:valid_regexp(a:regexp)
|
||||
call s:exit('Invalid regular expression: '. a:regexp)
|
||||
let regexp = empty(a:regexp) ? @/ : a:regexp
|
||||
if !s:valid_regexp(regexp)
|
||||
call s:exit('Invalid regular expression: '. regexp)
|
||||
endif
|
||||
return a:regexp
|
||||
return regexp
|
||||
endfunction
|
||||
|
||||
let s:shorthand_regex =
|
||||
@@ -1044,7 +1071,7 @@ function! s:build_mode_sequence(expr, recur)
|
||||
endfunction
|
||||
|
||||
function! s:process(range, mode, n, ch, opts, regexp, rules, bvis)
|
||||
let [nth, recur] = s:parse_nth(a:n)
|
||||
let [nth, recur] = s:parse_nth((empty(a:n) && exists('g:easy_align_nth')) ? g:easy_align_nth : a:n)
|
||||
let dict = s:build_dict(a:rules, a:ch, a:regexp, a:opts)
|
||||
let [mode_sequence, recur] = s:build_mode_sequence(
|
||||
\ get(dict, 'align', recur == 2 ? s:alternating_modes(a:mode) : a:mode),
|
||||
@@ -1082,10 +1109,12 @@ endfunction
|
||||
|
||||
function! s:align(bang, live, visualmode, first_line, last_line, expr)
|
||||
" Heuristically determine if the user was in visual mode
|
||||
if empty(a:visualmode)
|
||||
if a:visualmode == 'command'
|
||||
let vis = a:first_line == line("'<") && a:last_line == line("'>")
|
||||
let bvis = vis && visualmode() == "\<C-V>"
|
||||
" Visual-mode explicitly given
|
||||
elseif empty(a:visualmode)
|
||||
let vis = 0
|
||||
let bvis = 0
|
||||
else
|
||||
let vis = 1
|
||||
let bvis = a:visualmode == "\<C-V>"
|
||||
@@ -1125,10 +1154,17 @@ endfunction
|
||||
function! easy_align#align(bang, live, visualmode, expr) range
|
||||
try
|
||||
call s:align(a:bang, a:live, a:visualmode, a:firstline, a:lastline, a:expr)
|
||||
catch 'exit'
|
||||
catch /^\%(Vim:Interrupt\|exit\)$/
|
||||
if empty(a:visualmode)
|
||||
echon "\r"
|
||||
echon "\r"
|
||||
else
|
||||
normal! gv
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: set et sw=2 :
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
easy-align.txt easy-align Last change: December 14 2014
|
||||
*easy-align.txt* easy-align Last change: December 14 2014
|
||||
EASY-ALIGN - TABLE OF CONTENTS *easyalign* *easy-align* *easy-align-toc*
|
||||
==============================================================================
|
||||
|
||||
@@ -77,7 +77,7 @@ FEATURES *easy-align-features*
|
||||
INSTALLATION *easy-align-installation*
|
||||
==============================================================================
|
||||
|
||||
User your favorite plugin manager.
|
||||
Use your favorite plugin manager.
|
||||
|
||||
Using {vim-plug}{2}:
|
||||
>
|
||||
@@ -234,6 +234,7 @@ Predefined alignment rules~
|
||||
`,` | Multi-line method arguments
|
||||
`&` | LaTeX tables (matches `&` and `\\` )
|
||||
`#` | Ruby/Python comments
|
||||
`"` | Vim comments
|
||||
<Bar> | Table markdown
|
||||
--------------+--------------------------------------------------------------------
|
||||
|
||||
@@ -516,7 +517,7 @@ highlighted as code comments or strings are ignored.
|
||||
>
|
||||
" Default:
|
||||
" If a delimiter is in a highlight group whose name matches
|
||||
" any of the followings, it will be ignored.
|
||||
" any of the following regular expressions, it will be ignored.
|
||||
let g:easy_align_ignore_groups = ['Comment', 'String']
|
||||
<
|
||||
For example, the following paragraph
|
||||
@@ -566,6 +567,17 @@ opposite meaning. For instance, if `ignore_groups` is given as `['!Comment']`,
|
||||
delimiters that are not highlighted as Comment will be ignored during the
|
||||
alignment.
|
||||
|
||||
To make `ignore_groups` work, and to debug the related issues, it is useful to
|
||||
know which highlight group a certain location in a file belongs to. A special
|
||||
function exists for this purpose, returning exactly the name of the highlight
|
||||
group that is used by the easy align plugin.
|
||||
>
|
||||
" Highlight group name of the cursor position
|
||||
echo easy_align#get_highlight_group_name()
|
||||
|
||||
" Highlight group name of the line 10, column 20
|
||||
echo easy_align#get_highlight_group_name(10, 20)
|
||||
<
|
||||
|
||||
< Ignoring unmatched lines >__________________________________________________~
|
||||
*easy-align-ignoring-unmatched-lines*
|
||||
|
||||
@@ -26,8 +26,8 @@ if exists("g:loaded_easy_align_plugin")
|
||||
endif
|
||||
let g:loaded_easy_align_plugin = 1
|
||||
|
||||
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 0, '', <q-args>)
|
||||
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 1, '', <q-args>)
|
||||
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align(<bang>0, 0, 'command', <q-args>)
|
||||
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align(<bang>0, 1, 'command', <q-args>)
|
||||
|
||||
let s:last_command = 'EasyAlign'
|
||||
|
||||
@@ -99,7 +99,7 @@ function! s:generic_easy_align_op(type, vmode, live)
|
||||
if get(g:, 'easy_align_need_repeat', 0)
|
||||
execute range . g:easy_align_last_command
|
||||
else
|
||||
execute range . "call easy_align#align('<bang>' == '!', a:live, vmode, '')"
|
||||
execute range . "call easy_align#align(0, a:live, vmode, '')"
|
||||
end
|
||||
call s:set_repeat()
|
||||
finally
|
||||
@@ -140,3 +140,4 @@ vnoremap <silent> <Plug>(EasyAlignRepeat) :<C-U>call <SID>repeat_in_visual()<Ent
|
||||
" Backward-compatibility (deprecated)
|
||||
nnoremap <silent> <Plug>(EasyAlignOperator) :set opfunc=<SID>easy_align_op<Enter>g@
|
||||
|
||||
" vim: set et sw=2 :
|
||||
|
||||
@@ -105,6 +105,14 @@ Expect:
|
||||
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e
|
||||
da><ta><;;><ex><ch><an><ge><:;><::><fo> <rm><at
|
||||
|
||||
Execute (Use current search pattern as delimiter if empty regular expression is given):
|
||||
/an
|
||||
%EasyAlign*//
|
||||
|
||||
Expect:
|
||||
apple;:;;b an an a::cake
|
||||
data;;exch an ge:;::format
|
||||
|
||||
Given javascript (json):
|
||||
var jdbc = {
|
||||
// JDBC driver for MySQL database:
|
||||
|
||||
@@ -247,3 +247,17 @@ Expect:
|
||||
servaddr.sin_port = htons(SERV_PORT);
|
||||
|
||||
Include: include/teardown.vader
|
||||
|
||||
Given:
|
||||
hello = world bye all
|
||||
hello world = bye all
|
||||
hello world = foo all
|
||||
|
||||
Do (#105: Incorrectly detection of blockwise visual mode):
|
||||
\<c-v>jj\<esc>
|
||||
\<Space>Aip=
|
||||
|
||||
Expect:
|
||||
hello = world bye all
|
||||
hello world = bye all
|
||||
hello world = foo all
|
||||
|
||||
@@ -581,6 +581,120 @@ Do:
|
||||
Execute (g:easy_align_last_command should not be set if interrupted):
|
||||
Assert !exists('g:easy_align_last_command')
|
||||
|
||||
Do (g:easy_align_nth is not set (work with default value 1)):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option| Type | Default | Description |
|
||||
| --|--|--|--|
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
| queues |Fixnum | 1 | number of concurrent queues |
|
||||
| queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
| batch | Boolean | false | enables batch processing mode |
|
||||
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
| logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (set g:easy_align_nth):
|
||||
let g:easy_align_nth = '2'
|
||||
|
||||
Do (g:easy_align_nth is set as 2):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option | Type | Default | Description |
|
||||
|-- | --|--|--|
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
|queues | Fixnum | 1 | number of concurrent queues |
|
||||
|queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
|batch | Boolean | false | enables batch processing mode |
|
||||
|batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
|logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (unset g:easy_align_nth):
|
||||
unlet g:easy_align_nth
|
||||
|
||||
Execute (set g:easy_align_nth):
|
||||
let g:easy_align_nth = '*'
|
||||
|
||||
Do (g:easy_align_nth is set as *):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option | Type | Default | Description |
|
||||
| -- | -- | -- | -- |
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
| queues | Fixnum | 1 | number of concurrent queues |
|
||||
| queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
| batch | Boolean | false | enables batch processing mode |
|
||||
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
| logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (unset g:easy_align_nth):
|
||||
unlet g:easy_align_nth
|
||||
|
||||
Execute (set g:easy_align_nth):
|
||||
let g:easy_align_nth = '**'
|
||||
|
||||
Do (g:easy_align_nth is set as **):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option | Type | Default | Description |
|
||||
| -- | -- | -- | -- |
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
| queues | Fixnum | 1 | number of concurrent queues |
|
||||
| queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
| batch | Boolean | false | enables batch processing mode |
|
||||
| batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
| logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (unset g:easy_align_nth):
|
||||
unlet g:easy_align_nth
|
||||
|
||||
Execute (set g:easy_align_nth):
|
||||
let g:easy_align_nth = '-'
|
||||
|
||||
Do (g:easy_align_nth is set as -):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option| Type | Default | Description |
|
||||
|--|--|--|-- |
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
|queues |Fixnum | 1 | number of concurrent queues |
|
||||
|queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
|batch | Boolean | false | enables batch processing mode |
|
||||
|batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
|logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (unset g:easy_align_nth):
|
||||
unlet g:easy_align_nth
|
||||
|
||||
Execute (set g:easy_align_nth):
|
||||
let g:easy_align_nth = '-2'
|
||||
|
||||
Do (g:easy_align_nth is set as -2):
|
||||
vip\<Enter>|
|
||||
|
||||
Expect:
|
||||
| Option| Type | Default | Description |
|
||||
|--|--|-- | --|
|
||||
| threads | Fixnum | 1 | number of threads in the thread pool |
|
||||
|queues |Fixnum | 1 | number of concurrent queues |
|
||||
|queue_size | Fixnum | 1000 | size of each queue |
|
||||
| interval | Numeric | 0 | dispatcher interval for batch processing |
|
||||
|batch | Boolean | false | enables batch processing mode |
|
||||
|batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|
||||
|logger | Logger | nil | logger instance for debug logs |
|
||||
|
||||
Execute (unset g:easy_align_nth):
|
||||
unlet g:easy_align_nth
|
||||
|
||||
###########################################################
|
||||
|
||||
Given (comma-separated items):
|
||||
@@ -1572,6 +1686,7 @@ Given clojure:
|
||||
:signing {:gpg-key "FEF9C627"}}}
|
||||
|
||||
Do (Virtual column should be used in blockwise-visual mode):
|
||||
:set ve=block\<Enter>
|
||||
f[
|
||||
vi[
|
||||
\<C-V>
|
||||
@@ -1592,6 +1707,9 @@ Expect clojure:
|
||||
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
|
||||
:signing {:gpg-key "FEF9C627"}}}
|
||||
|
||||
Then:
|
||||
set ve=
|
||||
|
||||
###########################################################
|
||||
|
||||
Given (hard-tab indentation (#19)):
|
||||
|
||||
Reference in New Issue
Block a user