From 22bcd791f3ee3cc78d67ed8c80a0303c7600f6a5 Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 7 Jun 2010 11:52:30 +0000 Subject: ラベルのショートカット的な補完設定追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37817 d0d07461-0603-4401-acd4-de1884942a52 --- gmail-commando.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gmail-commando.js') diff --git a/gmail-commando.js b/gmail-commando.js index a8b33ca..8c457d0 100755 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -140,6 +140,18 @@ let INFO = function A (list) Array.slice(list); + const Conf = (function () { + let gv = liberator.globalVariables; + let conf = {}; + 'label_shortcut'.split(/\s/).forEach(function (n) { + conf.__defineGetter__( + n.replace(/_./g, function (m) m.slice(1).toUpperCase()), + function () gv['gmail_commando_' + n] + ); + }); + return conf; + })(); + const Languages = [ ['af', 'Afrikaans'], ['sq', 'Albanian'], @@ -325,6 +337,13 @@ let INFO = ]; }, + labelAndValue: function (context) { + KeywordValueCompleter.label(context); + context.completions.forEach(function (it) { + it[0] = 'label:' + it[0]; + }); + }, + has: simpleValueCompleter('attachment'.split(/\s/).sort()), is: simpleValueCompleter('read unread starred chat voicemail muted sent'.split(/\s/).sort()), @@ -372,6 +391,8 @@ let INFO = context.completions = [ [v + ':', v] for ([, v] in Iterator(GMailSearchKeyword)) ]; + if (Conf.labelShortcut) + context.fork('Label+', 0, context, KeywordValueCompleter.labelAndValue); } } -- cgit v1.2.3