diff options
Diffstat (limited to 'content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml')
| -rw-r--r-- | content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml b/content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml index f50a8a0..f919301 100644 --- a/content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml +++ b/content/posts/2021-10-02/vim-swap-order-of-selected-lines.xml @@ -22,7 +22,19 @@ <simpara> <hr/> </simpara> - <section xml:id="_バージョン情報"> + <section xml:id="tl-dr"> + <title>TL; DR</title> + <programlisting language="vim" linenumbering="unnumbered"> + <![CDATA[ + " License: Public Domain + + command! -bar -range=% + \ Reverse + \ keeppatterns <line1>,<line2>g/^/m<line1>-1 + ]]> + </programlisting> + </section> + <section xml:id="version"> <title>バージョン情報</title> <simpara> <literal>:version</literal> の一部 @@ -34,9 +46,9 @@ </simpara> </blockquote> </section> - <section xml:id="_よく紹介されている手法"> + <section xml:id="existing-solution"> <title>よく紹介されている手法</title> - <section xml:id="_tac_tail"> + <section xml:id="existing-solution--external-commands"> <title><literal>tac</literal> / <literal>tail</literal></title> <simpara> <literal>tac</literal> や <literal>tail -r</literal> などの外部コマンドを <literal>!</literal> @@ -52,7 +64,7 @@ オプションは環境によって利用できないことがあり、複数の環境を行き来する場合に採用しづらい </simpara> </section> - <section xml:id="_gm0"> + <section xml:id="existing-solution--global-command"> <title><literal>:g/^/m0</literal></title> <simpara> こちらは外部コマンドに頼らず、Vim の機能のみを使う。<literal>g</literal> は <literal>:global</literal> @@ -99,7 +111,7 @@ </simpara> </section> </section> - <section xml:id="_gm0_の問題点"> + <section xml:id="problem-of-global-command"> <title><literal>:g/^/m0</literal> の問題点</title> <simpara> <literal>:global</literal> @@ -114,7 +126,7 @@ </simpara> </blockquote> </section> - <section xml:id="_解決策"> + <section xml:id="solution"> <title>解決策</title> <blockquote> <simpara> @@ -177,7 +189,7 @@ の呼び出しをユーザー定義関数に切り出すことで上述の問題を解決できる。 </simpara> </section> - <section xml:id="_解決策_改訂版"> + <section xml:id="solution-revised"> <title>解決策 (改訂版)</title> <blockquote> <simpara> @@ -203,16 +215,4 @@ </simpara> </blockquote> </section> - <section xml:id="_コピペ用再掲"> - <title>コピペ用再掲</title> - <programlisting language="vim" linenumbering="unnumbered"> - <![CDATA[ - " License: Public Domain - - command! -bar -range=% - \ Reverse - \ keeppatterns <line1>,<line2>g/^/m<line1>-1 - ]]> - </programlisting> - </section> </article> |
