diff options
author | anekos | 2011-10-06 14:41:45 +0900 |
---|---|---|
committer | anekos | 2011-10-06 14:42:06 +0900 |
commit | 6e6c806406e7d3597dea6e7bd72da4218be96190 (patch) | |
tree | adc799ec11ac6a656aaad10cd1f2f9e2ec21ef2c | |
parent | b64b11017a0c44c68b6c37180e0bf6acd4fcca8f (diff) | |
download | vimperator-plugins-6e6c806406e7d3597dea6e7bd72da4218be96190.tar.bz2 |
履歴を / と :ml で共用
-rw-r--r-- | migemized_find.js | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/migemized_find.js b/migemized_find.js index 7c8d796..dffb028 100644 --- a/migemized_find.js +++ b/migemized_find.js @@ -333,6 +333,20 @@ let INFO = return result; }, + // 履歴にアイテム追加 + pushHistory: function (s) { + let exists = false, newHistory = []; + newHistory.push(s); + for (let [i, h] in Iterator(this.history)) { + if (h === s) { + exists = true; + } else { + newHistory.push(h); + } + } + this.history = newHistory; + }, + // ボディを範囲とした Range を作る makeBodyRange: function (frame) { let range = frame.document.createRange(); @@ -520,16 +534,7 @@ let INFO = }, submit: function () { - let exists = false, newHistory = []; - newHistory.push(this.currentSearchText); - for (let [i, h] in Iterator(this.history)) { - if (h === this.currentSearchText) { - exists = true; - } else { - newHistory.push(h); - } - } - this.history = newHistory; + this.pushHistory(this.currentSearchText); this.lastSearchText = this.currentSearchText; this.lastSearchExpr = this.currentSearchExpr; @@ -654,14 +659,24 @@ let INFO = ['ml', 'migelight'], 'Migelight matched words', function (args) { - let r = MF.highlightAll(args.join(' '), args['-color']); + let w = args.literalArg; + MF.pushHistory(w); + let r = MF.highlightAll(w, args['-color']); liberator.echo(r ? r.length + ' words migelighted.' : 'word not found.'); }, { + literal: 0, options: [ [['-color', '-c'], commands.OPTION_STRING, null, colorsCompltions], - ] + ], + completer: function (context, args) { + context.compare = void 0; + context.completions = [ + [v, 'History'] + for ([, v] in Iterator(MF.history)) + ]; + } }, true ); |