mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 11:58:00 +01:00
add completion.environment for environment variable completion
This commit is contained in:
@@ -32,6 +32,8 @@ liberator.Completion = function () //{{{
|
|||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
const WINDOWS = navigator.platform == "Win32";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var completionService = Components.classes["@mozilla.org/browser/global-history;2"]
|
var completionService = Components.classes["@mozilla.org/browser/global-history;2"]
|
||||||
@@ -705,6 +707,21 @@ liberator.Completion = function () //{{{
|
|||||||
|
|
||||||
dialog: function (filter) [0, this.filter(liberator.config.dialogs || [], filter)],
|
dialog: function (filter) [0, this.filter(liberator.config.dialogs || [], filter)],
|
||||||
|
|
||||||
|
environment: function (filter)
|
||||||
|
{
|
||||||
|
let command = WINDOWS ? "set" : "export";
|
||||||
|
let lines = liberator.io.system(command).split("\n");
|
||||||
|
|
||||||
|
lines.splice(lines.length - 1, 1);
|
||||||
|
|
||||||
|
let vars = lines.map(function (line) {
|
||||||
|
let matches = line.match(/([^=]+)=(.+)/);
|
||||||
|
return [matches[1], matches[2]];
|
||||||
|
});
|
||||||
|
|
||||||
|
return [0, this.filter(vars, filter)];
|
||||||
|
},
|
||||||
|
|
||||||
event: function (filter) [0, this.filter(liberator.config.autocommands, filter)],
|
event: function (filter) [0, this.filter(liberator.config.autocommands, filter)],
|
||||||
|
|
||||||
// provides completions for ex commands, including their arguments
|
// provides completions for ex commands, including their arguments
|
||||||
|
|||||||
Reference in New Issue
Block a user