From 71d9a2d32e5feaea2557a5ab1ee80b10a3f7f99c Mon Sep 17 00:00:00 2001 From: secondlife Date: Wed, 18 Feb 2009 05:11:34 +0000 Subject: ヒストリ検索プラグイン git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30209 d0d07461-0603-4401-acd4-de1884942a52 --- history-search-backward.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 history-search-backward.js (limited to 'history-search-backward.js') diff --git a/history-search-backward.js b/history-search-backward.js new file mode 100644 index 0000000..17319d3 --- /dev/null +++ b/history-search-backward.js @@ -0,0 +1,57 @@ +var PLUGIN_INFO = + +{NAME} +History search backward like UNIX shell. +UNIX シェルのような、C-rで履歴検索を行うプラグイン +2.0 +2.0 +http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/history-search-backward.js +Yuichi Tateno +MIT +0.1 +|| +liberator.globalVariables.history_search_backward_map = ['']; +||< + +]]> +; + +(function() { + let p = function(msg) { + Application.console.log(''+msg); + } + + const FAKE_TAB_EVENT = { + type: 'keypress', + liberatorString: '', + preventDefault: function() true, + stopPropagation: function() true, + }; + + mappings.addUserMap([modes.COMMAND_LINE], liberator.globalVariables.history_search_backward_map || [''], 'History search backward.', + function() + { + let command = commandline.command || ''; + commandline.input(options.get('wildoptions').has('auto') ? 'bck-i-search: ' : 'bck-search: ', function(str) { + try { + liberator.echo(liberator.execute(str)); + } catch(e) {}; + this.close(); + return; + }, { + completer: function(context) { + context.title = ['CommandLine History', 'INDEX']; + context.completions = [[key, i] for ([i, key] in storage['history-command'])].filter(function([key, i]) key).reverse(); + }, + onChange: function() { + // this.onEvent(FAKE_TAB_EVENT); + }, + default: command, + }); + }); + +})(); + + -- cgit v1.2.3