| 1 | /* NEW BSD LICENSE {{{ |
|---|
| 2 | Copyright (c) 2009, anekos. |
|---|
| 3 | All rights reserved. |
|---|
| 4 | |
|---|
| 5 | Redistribution and use in source and binary forms, with or without modification, |
|---|
| 6 | are permitted provided that the following conditions are met: |
|---|
| 7 | |
|---|
| 8 | 1. Redistributions of source code must retain the above copyright notice, |
|---|
| 9 | this list of conditions and the following disclaimer. |
|---|
| 10 | 2. Redistributions in binary form must reproduce the above copyright notice, |
|---|
| 11 | this list of conditions and the following disclaimer in the documentation |
|---|
| 12 | and/or other materials provided with the distribution. |
|---|
| 13 | 3. The names of the authors may not be used to endorse or promote products |
|---|
| 14 | derived from this software without specific prior written permission. |
|---|
| 15 | |
|---|
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|---|
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|---|
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|---|
| 19 | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|---|
| 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|---|
| 21 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|---|
| 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|---|
| 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|---|
| 24 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|---|
| 25 | THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | ################################################################################### |
|---|
| 29 | # http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license # |
|---|
| 30 | # に参考になる日本語訳がありますが、有効なのは上記英文となります。 # |
|---|
| 31 | ################################################################################### |
|---|
| 32 | |
|---|
| 33 | }}} */ |
|---|
| 34 | |
|---|
| 35 | // PLUGIN_INFO {{{ |
|---|
| 36 | let PLUGIN_INFO = |
|---|
| 37 | <VimperatorPlugin> |
|---|
| 38 | <name>Multi-execute</name> |
|---|
| 39 | <description>Add the command which execute some ex-commands.</description> |
|---|
| 40 | <description lang="ja">複数のexコマンドを実行するコマンドを追加</description> |
|---|
| 41 | <version>1.0.1</version> |
|---|
| 42 | <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> |
|---|
| 43 | <license>new BSD License (Please read the source code comments of this plugin)</license> |
|---|
| 44 | <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license> |
|---|
| 45 | <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/multi-exec.js</updateURL> |
|---|
| 46 | <minVersion>2.0pre</minVersion> |
|---|
| 47 | <maxVersion>2.0</maxVersion> |
|---|
| 48 | <detail><![CDATA[ |
|---|
| 49 | == Description == |
|---|
| 50 | Execute the some ex-commands which has been separated by the specified separator. |
|---|
| 51 | == Commands == |
|---|
| 52 | :mx [<SEPARATOR>] <EX-COMMAND-WITH-ARGS>...: |
|---|
| 53 | The default value of <SEPARATOR> is "|" |
|---|
| 54 | e.g. |
|---|
| 55 | >|| |
|---|
| 56 | :mx echo 1 | echo 2 |
|---|
| 57 | :mx ; echo 1 ; echo 2 |
|---|
| 58 | ||< |
|---|
| 59 | ]]></detail> |
|---|
| 60 | <detail lang="ja"><![CDATA[ |
|---|
| 61 | == Description == |
|---|
| 62 | 指定のセパレータによって分割された複数のexコマンドを実行します。 |
|---|
| 63 | auto_source.js などで便利かもしれません。 |
|---|
| 64 | == Commands == |
|---|
| 65 | :mx [<SEPARATOR>] <EX-COMMAND-WITH-ARGS>...: |
|---|
| 66 | <SEPARATOR> のデフォルトは "|" です。 |
|---|
| 67 | 例 |
|---|
| 68 | >|| |
|---|
| 69 | :mx echo 1 | echo 2 |
|---|
| 70 | :mx ; echo 1 ; echo 2 |
|---|
| 71 | ||< |
|---|
| 72 | ]]></detail> |
|---|
| 73 | </VimperatorPlugin>; |
|---|
| 74 | // }}} |
|---|
| 75 | |
|---|
| 76 | (function () { |
|---|
| 77 | |
|---|
| 78 | commands.addUserCommand( |
|---|
| 79 | ['mx', 'mulex'], |
|---|
| 80 | 'Multiple ex', |
|---|
| 81 | function (args) { |
|---|
| 82 | let [sep, body] = ['|', args.string]; |
|---|
| 83 | let (m = body.match(/^(\S)\s+(.*)$/)) |
|---|
| 84 | m && ([sep, body] = [m[1], m[2]]); |
|---|
| 85 | body.split(sep) |
|---|
| 86 | .map(function (it) it.replace(/^\s+/, '')) |
|---|
| 87 | .forEach(liberator.execute, liberator); |
|---|
| 88 | }, |
|---|
| 89 | { |
|---|
| 90 | literal: 0, |
|---|
| 91 | argCount: '*' |
|---|
| 92 | }, |
|---|
| 93 | true |
|---|
| 94 | ); |
|---|
| 95 | |
|---|
| 96 | })(); |
|---|
| 97 | |
|---|
| 98 | // vim:sw=2 ts=2 et si fdm=marker: |
|---|
| 99 | |
|---|