allows :LesserAlign command to take arguments

This commit is contained in:
Junegunn Choi
2013-04-11 20:54:05 +09:00
parent 39a520ed7b
commit 37734710c4
3 changed files with 65 additions and 47 deletions

View File

@@ -4,7 +4,7 @@ vim-lesser-align
Yet another Vim alignment plugin without too much ambition.
This plugin clearly has less features than the other pre-existing ones with the similar goals,
but it is simpler, easier to use, and good enough for most of the cases.
but it is simpler, easier to use, and good enough for the most of the cases.
Usage
-----
@@ -20,8 +20,8 @@ vnoremap <silent> <Enter> :LesserAlign<cr>
Then a key sequence becomes a combination of 3 parts.
1. `<Enter>`
- Shortcut for `:LesserAssign<Enter>`
1. Integer (optional, default: 1)
- Shortcut for `:LesserAssign<cr>`
1. Integer (*optional*, default: 1)
- `1`: Alignment around 1st delimiter
- `2`: Alignment around 2nd delimiter
- `...`
@@ -36,16 +36,16 @@ Then a key sequence becomes a combination of 3 parts.
Examples
--------
| Keystroke | Description |
| ------------------- | ----------------------------------------------------- |
| `<Enter>=` | Alignment around 1st equals sign (and the likes) |
| `<Enter>2=` | Alignment around 2nd equals sign (and the likes) |
| `<Enter>3=` | Alignment around 3rd equals sign (and the likes) |
| `<Enter>*=` | Alignment around all equals signs (and the likes) |
| `<Enter><space>` | Alignment around 1st whitespace |
| `<Enter>2<space>` | Alignment around 2nd whitespace |
| `<Enter>:` | Alignment around 1st colon |
| ... | ... |
| With visual map | Description | Equivalent command |
| ----------------- | -------------------------------------------------- | ----------------------- |
| `<Enter>=` | Alignment around 1st equals sign (and the likes) | `:'<,'>LesserAlign =` |
| `<Enter>2=` | Alignment around 2nd equals sign (and the likes) | `:'<,'>LesserAlign 2=` |
| `<Enter>3=` | Alignment around 3rd equals sign (and the likes) | `:'<,'>LesserAlign 3=` |
| `<Enter>*=` | Alignment around all equals signs (and the likes) | `:'<,'>LesserAlign *=` |
| `<Enter><space>` | Alignment around 1st whitespace | `:'<,'>LesserAlign \ ` |
| `<Enter>2<space>` | Alignment around 2nd whitespace | `:'<,'>LesserAlign 2\ ` |
| `<Enter>:` | Alignment around 1st colon | `:'<,'>LesserAlign :` |
| ... | ... | |
Defining custom alignment rules
-------------------------------