Easy-align
This commit is contained in:
parent
9d2e4d419f
commit
cab9ab7b87
|
@ -186,3 +186,22 @@ pre.light {
|
||||||
pre + pre {
|
pre + pre {
|
||||||
margin-top: -1.7em;
|
margin-top: -1.7em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.key-codes code {
|
||||||
|
background: #fdfdff;
|
||||||
|
padding: 3px 8px 3px 8px;
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-codes code + code {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-codes pre code {
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
---
|
||||||
|
title: Vim Easyalign
|
||||||
|
html_class: key-codes
|
||||||
|
---
|
||||||
|
|
||||||
|
### [vim-easy-align](https://github.com/junegunn/vim-easy-align)
|
||||||
|
This plugin allows you to align things.
|
||||||
|
|
||||||
|
| `{Visual}` `⏎` | activate for selection |
|
||||||
|
| `ga` `{motion}` | activate for motion/text object |
|
||||||
|
{:.greycode}
|
||||||
|
|
||||||
|
After activating, press a delimiter key. Available delimeters are:<br>
|
||||||
|
`<Space>` `=` `:` `.` `,` `&` `#` `|`
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```
|
||||||
|
a = foo
|
||||||
|
pi = 3.1415
|
||||||
|
hello = 'world'
|
||||||
|
```
|
||||||
|
|
||||||
|
Press `vip ⏎` or `gaip` to activate via *ip* (inner paragraph). Then press `=`
|
||||||
|
|
||||||
|
```
|
||||||
|
a = foo
|
||||||
|
pi = 3.1415
|
||||||
|
hello = 'world'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Useful delimiters
|
||||||
|
|
||||||
|
### Variable assignments
|
||||||
|
`gaip` `=` will align 1st occurence of equal sign
|
||||||
|
|
||||||
|
```js
|
||||||
|
var one = 1;
|
||||||
|
var three = 3;
|
||||||
|
```
|
||||||
|
|
||||||
|
### JSON or YAML
|
||||||
|
`gaip` `:` will align 1st occurence of colon
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
url: jdbc:mysql://localhost/test
|
||||||
|
database: test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Markdown tables
|
||||||
|
`*|` Align all table delimeters
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
| `<Enter>` | right align |
|
||||||
|
| `1` | on 1st occurence |
|
||||||
|
| `2` | on 2nd occurence (and so on) |
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ruby or Python comments
|
||||||
|
`#` Align comments
|
||||||
|
|
||||||
|
```
|
||||||
|
let x = true # one
|
||||||
|
let y = false # two
|
||||||
|
let z = "abcdef" # three
|
||||||
|
```
|
||||||
|
|
||||||
|
## Modifiers
|
||||||
|
|
||||||
|
| `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
|
||||||
|
|
||||||
|
| `<ctrl-l>` `4 ⏎` | Set `left_margin` (to the left of the delimeter) |
|
||||||
|
| `<ctrl-r>` `4 ⏎` | Set `right_margin` |
|
||||||
|
| `↓` | no margin |
|
||||||
|
|
||||||
|
**Example**: `gaip` `<ctrl-l>` `8⏎` `=` puts 8 spaces before the equal sign
|
||||||
|
|
||||||
|
```
|
||||||
|
var x = "one"
|
||||||
|
var xyz = "two"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
* [Examples](https://github.com/junegunn/vim-easy-align#examples)
|
||||||
|
* [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options)
|
|
@ -0,0 +1,113 @@
|
||||||
|
---
|
||||||
|
title: Vim helpfiles
|
||||||
|
---
|
||||||
|
|
||||||
|
```
|
||||||
|
:help help-writing
|
||||||
|
```
|
||||||
|
{:.light}
|
||||||
|
|
||||||
|
### Creating a document
|
||||||
|
Use `help` to preview it, and `text` to edit it.
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
:e doc/potion.txt
|
||||||
|
:set ft=help
|
||||||
|
:set ft=text
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tags
|
||||||
|
|
||||||
|
* Tags are created with asterisks, eg, `*potion-usage*`
|
||||||
|
* Links to tags are `|potion-usage|`
|
||||||
|
* Press `^]` to jump to a tag
|
||||||
|
|
||||||
|
## Syntax reference
|
||||||
|
|
||||||
|
| `*tags*` | Tags |
|
||||||
|
| `INTRO *tag*` | Section header |
|
||||||
|
| `|link-to-tags|` | Links to tags (eg, `|:command|`) |
|
||||||
|
| `'vimoption'` | Vim option (eg, `'textwidth'`) |
|
||||||
|
| `{code-text}` | Code text (eg, `{Visual}gf`) |
|
||||||
|
| `[code-text]` | Code text (eg, `[xyz]`) |
|
||||||
|
| `<code-text>` | Code text (eg, `<PageDown>`) |
|
||||||
|
| `` `command` `` | Code text (eg, `cmd`) |
|
||||||
|
| `CTRL-X` | Code text |
|
||||||
|
| `www.url.com` | Web URL |
|
||||||
|
| `Column heading~` | Highlighting |
|
||||||
|
| `=====` | Separator |
|
||||||
|
| `-----` | Separator |
|
||||||
|
{:.greycode}
|
||||||
|
|
||||||
|
### Code blocks
|
||||||
|
Surround with `>` and `<` characters
|
||||||
|
|
||||||
|
```
|
||||||
|
Example: >
|
||||||
|
xyz
|
||||||
|
<
|
||||||
|
```
|
||||||
|
|
||||||
|
### File header
|
||||||
|
It's customary to start a file with a tag of the filename, plus a description
|
||||||
|
|
||||||
|
```
|
||||||
|
*potion.txt* functionality for the potion programming language
|
||||||
|
```
|
||||||
|
|
||||||
|
### Heading
|
||||||
|
Starts with `ALL CAPS`, ends with `*a-tag*`
|
||||||
|
|
||||||
|
```
|
||||||
|
==============================================================================
|
||||||
|
CONTENTS *potion-contents*
|
||||||
|
```
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
Using `*Todo` and `*Error` will highlight your notes.
|
||||||
|
|
||||||
|
```
|
||||||
|
*Todo something to do
|
||||||
|
*Error something wrong
|
||||||
|
```
|
||||||
|
|
||||||
|
### Final modeline
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
```
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
### Table of contents
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
|rails-introduction| Introduction and Feature Summary
|
||||||
|
|rails-commands| General Commands
|
||||||
|
|rails-navigation| Navigation
|
||||||
|
```
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
1.Intro...................................|ergonomic|
|
||||||
|
2.Note to use..............................|CAPSLOCK|
|
||||||
|
3.Insert Mode Remappings............|ergonomicInsert|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Author lines
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
Author: Jack Hackness <captain@time.com> *xyz-author*
|
||||||
|
License: Same terms as Vim itself (see |license|)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Command reference
|
||||||
|
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
:Ack[!] [options] {pattern} [{directory}] *:Ack*
|
||||||
|
|
||||||
|
Search recursively in {directory} (which defaults to the current
|
||||||
|
directory) for the {pattern}. Behaves just like the |:grep| command, but
|
||||||
|
will open the |Quickfix| window for you. If [!] is not given the first
|
||||||
|
occurence is jumped to.
|
||||||
|
```
|
17
vim.md
17
vim.md
|
@ -1,8 +1,14 @@
|
||||||
---function
|
---
|
||||||
title: vim
|
title: vim
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
|
* [Digraphs](vim-digraphs.html)
|
||||||
|
* [Help text](vim-help.html)
|
||||||
|
* [Vimscript](vimscript.html)
|
||||||
|
* [Vim-unite](vim-unite.html)
|
||||||
|
* [Vim-easyalign](vim-easyalign.html)
|
||||||
|
|
||||||
Command line
|
Command line
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -116,6 +122,15 @@ Marks
|
||||||
`. # Last change
|
`. # Last change
|
||||||
`` # Last jump
|
`` # Last jump
|
||||||
|
|
||||||
|
Text alignment
|
||||||
|
--------------
|
||||||
|
|
||||||
|
See `:help formatting`
|
||||||
|
|
||||||
|
:center [width]
|
||||||
|
:right [width]
|
||||||
|
:left
|
||||||
|
|
||||||
### Calculator
|
### Calculator
|
||||||
|
|
||||||
(Insert mode) <C-r>=128/2
|
(Insert mode) <C-r>=128/2
|
||||||
|
|
Loading…
Reference in New Issue