From c86c685fc48afbbfea1d44733f4355bfe0f795ec Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 27 Sep 2011 23:26:53 +0900 Subject: 新しいコマンド名が被る場合に対処(半端に --- alias.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'alias.js') diff --git a/alias.js b/alias.js index 9dc880e..2baca1f 100644 --- a/alias.js +++ b/alias.js @@ -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); -- cgit v1.2.3