From cd284f3b418172588f81de5e488b399c50a31f31 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 23 Apr 2015 09:37:06 +0800 Subject: [PATCH] Update easyalign --- assets/style.css | 5 ++ git.md | 37 ++++++++++++- vim-easyalign.md | 138 +++++++++++++++++++++-------------------------- vim-unite.md | 20 +++---- 4 files changed, 112 insertions(+), 88 deletions(-) diff --git a/assets/style.css b/assets/style.css index f45527dbc..a2f20254d 100644 --- a/assets/style.css +++ b/assets/style.css @@ -205,3 +205,8 @@ pre + pre { box-shadow: none; margin: 0; } + +h3 + pre, +h3 + table { + margin-top: -1em; +} diff --git a/git.md b/git.md index e9427bb00..84bc4cf7c 100644 --- a/git.md +++ b/git.md @@ -28,7 +28,8 @@ layout: default # delete remote branch git push origin :$branchname -## Submodules +Submodules +---------- # Import .gitmodules git submodule init @@ -40,7 +41,39 @@ layout: default # (Use when you changed remotes in submodules) 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^ diff --git a/vim-easyalign.md b/vim-easyalign.md index c29dc5548..a99abbe05 100644 --- a/vim-easyalign.md +++ b/vim-easyalign.md @@ -1,54 +1,68 @@ --- title: Vim Easyalign html_class: key-codes +hljs_languages: [vim] --- -### [vim-easy-align](https://github.com/junegunn/vim-easy-align) -This plugin allows you to align things. +## Command mode -| `{Visual}` `⏎` | activate for selection | -| `ga` `{motion}` | activate for motion/text object | -{:.greycode} +### Align by delimiters -After activating, press a delimiter key. Available delimeters are:
-`` `=` `:` `.` `,` `&` `#` `|` - -## Example - -``` -a = foo -pi = 3.1415 -hello = 'world' +```vim +:EasyAlign : " preset characters (\=:.,&#|) +:EasyAlign | +:EasyAlign \ " \ means space ``` -Press `vip ⏎` or `gaip` to activate via *ip* (inner paragraph). Then press `=` +### Align by regexp -``` -a = foo -pi = 3.1415 -hello = 'world' +```vim +:EasyAlign /[:;]+/ ``` -## Useful delimiters +### Specify which -### Variable assignments -`gaip` `=` will align 1st occurence of equal sign - -```js -var one = 1; -var three = 3; +```vim +:EasyAlign | " align by 1st `|` +:EasyAlign 3 | " align by 3rd `|` +:EasyAlign * | " align by all `|`s ``` -### JSON or YAML -`gaip` `:` will align 1st occurence of colon +### Add options -```yaml -url: jdbc:mysql://localhost/test -database: test +```vim +:EasyAlign * | l4r1 + + 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 -`*|` Align all table delimeters +### Spaces are optional + +```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 | `` | right align | @@ -56,60 +70,30 @@ database: test | `2` | on 2nd occurence (and so on) | ``` -### Ruby or Python comments -`#` Align comments +Interactive mode +---------------- -``` -let x = true # one -let y = false # two -let z = "abcdef" # three -``` +| `{Visual}` `⏎` | activate for selection | +| `ga` `{motion}` | activate for motion/text object | +{:.greycode} -## Modifiers +Then press options (if available), then a delimiter. -| `1` | on 1st occurence (default) | -| `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 +### Interactive mode options +| `⏎` | Set `alignment` | | `` `4 ⏎` | Set `left_margin` (to the left of the delimeter) | | `` `4 ⏎` | Set `right_margin` | | `↓` | no margin | +{:.greycode} -**Example**: `gaip` `` `8⏎` `=` puts 8 spaces before the equal sign +### Example -``` -var x = "one" -var xyz = "two" -``` + * `gaip` `` `8⏎` `=` - puts 8 spaces before the equal sign -## See also +Also see +-------- +* [vim-easy-align](https://github.com/junegunn/vim-easy-align) * [Examples](https://github.com/junegunn/vim-easy-align#examples) * [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options) diff --git a/vim-unite.md b/vim-unite.md index b0e427bf0..4811915c8 100644 --- a/vim-unite.md +++ b/vim-unite.md @@ -25,12 +25,14 @@ layout: default ### Options -- `-start-insert` -- `-no-quit` -- `-winheight=10` -- `-quick-match` - select by pressing asdf keys -- `-winwidth=40` - use with vertical -- `-no-split` - open in current buffer -- `-auto-preview` - great for outline -- `-vertical` - open as sidebar -- `-here` - in this buffer +| `-start-insert` | | +| `-no-quit` | | +| `-winheight=10` | | +| `-quick-match` | select by pressing asdf keys | +| `-winwidth=40` | use with vertical | +| `-no-split` | open in current buffer | +| `-auto-preview` | great for outline | +| `-vertical` | open as sidebar | +| `-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) |