align設定用例集
<pre class="code lang-c" data-lang="c">int count = 0;
float degree = 0.2;
<pre class="code">M-x align</pre>
<pre class="code lang-c" data-lang="c">int count = 0;
float degree = 0.2;
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(hoge-assignment ; ルールの名前
; オプションをここに書く
))</pre>
<pre class="code">f| v align-rules-list</pre>
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(atmark-assignment
(regexp . "\\( *\\)@") ; 基準を定義する<a class="keyword" href="http://d.hatena.ne.jp/keyword/%C0%B5%B5%AC%C9%BD%B8%BD">正規表現</a>
(modes . '(text-mode)))) ; ルールを適用するモード</pre>
<pre class="code">foo@bar
hoge@huga 1@2
<pre class="code">foo @bar
hoge @huga 1 @2
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(<a class="keyword" href="http://d.hatena.ne.jp/keyword/yaml">yaml</a>-assignment
(regexp . ":\\(\\s-*\\)") ; 末尾に \\(\\s-*\\)
(modes . '(<a class="keyword" href="http://d.hatena.ne.jp/keyword/yaml">yaml</a>-mode))))</pre>
<pre class="code lang-yaml" data-lang="yaml">Winter:
Decemberde: 12 January: 1 February: 2
<pre class="code lang-yaml" data-lang="yaml">Winter:
Decemberde: 12 January: 1 February: 2
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(camma-assignment
(regexp . ",\\( *\\)")
(repeat . t) ; 複数回適用を有効に
(modes . '(<a class="keyword" href="http://d.hatena.ne.jp/keyword/perl">perl</a>-mode))))</pre>
<pre class="code">my @primes = (
1,2,3,5,7,
11,13,17,19,23,
29,31,37,41,43,
);
<pre class="code">my @primes = (
1, 2, 3, 5, 7,
11, 13, 17, 19, 23,
29, 31, 37, 41, 43,
);
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(tab-stop-assignment
(regexp . "\\(\\s-+\\)")
(tab-stop . t) ; タブ位置でそろえる
(modes . '(text-mode))))</pre>
<pre class="code">0....5..8
yes はい no いいえ
<pre class="code">0....5..8
yes はい no いいえ
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(column-assignment
(regexp . "\\(\\s-+\\)")
(column . 10) ; そろえる列数
(modes . '(text-mode))))</pre>
<pre class="code">0....5....10
english 英語 japanese 日本語 french フランス語
<pre class="code">0....5....10
english 英語 japanese 日本語 french フランス語
<pre class="code lang-lisp" data-lang="lisp">(add-to-list 'align-rules-list
'(custom-separete-assignment
(regexp . ",\\(\\s-*\\)")
(separate . "\\(===\\)") ; 段落の切れ目
(modes . '(text-mode))))</pre>
<pre class="code">January, 1
February, 2 March, 3 #
April, 4 May, 5 June, 6
<pre class="code">January, 1
February, 2 March, 3 #
April, 4 May, 5 June, 6
<pre class="code">$ git diff -b</pre>
<pre class="code">; regexpだけを指定する場合
M-x align-regexp
; groupやrepeatなども指定する場合 C-u M-x align-regexp