Update easyalign

This commit is contained in:
Rico Sta. Cruz 2015-04-23 09:37:06 +08:00
parent 5221038f6e
commit cd284f3b41
4 changed files with 112 additions and 88 deletions

View File

@ -205,3 +205,8 @@ pre + pre {
box-shadow: none; box-shadow: none;
margin: 0; margin: 0;
} }
h3 + pre,
h3 + table {
margin-top: -1em;
}

37
git.md
View File

@ -28,7 +28,8 @@ layout: default
# delete remote branch # delete remote branch
git push origin :$branchname git push origin :$branchname
## Submodules Submodules
----------
# Import .gitmodules # Import .gitmodules
git submodule init git submodule init
@ -40,7 +41,39 @@ layout: default
# (Use when you changed remotes in submodules) # (Use when you changed remotes in submodules)
git submodule sync git submodule sync
## Cherry pick Diff
----
### Diff with stats
git diff --stat
app/a.txt | 2 +-
app/b.txt | 8 ++----
2 files changed, 10 insertions(+), 84 deletions(-)
### Just filenames
git diff --summary
Log options
-----------
--oneline
e11e9f9 Commit message here
--decorate
shows "(origin/master)"
--graph
shows graph lines
--date=relative
"2 hours ago"
Misc
----
### Cherry pick
git rebase 76acada^ git rebase 76acada^

View File

@ -1,54 +1,68 @@
--- ---
title: Vim Easyalign title: Vim Easyalign
html_class: key-codes html_class: key-codes
hljs_languages: [vim]
--- ---
### [vim-easy-align](https://github.com/junegunn/vim-easy-align) ## Command mode
This plugin allows you to align things.
| `{Visual}` `⏎` | activate for selection | ### Align by delimiters
| `ga` `{motion}` | activate for motion/text object |
{:.greycode}
After activating, press a delimiter key. Available delimeters are:<br> ```vim
`<Space>` `=` `:` `.` `,` `&` `#` `|` :EasyAlign : " preset characters (\=:.,&#|)
:EasyAlign |
## Example :EasyAlign \ " \ means space
```
a = foo
pi = 3.1415
hello = 'world'
``` ```
Press `vip ⏎` or `gaip` to activate via *ip* (inner paragraph). Then press `=` ### Align by regexp
``` ```vim
a = foo :EasyAlign /[:;]+/
pi = 3.1415
hello = 'world'
``` ```
## Useful delimiters ### Specify which
### Variable assignments ```vim
`gaip` `=` will align 1st occurence of equal sign :EasyAlign | " align by 1st `|`
:EasyAlign 3 | " align by 3rd `|`
```js :EasyAlign * | " align by all `|`s
var one = 1;
var three = 3;
``` ```
### JSON or YAML ### Add options
`gaip` `:` will align 1st occurence of colon
```yaml ```vim
url: jdbc:mysql://localhost/test :EasyAlign * | l4r1
database: test
l4 " lN - left_margin
r1 " rN - right_margin
" spaces to the left/right of `|`
ar " a[lrc] - align
" align left/right/center
dr " d[lrc] - delimiter_align
" alignment of the delimeter itself
``` ```
### Markdown tables ### Spaces are optional
`*|` Align all table delimeters
```vim
:EasyAlign * /[;:]+/ l3
:EasyAlign*/[;:]+/l3
```
## Examples
### `:EasyAlign = dr` (delimiter_align right)
apple = 1
banana += apple
cake ||= banana
### `:EasyAlign :` (for json or yaml)
url: jdbc:mysql://localhost/test
database: test
### `:EasyAlign *|` (markdown tables)
```nohighlight ```nohighlight
| `<Enter>` | right align | | `<Enter>` | right align |
@ -56,60 +70,30 @@ database: test
| `2` | on 2nd occurence (and so on) | | `2` | on 2nd occurence (and so on) |
``` ```
### Ruby or Python comments Interactive mode
`#` Align comments ----------------
``` | `{Visual}` `⏎` | activate for selection |
let x = true # one | `ga` `{motion}` | activate for motion/text object |
let y = false # two {:.greycode}
let z = "abcdef" # three
```
## Modifiers Then press options (if available), then a delimiter.
| `1` | on 1st occurence (default) | ### Interactive mode options
| `2` | on 2nd occurence |
| `3` | on 3rd occurence (and so on) |
| `*` | on all occurences |
| `-` | on last occurence |
| `-2` | on 2nd to the last occurence |
You may type modifiers before a delimiter. Example: `gaip` `*|` will align all `|` delimiters.
## Alignment
| `⏎` | change alignment align |
**Example:** `gaip` `⏎` `=` right aligns whatever is before the first delimeter (equal sign).
```
express = require('express')
xtend = require('xtend')
pip = require('pip')
```
**Example:** `gaip` `⏎` `2|` right aligns the 1st Markdown table column (ie, before the 2nd delimiter).
```
| apple | $ 20 |
| orange | $ 42 |
| pineapple | $ 11 |
```
## Margins
| `⏎` | Set `alignment` |
| `<ctrl-l>` `4 ⏎` | Set `left_margin` (to the left of the delimeter) | | `<ctrl-l>` `4 ⏎` | Set `left_margin` (to the left of the delimeter) |
| `<ctrl-r>` `4 ⏎` | Set `right_margin` | | `<ctrl-r>` `4 ⏎` | Set `right_margin` |
| `↓` | no margin | | `↓` | no margin |
{:.greycode}
**Example**: `gaip` `<ctrl-l>` `8⏎` `=` puts 8 spaces before the equal sign ### Example
``` * `gaip` `<ctrl-l>` `8⏎` `=` - puts 8 spaces before the equal sign
var x = "one"
var xyz = "two"
```
## See also Also see
--------
* [vim-easy-align](https://github.com/junegunn/vim-easy-align)
* [Examples](https://github.com/junegunn/vim-easy-align#examples) * [Examples](https://github.com/junegunn/vim-easy-align#examples)
* [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options) * [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options)

View File

@ -25,12 +25,14 @@ layout: default
### Options ### Options
- `-start-insert` | `-start-insert` | |
- `-no-quit` | `-no-quit` | |
- `-winheight=10` | `-winheight=10` | |
- `-quick-match` - select by pressing asdf keys | `-quick-match` | select by pressing asdf keys |
- `-winwidth=40` - use with vertical | `-winwidth=40` | use with vertical |
- `-no-split` - open in current buffer | `-no-split` | open in current buffer |
- `-auto-preview` - great for outline | `-auto-preview` | great for outline |
- `-vertical` - open as sidebar | `-vertical` | open as sidebar |
- `-here` - in this buffer | `-buffer-name=xxx -resume` | resume the next time it's called (faster) |
| `-input=` | reset input (use with -resume) |
| `-unique` | remove duplicates (eg, if using file_rec with file_mru) |