/* * ==VimperatorPlugin== * @name toggler * @version 0.1 * @author teramako * ==/VimperatorPlugin== * * 何かしらの設定をクルクル変更したい人へ * * まず、最初に以下の例ように.vimperatorrcに定義する js < :toggle go * などとやっておくとボタン一つでクルクル替わる */ liberator.plugins.toggler = (function(){ var settings = {}; function Toggler(name, cmds){ if (!cmds || cmds.length < 2) throw new Error("arguments are not enough"); this.name = name; this.cmds = cmds; this.index = 0; } Toggler.prototype = { next: function(notUpdate){ let index = this.index + 1; if (index >= this.cmds.length) index = 0; if (!notUpdate) this.index = index; return this.cmds[index]; }, previous: function(notUpdate){ let index = this.index - 1; if (index < 0) index = this.cmds.length -1; if (!notUpdate) this.index = index; return this.cmds[this.index]; }, list: function(){ var data = []; for (var i = 0; i