aboutsummaryrefslogtreecommitdiffstats
path: root/alias.js
diff options
context:
space:
mode:
Diffstat (limited to 'alias.js')
-rw-r--r--alias.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/alias.js b/alias.js
index fdc151d..2baca1f 100644
--- a/alias.js
+++ b/alias.js
@@ -60,7 +60,7 @@ let PLUGIN_INFO =
let INFO =
<>
<plugin name="alias" version="1.0.0"
- href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/alias.js"
+ href="http://github.com/vimpr/vimperator-plugins/blob/master/alias.js"
summary="Define the alias for a command."
lang="en-US"
xmlns="http://vimperator.org/namespaces/liberator">
@@ -84,7 +84,7 @@ let INFO =
</ex></code>
</plugin>
<plugin name="alias" version="1.0.0"
- href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/alias.js"
+ href="http://github.com/vimpr/vimperator-plugins/blob/master/alias.js"
summary="コマンドに別名(エイリアス|alias)をつける。"
lang="ja"
xmlns="http://vimperator.org/namespaces/liberator">
@@ -113,6 +113,15 @@ let INFO =
(function () {
+ // FIXME "vim[perator]" に対応してない
+ function removeOld (name) {
+ let cmd = commands.get(name);
+ if (!cmd)
+ return;
+ if (cmd.specs instanceof Array)
+ cmd.specs = cmd.specs.filter(function (it) it !== name);
+ }
+
commands.addUserCommand(
['alias'],
'Define the alias for a command.',
@@ -123,6 +132,7 @@ let INFO =
if (!cmd)
return liberator.echoerr('Not found command with: ' + oldName);
+ removeOld(newName);
cmd.specs.push(newName);
// XXX 必要でない気もする。実際コマンドの検索には要らない。
Command.prototype.init.call(cmd, cmd.specs, cmd.description, cmd.action);