mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 13:42:27 +01:00
add rough initial implementations of :message, g< (gm for now) and 'messages'
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,10 +1,13 @@
|
|||||||
<pre>
|
<pre>
|
||||||
2008-XX-XX:
|
2008-XX-XX:
|
||||||
* version 2.0 (probably)
|
* version 2.0 (probably)
|
||||||
|
* IMPORTANT: 'verbose' is now used for message levels. Logging is
|
||||||
|
controlled by the extensions.liberator.loglevel preference.
|
||||||
* IMPORTANT: :viusage and :exusage now jump to the help index, use the
|
* IMPORTANT: :viusage and :exusage now jump to the help index, use the
|
||||||
special versions for the old behavior
|
special versions for the old behavior
|
||||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||||
VimperatorLeave respectively
|
VimperatorLeave respectively
|
||||||
|
* add :messages and 'messages'
|
||||||
* add :runtime
|
* add :runtime
|
||||||
* add 'runtimepath'
|
* add 'runtimepath'
|
||||||
* allow ; hints to work in the multiline output widget
|
* allow ; hints to work in the multiline output widget
|
||||||
|
|||||||
@@ -242,6 +242,8 @@ liberator.AutoCommands = function () //{{{
|
|||||||
if (events.some(function (event) event == "all" || event == auEvent))
|
if (events.some(function (event) event == "all" || event == auEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
liberator.echomsg("Executing " + auEvent + " Auto commands for \"*\"", 8);
|
||||||
|
|
||||||
if (autoCommands[auEvent])
|
if (autoCommands[auEvent])
|
||||||
{
|
{
|
||||||
for (let i = 0; i < autoCommands[auEvent].length; i++)
|
for (let i = 0; i < autoCommands[auEvent].length; i++)
|
||||||
@@ -494,7 +496,7 @@ liberator.Events = function () //{{{
|
|||||||
}
|
}
|
||||||
else // background tab
|
else // background tab
|
||||||
{
|
{
|
||||||
liberator.commandline.echo("Background tab loaded: " + title || url, liberator.commandline.HL_INFOMSG);
|
liberator.echomsg("Background tab loaded: " + title || url, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,8 +559,7 @@ liberator.Events = function () //{{{
|
|||||||
{
|
{
|
||||||
for (let [,dir] in Iterator(dirs))
|
for (let [,dir] in Iterator(dirs))
|
||||||
{
|
{
|
||||||
if (liberator.options["verbose"] >= 2)
|
liberator.echomsg("Searching for \"macros/*\" in \"" + dir.path + "\"", 2);
|
||||||
liberator.echo("Searching for \"macros/*\" in \"" + dir.path + "\"\n");
|
|
||||||
|
|
||||||
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
|
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
|
||||||
|
|
||||||
|
|||||||
@@ -375,9 +375,11 @@ liberator.Search = function () //{{{
|
|||||||
// our command line
|
// our command line
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (up)
|
if (up)
|
||||||
liberator.commandline.echo("search hit TOP, continuing at BOTTOM", liberator.commandline.HL_WARNINGMSG);
|
liberator.commandline.echo("search hit TOP, continuing at BOTTOM",
|
||||||
|
liberator.commandline.HL_WARNINGMSG, liberator.commandline.APPEND_TO_MESSAGES);
|
||||||
else
|
else
|
||||||
liberator.commandline.echo("search hit BOTTOM, continuing at TOP", liberator.commandline.HL_WARNINGMSG);
|
liberator.commandline.echo("search hit BOTTOM, continuing at TOP",
|
||||||
|
liberator.commandline.HL_WARNINGMSG, liberator.commandline.APPEND_TO_MESSAGES);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -273,6 +273,10 @@ liberator.IO = function () //{{{
|
|||||||
// : unify with startup sourcing loop
|
// : unify with startup sourcing loop
|
||||||
let paths = args.arguments;
|
let paths = args.arguments;
|
||||||
let runtimeDirs = liberator.options["runtimepath"].split(",");
|
let runtimeDirs = liberator.options["runtimepath"].split(",");
|
||||||
|
let found = false;
|
||||||
|
|
||||||
|
// FIXME: should use original arg string
|
||||||
|
liberator.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + liberator.options["runtimepath"] + "\"", 2);
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
for (let [,runtimeDir] in Iterator(runtimeDirs))
|
for (let [,runtimeDir] in Iterator(runtimeDirs))
|
||||||
@@ -281,8 +285,11 @@ liberator.IO = function () //{{{
|
|||||||
{
|
{
|
||||||
let file = liberator.io.getFile(joinPaths(runtimeDir, path));
|
let file = liberator.io.getFile(joinPaths(runtimeDir, path));
|
||||||
|
|
||||||
|
liberator.echomsg("Searching for \"" + file.path + "\" in \"", 3);
|
||||||
|
|
||||||
if (file.exists() && file.isReadable() && !file.isDirectory()) // XXX
|
if (file.exists() && file.isReadable() && !file.isDirectory()) // XXX
|
||||||
{
|
{
|
||||||
|
found = true;
|
||||||
liberator.io.source(file.path, false);
|
liberator.io.source(file.path, false);
|
||||||
|
|
||||||
if (!special)
|
if (!special)
|
||||||
@@ -290,6 +297,9 @@ liberator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1); // FIXME: should use original arg string
|
||||||
},
|
},
|
||||||
{ argCount: "+" }
|
{ argCount: "+" }
|
||||||
);
|
);
|
||||||
@@ -696,8 +706,10 @@ lookup:
|
|||||||
|
|
||||||
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
|
// when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is fixed
|
||||||
// is fixed, should use that instead of a tmpfile
|
// is fixed, should use that instead of a tmpfile
|
||||||
system: function (str, input)
|
system: function (command, input)
|
||||||
{
|
{
|
||||||
|
liberator.echomsg("Calling shell to execute: " + command, 4);
|
||||||
|
|
||||||
var stdoutFile = ioManager.createTempFile();
|
var stdoutFile = ioManager.createTempFile();
|
||||||
var stderrFile = ioManager.createTempFile();
|
var stderrFile = ioManager.createTempFile();
|
||||||
|
|
||||||
@@ -707,10 +719,9 @@ lookup:
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
var command = str + " > " + stdoutFile.path + " 2> " + stderrFile.path;
|
command += " > " + stdoutFile.path + " 2> " + stderrFile.path;
|
||||||
else
|
else
|
||||||
var command = str + " > \"" + escapeQuotes(stdoutFile.path) + "\""
|
command += " > \"" + escapeQuotes(stdoutFile.path) + "\"" + " 2> \"" + escapeQuotes(stderrFile.path) + "\"";
|
||||||
+ " 2> \"" + escapeQuotes(stderrFile.path) + "\"";
|
|
||||||
|
|
||||||
var stdinFile = null;
|
var stdinFile = null;
|
||||||
|
|
||||||
@@ -754,7 +765,9 @@ lookup:
|
|||||||
if (!silent)
|
if (!silent)
|
||||||
{
|
{
|
||||||
if (file.isDirectory())
|
if (file.isDirectory())
|
||||||
liberator.echo("Cannot source a directory: \"" + filename + "\"\n");
|
liberator.echomsg("Cannot source a directory: \"" + filename + "\"", 0);
|
||||||
|
else
|
||||||
|
liberator.echomsg("could not source: \"" + filename + "\"", 1);
|
||||||
|
|
||||||
liberator.echoerr("E484: Can't open file " + filename);
|
liberator.echoerr("E484: Can't open file " + filename);
|
||||||
}
|
}
|
||||||
@@ -762,6 +775,8 @@ lookup:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
liberator.echomsg("sourcing \"" + filename + "\"", 2);
|
||||||
|
|
||||||
var str = ioManager.readFile(file);
|
var str = ioManager.readFile(file);
|
||||||
|
|
||||||
// handle pure javascript files specially
|
// handle pure javascript files specially
|
||||||
@@ -833,6 +848,8 @@ lookup:
|
|||||||
if (scriptNames.indexOf(file.path) == -1)
|
if (scriptNames.indexOf(file.path) == -1)
|
||||||
scriptNames.push(file.path);
|
scriptNames.push(file.path);
|
||||||
|
|
||||||
|
liberator.echomsg("finished sourcing \"" + filename + "\"", 2);
|
||||||
|
|
||||||
liberator.log("Sourced: " + file.path, 3);
|
liberator.log("Sourced: " + file.path, 3);
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ const liberator = (function () //{{{
|
|||||||
"boolean", true);
|
"boolean", true);
|
||||||
|
|
||||||
liberator.options.add(["verbose", "vbs"],
|
liberator.options.add(["verbose", "vbs"],
|
||||||
"Define which type of messages are logged",
|
"Define which info messages are displayed",
|
||||||
"number", 0,
|
"number", 0,
|
||||||
{
|
{
|
||||||
validator: function (value) value >= 0 && value <= 9
|
validator: function (value) value >= 0 && value <= 15
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["visualbell", "vb"],
|
liberator.options.add(["visualbell", "vb"],
|
||||||
@@ -785,7 +785,25 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
echo: function (str, flags) { liberator.commandline.echo(str, liberator.commandline.HL_NORMAL, flags); },
|
echo: function (str, flags) { liberator.commandline.echo(str, liberator.commandline.HL_NORMAL, flags); },
|
||||||
|
|
||||||
echoerr: function (str, flags) { liberator.commandline.echo(str, liberator.commandline.HL_ERRORMSG, flags); },
|
// TODO: Vim replaces unprintable characters in echoerr/echomsg
|
||||||
|
echoerr: function (str, flags)
|
||||||
|
{
|
||||||
|
flags |= liberator.commandline.APPEND_TO_MESSAGES;
|
||||||
|
|
||||||
|
liberator.commandline.echo(str, liberator.commandline.HL_ERRORMSG, flags);
|
||||||
|
},
|
||||||
|
|
||||||
|
// TODO: add proper level constants
|
||||||
|
echomsg: function (str, verbosity, flags)
|
||||||
|
{
|
||||||
|
flags |= liberator.commandline.APPEND_TO_MESSAGES;
|
||||||
|
|
||||||
|
if (verbosity == null)
|
||||||
|
verbosity = 0; // verbosity level is exclusionary
|
||||||
|
|
||||||
|
if (liberator.options["verbose"] >= verbosity)
|
||||||
|
liberator.commandline.echo(str, liberator.commandline.HL_INFOMSG, flags);
|
||||||
|
},
|
||||||
|
|
||||||
// return true, if this VIM-like extension has a certain feature
|
// return true, if this VIM-like extension has a certain feature
|
||||||
has: function (feature)
|
has: function (feature)
|
||||||
@@ -853,15 +871,16 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
// logs a message to the javascript error console
|
// logs a message to the javascript error console
|
||||||
// if msg is an object, it is beautified
|
// if msg is an object, it is beautified
|
||||||
|
// TODO: add proper level constants
|
||||||
log: function (msg, level)
|
log: function (msg, level)
|
||||||
{
|
{
|
||||||
var verbose = 0;
|
var verbose = 0;
|
||||||
if (typeof level != "number")
|
if (typeof level != "number") // XXX
|
||||||
level = 1;
|
level = 1;
|
||||||
|
|
||||||
// liberator.options does not exist at the very beginning
|
// liberator.options does not exist at the very beginning
|
||||||
if (liberator.options)
|
if (liberator.options)
|
||||||
verbose = liberator.options["verbose"];
|
verbose = liberator.options.getPref("extensions.liberator.loglevel", 0);
|
||||||
|
|
||||||
if (level > verbose)
|
if (level > verbose)
|
||||||
return;
|
return;
|
||||||
@@ -871,7 +890,7 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
||||||
.getService(Components.interfaces.nsIConsoleService);
|
.getService(Components.interfaces.nsIConsoleService);
|
||||||
consoleService.logStringMessage("vimperator: " + msg);
|
consoleService.logStringMessage(liberator.config.name.toLowerCase() + ": " + msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
// open one or more URLs
|
// open one or more URLs
|
||||||
@@ -1080,8 +1099,7 @@ const liberator = (function () //{{{
|
|||||||
for (let [,dir] in Iterator(dirs))
|
for (let [,dir] in Iterator(dirs))
|
||||||
{
|
{
|
||||||
// TODO: search plugins/**/* for plugins
|
// TODO: search plugins/**/* for plugins
|
||||||
if (liberator.options["verbose"] >= 2)
|
liberator.echomsg("Searching for \"plugin/*.{js,vimp}\" in \"" + dir.path + "\"", 2);
|
||||||
liberator.echo("Searching for \"plugin/*.{js,vimp}\" in \"" + dir.path + "\"\n");
|
|
||||||
|
|
||||||
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
|
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ liberator.Options = function () //{{{
|
|||||||
|
|
||||||
function loadPreference(name, forcedDefault, defaultBranch)
|
function loadPreference(name, forcedDefault, defaultBranch)
|
||||||
{
|
{
|
||||||
var defaultValue = null;
|
var defaultValue = null; // XXX
|
||||||
if (forcedDefault != null) // this argument sets defaults for non-user settable options (like extensions.history.comp_history)
|
if (forcedDefault != null) // this argument sets defaults for non-user settable options (like extensions.history.comp_history)
|
||||||
defaultValue = forcedDefault;
|
defaultValue = forcedDefault;
|
||||||
|
|
||||||
|
|||||||
196
content/ui.js
196
content/ui.js
@@ -43,7 +43,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
liberator.storage.newArray("history-search", true);
|
liberator.storage.newArray("history-search", true);
|
||||||
liberator.storage.newArray("history-command", true);
|
liberator.storage.newArray("history-command", true);
|
||||||
|
|
||||||
// TODO: clean this up when it's not 3am...
|
|
||||||
var history = {
|
var history = {
|
||||||
get mode() (liberator.modes.extended == liberator.modes.EX) ? "command" : "search",
|
get mode() (liberator.modes.extended == liberator.modes.EX) ? "command" : "search",
|
||||||
|
|
||||||
@@ -67,6 +66,34 @@ liberator.CommandLine = function () //{{{
|
|||||||
var historyIndex = UNINITIALIZED;
|
var historyIndex = UNINITIALIZED;
|
||||||
var historyStart = "";
|
var historyStart = "";
|
||||||
|
|
||||||
|
var messageHistory = {
|
||||||
|
_messages: [],
|
||||||
|
get messages()
|
||||||
|
{
|
||||||
|
let max = liberator.options["messages"];
|
||||||
|
|
||||||
|
// resize if 'messages' has changed
|
||||||
|
if (this._messages.length > max)
|
||||||
|
this._messages = this._messages.splice(this._messages.length - max);
|
||||||
|
|
||||||
|
return this._messages;
|
||||||
|
},
|
||||||
|
|
||||||
|
get length() this._messages.length,
|
||||||
|
|
||||||
|
add: function (message)
|
||||||
|
{
|
||||||
|
if (!message)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this._messages.length >= liberator.options["messages"])
|
||||||
|
this._messages.shift();
|
||||||
|
|
||||||
|
this._messages.push(message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var lastMowOutput = null;
|
||||||
|
|
||||||
var completionList = new liberator.ItemList("liberator-completions");
|
var completionList = new liberator.ItemList("liberator-completions");
|
||||||
var completions = [];
|
var completions = [];
|
||||||
// for the example command "open sometext| othertext" (| is the cursor pos):
|
// for the example command "open sometext| othertext" (| is the cursor pos):
|
||||||
@@ -97,8 +124,8 @@ liberator.CommandLine = function () //{{{
|
|||||||
multilineOutputWidget.contentDocument.body.id = "liberator-multiline-output-content";
|
multilineOutputWidget.contentDocument.body.id = "liberator-multiline-output-content";
|
||||||
|
|
||||||
// TODO: is there a better way to determine and set the UI font, 'guifont' perhaps?
|
// TODO: is there a better way to determine and set the UI font, 'guifont' perhaps?
|
||||||
var id = liberator.config.mainWindowID || "main-window";
|
var mainWindowID = liberator.config.mainWindowID || "main-window";
|
||||||
var fontSize = document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue("font-size");
|
var fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null).getPropertyValue("font-size");
|
||||||
multilineOutputWidget.contentDocument.body.setAttribute("style", "font-size: " + fontSize);
|
multilineOutputWidget.contentDocument.body.setAttribute("style", "font-size: " + fontSize);
|
||||||
|
|
||||||
multilineOutputWidget.contentDocument.body.innerHTML = "";
|
multilineOutputWidget.contentDocument.body.innerHTML = "";
|
||||||
@@ -188,6 +215,9 @@ liberator.CommandLine = function () //{{{
|
|||||||
//outputContainer.collapsed = true;
|
//outputContainer.collapsed = true;
|
||||||
|
|
||||||
var output = "<div class=\"ex-command-output " + highlightGroup + "\">" + str + "</div>";
|
var output = "<div class=\"ex-command-output " + highlightGroup + "\">" + str + "</div>";
|
||||||
|
|
||||||
|
lastMowOutput = output;
|
||||||
|
|
||||||
if (!outputContainer.collapsed)
|
if (!outputContainer.collapsed)
|
||||||
{
|
{
|
||||||
// FIXME: need to make sure an open MOW is closed when commands
|
// FIXME: need to make sure an open MOW is closed when commands
|
||||||
@@ -276,17 +306,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
liberator.options.add(["history", "hi"],
|
|
||||||
"Number of Ex commands and search patterns to store in the command-line history",
|
|
||||||
"number", 500,
|
|
||||||
{
|
|
||||||
validator: function (value) value >= 0
|
|
||||||
});
|
|
||||||
|
|
||||||
liberator.options.add(["more"],
|
|
||||||
"Pause the message list window when more than one screen of listings is displayed",
|
|
||||||
"boolean", true);
|
|
||||||
|
|
||||||
// TODO: doesn't belong in ui.js
|
// TODO: doesn't belong in ui.js
|
||||||
liberator.options.add(["complete", "cpt"],
|
liberator.options.add(["complete", "cpt"],
|
||||||
"Items which are completed at the :[tab]open prompt",
|
"Items which are completed at the :[tab]open prompt",
|
||||||
@@ -306,6 +325,28 @@ liberator.CommandLine = function () //{{{
|
|||||||
validator: function (value) !/[^sfbhSl]/.test(value)
|
validator: function (value) !/[^sfbhSl]/.test(value)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
liberator.options.add(["history", "hi"],
|
||||||
|
"Number of Ex commands and search patterns to store in the command-line history",
|
||||||
|
"number", 500,
|
||||||
|
{
|
||||||
|
validator: function (value) value >= 0
|
||||||
|
});
|
||||||
|
|
||||||
|
liberator.options.add(["messages", "msgs"],
|
||||||
|
"Number of messages to store in the message history",
|
||||||
|
"number", 100,
|
||||||
|
{
|
||||||
|
validator: function (value) value >= 0
|
||||||
|
});
|
||||||
|
|
||||||
|
liberator.options.add(["more"],
|
||||||
|
"Pause the message list window when more than one screen of listings is displayed",
|
||||||
|
"boolean", true);
|
||||||
|
|
||||||
|
liberator.options.add(["showmode", "smd"],
|
||||||
|
"Show the current mode in the command line",
|
||||||
|
"boolean", true);
|
||||||
|
|
||||||
liberator.options.add(["suggestengines"],
|
liberator.options.add(["suggestengines"],
|
||||||
"Engine Alias which has a feature of suggest",
|
"Engine Alias which has a feature of suggest",
|
||||||
"stringlist", "google",
|
"stringlist", "google",
|
||||||
@@ -331,9 +372,24 @@ liberator.CommandLine = function () //{{{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["showmode", "smd"],
|
liberator.options.add(["wildignore", "wig"],
|
||||||
"Show the current mode in the command line",
|
"List of file patterns to ignore when completing files",
|
||||||
"boolean", true);
|
"stringlist", "",
|
||||||
|
{
|
||||||
|
validator: function (value)
|
||||||
|
{
|
||||||
|
// TODO: allow for escaping the ","
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new RegExp("^(" + value.replace(",", "|", "g") + ")$");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
liberator.options.add(["wildmode", "wim"],
|
liberator.options.add(["wildmode", "wim"],
|
||||||
"Define how command line completion works",
|
"Define how command line completion works",
|
||||||
@@ -358,25 +414,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["wildignore", "wig"],
|
|
||||||
"List of file patterns to ignore when completing files",
|
|
||||||
"stringlist", "",
|
|
||||||
{
|
|
||||||
validator: function (value)
|
|
||||||
{
|
|
||||||
// TODO: allow for escaping the ","
|
|
||||||
try
|
|
||||||
{
|
|
||||||
new RegExp("^(" + value.replace(",", "|", "g") + ")$");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
liberator.options.add(["wildoptions", "wop"],
|
liberator.options.add(["wildoptions", "wop"],
|
||||||
"Change how command line completion is done",
|
"Change how command line completion is done",
|
||||||
"stringlist", "",
|
"stringlist", "",
|
||||||
@@ -418,33 +455,74 @@ liberator.CommandLine = function () //{{{
|
|||||||
["<C-]>", "<C-5>"], "Expand command line abbreviation",
|
["<C-]>", "<C-5>"], "Expand command line abbreviation",
|
||||||
function () { liberator.editor.expandAbbreviation("c"); });
|
function () { liberator.editor.expandAbbreviation("c"); });
|
||||||
|
|
||||||
|
// FIXME: Should be "g<" but that doesn't work unless it has a non-null
|
||||||
|
// rhs, getCandidates broken?
|
||||||
|
liberator.mappings.add([liberator.modes.NORMAL],
|
||||||
|
["gm"], "Redisplay the last command output",
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
if (lastMowOutput)
|
||||||
|
liberator.commandline.echo(lastMowOutput,
|
||||||
|
liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE)
|
||||||
|
else
|
||||||
|
liberator.beep();
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
liberator.commands.add(["ec[ho]"],
|
var echoCommands = [
|
||||||
"Display a string at the bottom of the window",
|
|
||||||
function (args)
|
|
||||||
{
|
{
|
||||||
var res = echoArgumentToString(args, true);
|
name: "ec[ho]",
|
||||||
if (res != null)
|
description: "Display a string at the bottom of the window",
|
||||||
liberator.echo(res);
|
action: liberator.echo
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) liberator.completion.javascript(filter)
|
name: "echoe[rr]",
|
||||||
});
|
description: "Display an error string at the bottom of the window",
|
||||||
|
action: liberator.echoerr
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "echom[sg]",
|
||||||
|
description: "Display a message at the bottom of the window saving it in the message history",
|
||||||
|
action: liberator.echomsg
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
liberator.commands.add(["echoe[rr]"],
|
echoCommands.forEach(function (command) {
|
||||||
"Display an error string at the bottom of the window",
|
liberator.commands.add([command.name],
|
||||||
function (args)
|
command.description,
|
||||||
|
function (args)
|
||||||
|
{
|
||||||
|
var str = echoArgumentToString(args, true);
|
||||||
|
if (str != null)
|
||||||
|
command.action(str);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
completer: function (filter) liberator.completion.javascript(filter)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
liberator.commands.add(["mes[sages]"],
|
||||||
|
"Display previously given messages",
|
||||||
|
function ()
|
||||||
{
|
{
|
||||||
var res = echoArgumentToString(args, false);
|
// TODO: the MOW<->command-line disjoint is really annoying
|
||||||
if (res != null)
|
if (messageHistory.length == 1)
|
||||||
liberator.echoerr(res);
|
{
|
||||||
},
|
liberator.commandline.echo(messageHistory.messages[0], liberator.commandline.HL_NORMAL);
|
||||||
{
|
}
|
||||||
completer: function (filter) liberator.completion.javascript(filter)
|
else if (messageHistory.length > 1)
|
||||||
});
|
{
|
||||||
|
let list = "";
|
||||||
|
|
||||||
|
for (let [,message] in Iterator(messageHistory.messages))
|
||||||
|
list += message + "<br/>";
|
||||||
|
|
||||||
|
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
||||||
|
}
|
||||||
|
}, { argCount: "0" });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
@@ -466,7 +544,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
DISALLOW_MULTILINE : 1 << 2, // if an echo() should try to use the single line
|
DISALLOW_MULTILINE : 1 << 2, // if an echo() should try to use the single line
|
||||||
// but output nothing when the MOW is open; when also
|
// but output nothing when the MOW is open; when also
|
||||||
// FORCE_MULTILINE is given, FORCE_MULTILINE takes precedence
|
// FORCE_MULTILINE is given, FORCE_MULTILINE takes precedence
|
||||||
APPEND_TO_MESSAGES : 1 << 3, // will show the string in :messages
|
APPEND_TO_MESSAGES : 1 << 3, // add the string to the message history
|
||||||
|
|
||||||
get mode() (liberator.modes.extended == liberator.modes.EX) ? "cmd" : "search",
|
get mode() (liberator.modes.extended == liberator.modes.EX) ? "cmd" : "search",
|
||||||
|
|
||||||
@@ -523,7 +601,6 @@ liberator.CommandLine = function () //{{{
|
|||||||
setLine("", this.HL_NORMAL);
|
setLine("", this.HL_NORMAL);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: add :messages entry
|
|
||||||
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
||||||
echo: function (str, highlightGroup, flags)
|
echo: function (str, highlightGroup, flags)
|
||||||
{
|
{
|
||||||
@@ -540,6 +617,9 @@ liberator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
highlightGroup = highlightGroup || this.HL_NORMAL;
|
highlightGroup = highlightGroup || this.HL_NORMAL;
|
||||||
|
|
||||||
|
if (flags & this.APPEND_TO_MESSAGES)
|
||||||
|
messageHistory.add(str);
|
||||||
|
|
||||||
var where = setLine;
|
var where = setLine;
|
||||||
if (flags & this.FORCE_MULTILINE)
|
if (flags & this.FORCE_MULTILINE)
|
||||||
where = setMultiline;
|
where = setMultiline;
|
||||||
@@ -1133,8 +1213,8 @@ liberator.ItemList = function (id) //{{{
|
|||||||
|
|
||||||
doc.body.id = id + "-content";
|
doc.body.id = id + "-content";
|
||||||
|
|
||||||
var id = liberator.config.mainWindowID || "main-window";
|
var mainWindowID = liberator.config.mainWindowID || "main-window";
|
||||||
var fontSize = document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue("font-size");
|
var fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null).getPropertyValue("font-size");
|
||||||
doc.body.setAttribute("style", "font-size: " + fontSize);
|
doc.body.setAttribute("style", "font-size: " + fontSize);
|
||||||
|
|
||||||
var completions = []; // a reference to the Array of completions
|
var completions = []; // a reference to the Array of completions
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ liberator.config = { //{{{
|
|||||||
"buffer.html", "cmdline.html", "options.html", "pattern.html",
|
"buffer.html", "cmdline.html", "options.html", "pattern.html",
|
||||||
"tabs.html", "hints.html", "map.html", "eval.html", "marks.html",
|
"tabs.html", "hints.html", "map.html", "eval.html", "marks.html",
|
||||||
"repeat.html", "autocommands.html", "print.html", "gui.html",
|
"repeat.html", "autocommands.html", "print.html", "gui.html",
|
||||||
"developer.html", "various.html", "index.html"
|
"message.html", "developer.html", "various.html", "index.html"
|
||||||
],
|
],
|
||||||
|
|
||||||
init: function ()
|
init: function ()
|
||||||
|
|||||||
@@ -270,10 +270,11 @@ section:Options[option-index]
|
|||||||
||'linkfgcolor'|| Foreground color of a link during hint mode +
|
||'linkfgcolor'|| Foreground color of a link during hint mode +
|
||||||
||'linksearch'|| Limit the search to hyperlink text +
|
||'linksearch'|| Limit the search to hyperlink text +
|
||||||
||'loadplugins'|| Load plugin scripts when starting up +
|
||'loadplugins'|| Load plugin scripts when starting up +
|
||||||
|
||'messages'|| Number of messages to store in the message history +
|
||||||
||'more'|| Pause the message list window when more than one screen of listings is displayed +
|
||'more'|| Pause the message list window when more than one screen of listings is displayed +
|
||||||
||'newtab'|| Define which commands should output in a new tab by default +
|
||'newtab'|| Define which commands should output in a new tab by default +
|
||||||
||'nextpattern'|| Patterns to use when guessing the 'next' page in a document sequence +
|
||'nextpattern'|| Patterns to use when guessing the 'next' page in a document sequence +
|
||||||
||'online'|| Set the 'work offline' option +
|
||'online'|| Set the \'work offline' option +
|
||||||
||'pageinfo'|| Desired info on :pa[geinfo] +
|
||'pageinfo'|| Desired info on :pa[geinfo] +
|
||||||
||'popups'|| Where to show requested popup windows +
|
||'popups'|| Where to show requested popup windows +
|
||||||
||'preload'|| Speed up first time history/bookmark completion +
|
||'preload'|| Speed up first time history/bookmark completion +
|
||||||
@@ -290,7 +291,7 @@ section:Options[option-index]
|
|||||||
||'titlestring'|| Change the title of the window +
|
||'titlestring'|| Change the title of the window +
|
||||||
||'urlseparator'|| Set the separator regexp used to separate multiple URL args +
|
||'urlseparator'|| Set the separator regexp used to separate multiple URL args +
|
||||||
||'usermode'|| Show current website with a minimal style sheet to make it easily accessible +
|
||'usermode'|| Show current website with a minimal style sheet to make it easily accessible +
|
||||||
||'verbose'|| Define which type of messages are logged +
|
||'verbose'|| Define which info messages are displayed +
|
||||||
||'visualbell'|| Use visual bell instead of beeping on errors +
|
||'visualbell'|| Use visual bell instead of beeping on errors +
|
||||||
||'visualbellstyle'|| CSS specification of the visual bell +
|
||'visualbellstyle'|| CSS specification of the visual bell +
|
||||||
||'wildignore'|| List of file patterns to ignore when completing files +
|
||'wildignore'|| List of file patterns to ignore when completing files +
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ section:Help{nbsp}topics[overview]
|
|||||||
events.
|
events.
|
||||||
- help:Print[print.html]: Printing pages.
|
- help:Print[print.html]: Printing pages.
|
||||||
- help:GUI[gui.html]: Accessing Firefox menus, dialogs and the sidebar.
|
- help:GUI[gui.html]: Accessing Firefox menus, dialogs and the sidebar.
|
||||||
|
- help:Messages[message.html]: A description of messages and error messages.
|
||||||
- help:Developer{nbsp}information[developer.html]: How to write docs or
|
- help:Developer{nbsp}information[developer.html]: How to write docs or
|
||||||
plugins.
|
plugins.
|
||||||
- help:Various[various.html]: Other help which didn't fit into any other
|
- help:Various[various.html]: Other help which didn't fit into any other
|
||||||
|
|||||||
22
locale/en-US/message.txt
Normal file
22
locale/en-US/message.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
HEADER
|
||||||
|
|
||||||
|
|message-history| +
|
||||||
|
|
||||||
|
Vimperator stores all info and error messages in a message history. The type of
|
||||||
|
info messages output can be controlled by the 'verbose' option.
|
||||||
|
|
||||||
|
|:mes| |:messages| +
|
||||||
|
||:mes[sages]||
|
||||||
|
________________________________________________________________________________
|
||||||
|
Display previously given messages.
|
||||||
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
|gm| +
|
||||||
|
||gm||
|
||||||
|
________________________________________________________________________________
|
||||||
|
Redisplay the last command output. Only the most recent commands output is
|
||||||
|
available.
|
||||||
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
// vim: set syntax=asciidoc:
|
||||||
@@ -468,6 +468,13 @@ Load plugin scripts when starting up.
|
|||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|
|\'msgs'| |\'messages'|
|
||||||
|
||'messages' 'msgs'|| number (default: 100)
|
||||||
|
____
|
||||||
|
Number of messages to store in the message history.
|
||||||
|
____
|
||||||
|
|
||||||
|
|
||||||
|\'nomore'| |\'more'|
|
|\'nomore'| |\'more'|
|
||||||
||'more'|| boolean (default: on)
|
||'more'|| boolean (default: on)
|
||||||
____
|
____
|
||||||
@@ -708,10 +715,12 @@ ____
|
|||||||
|\'verbose', \'vbs'|
|
|\'verbose', \'vbs'|
|
||||||
||'verbose' 'vbs'|| number (default: 0)
|
||'verbose' 'vbs'|| number (default: 0)
|
||||||
____
|
____
|
||||||
Define which type of messages are logged.
|
Define which info messages are displayed.
|
||||||
When bigger than zero, Vimperator will give messages about what it is doing.
|
When bigger than zero, Vimperator will give messages about what it is doing.
|
||||||
They are printed to the error console which can be shown with [c]:javascript![c].
|
These can be viewed at any time with the [c]:messages[c] command. The highest
|
||||||
The highest value is 9, being the most verbose mode.
|
value is 15, being the most verbose mode.
|
||||||
|
|
||||||
|
TODO: list levels and associated messages
|
||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: VIMperator configuration file
|
" Language: VIMperator configuration file
|
||||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||||
" Last Change: 2008 Sep 21
|
" Last Change: 2008 Sep 27
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@@ -13,21 +13,19 @@ set cpo&vim
|
|||||||
syn include @javascriptTop syntax/javascript.vim
|
syn include @javascriptTop syntax/javascript.vim
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|
||||||
syn region vimperatorString start="\z(["']\)" end="\z1" skip="\\\\\|\\\z1" oneline
|
|
||||||
|
|
||||||
syn match vimperatorCommandStart "\%(^\s*:\=\)\@<=" nextgroup=vimperatorCommand,vimperatorAutoCmd
|
syn match vimperatorCommandStart "\%(^\s*:\=\)\@<=" nextgroup=vimperatorCommand,vimperatorAutoCmd
|
||||||
|
|
||||||
syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] b[uffer] ba[ck] bd[elete] beep bf[irst] bl[ast] bma[rk] bmarks
|
syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] b[uffer] ba[ck] bd[elete] beep bf[irst] bl[ast] bma[rk] bmarks
|
||||||
\ bn[ext] bN[ext] bp[revious] br[ewind] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cd chd[ir] cuna[bbrev] cm[ap]
|
\ bn[ext] bN[ext] bp[revious] br[ewind] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cd chd[ir] cuna[bbrev] cm[ap]
|
||||||
\ cmapc[lear] cno[remap] comc[lear] com[mand] cu[nmap] delbm[arks] delc[ommand] delmac[ros] delm[arks] delqm[arks] dia[log] dl
|
\ cmapc[lear] cno[remap] comc[lear] com[mand] cu[nmap] delbm[arks] delc[ommand] delmac[ros] delm[arks] delqm[arks] dia[log] dl
|
||||||
\ downl[oads] e[dit] ec[ho] echoe[rr] em[enu] exe[cute] exu[sage] fini[sh] files fo[rward] fw h[elp] ha[rdcopy] hist[ory] hs
|
\ downl[oads] e[dit] ec[ho] echoe[rr] echom[sg] em[enu] exe[cute] exu[sage] fini[sh] files fo[rward] fw h[elp] ha[rdcopy]
|
||||||
\ ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iuna[bbrev] iu[nmap] javas[cript] ju[mps] js let ls macros ma[rk] map
|
\ hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iuna[bbrev] iu[nmap] javas[cript] ju[mps] js let ls macros
|
||||||
\ mapc[lear] marks mkv[imperatorrc] no[remap] noh[lsearch] norm[al] o[pen] pa[geinfo] pagest[yle] pc[lose] pl[ay]
|
\ ma[rk] map mapc[lear] marks mes[sages] mkv[imperatorrc] no[remap] noh[lsearch] norm[al] o[pen] pa[geinfo] pagest[yle]
|
||||||
\ pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run ru[ntime]
|
\ pc[lose] pl[ay] pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run
|
||||||
\ sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] tN[ext] t[open] tab
|
\ ru[ntime] sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] tN[ext]
|
||||||
\ tabde[tach] tabd[uplicate] tabN[ext] tabc[lose] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen
|
\ t[open] tab tabde[tach] tabd[uplicate] tabN[ext] tabc[lose] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew
|
||||||
\ tabp[revious] tabr[ewind] tabs time tn[ext] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et] unm[ap] ve[rsion]
|
\ tabo[nly] tabopen tabp[revious] tabr[ewind] tabs time tn[ext] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et] unm[ap]
|
||||||
\ vie[wsource] viu[sage] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wqa[ll] wq xa[ll] zo[om]
|
\ ve[rsion] vie[wsource] viu[sage] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wqa[ll] wq xa[ll] zo[om]
|
||||||
\ contained
|
\ contained
|
||||||
|
|
||||||
syn match vimperatorCommand "!" contained
|
syn match vimperatorCommand "!" contained
|
||||||
@@ -45,7 +43,7 @@ syn region vimperatorSet matchgroup=vimperatorCommand start="\%(^\s*:\=\)\@<=\<\
|
|||||||
|
|
||||||
syn keyword vimperatorOption activate act activelinkfgcolor alfc activelinkbgcolor albc cdpath cd complete cpt defsearch ds editor
|
syn keyword vimperatorOption activate act activelinkfgcolor alfc activelinkbgcolor albc cdpath cd complete cpt defsearch ds editor
|
||||||
\ extendedhinttags eht eventignore ei guioptions go helpfile hf hintmatching hm hintstyle hs hinttags ht hinttimeout hto
|
\ extendedhinttags eht eventignore ei guioptions go helpfile hf hintmatching hm hintstyle hs hinttags ht hinttimeout hto
|
||||||
\ history hi hlsearchstyle hlss laststatus ls linkbgcolor lbc linkfgcolor lfc newtab nextpattern pageinfo pa
|
\ history hi hlsearchstyle hlss laststatus ls linkbgcolor lbc linkfgcolor lfc messages msgs newtab nextpattern pageinfo pa
|
||||||
\ popups pps previewheight pvh previouspattern runtimepath rtp scroll scr shell sh shellcmdflag shcf showstatuslinks ssli
|
\ popups pps previewheight pvh previouspattern runtimepath rtp scroll scr shell sh shellcmdflag shcf showstatuslinks ssli
|
||||||
\ showtabline stal suggestengines titlestring urlseparator verbose vbs visualbellstyle t_vb wildignore wig wildmode wim
|
\ showtabline stal suggestengines titlestring urlseparator verbose vbs visualbellstyle t_vb wildignore wig wildmode wim
|
||||||
\ wildoptions wop wordseparators wsp
|
\ wildoptions wop wordseparators wsp
|
||||||
@@ -67,15 +65,15 @@ syn region vimperatorJavascript start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=" end
|
|||||||
syn region vimperatorJavascript matchgroup=vimperatorJavascriptDelimiter
|
syn region vimperatorJavascript matchgroup=vimperatorJavascriptDelimiter
|
||||||
\ start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=<<\s*\z(\h\w*\)"hs=s+2 end="^\z1$" contains=@javascriptTop fold
|
\ start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=<<\s*\z(\h\w*\)"hs=s+2 end="^\z1$" contains=@javascriptTop fold
|
||||||
|
|
||||||
syn region vimperatorMap matchgroup=vimperatorCommand start="\%(^\s*:\=\)\@<=\<map\>" end="$" keepend oneline
|
|
||||||
\ contains=vimperatorNotation
|
|
||||||
|
|
||||||
syn match vimperatorNotation "<[0-9A-Za-z-]\+>"
|
syn match vimperatorNotation "<[0-9A-Za-z-]\+>"
|
||||||
|
|
||||||
syn match vimperatorLineComment +^\s*".*$+ contains=vimperatorTodo,@Spell
|
|
||||||
syn match vimperatorComment +".*$+ contains=vimperatorTodo,@Spell
|
syn match vimperatorComment +".*$+ contains=vimperatorTodo,@Spell
|
||||||
syn keyword vimperatorTodo FIXME NOTE TODO XXX contained
|
syn keyword vimperatorTodo FIXME NOTE TODO XXX contained
|
||||||
|
|
||||||
|
syn region vimperatorString start="\z(["']\)" end="\z1" skip="\\\\\|\\\z1" oneline
|
||||||
|
|
||||||
|
syn match vimperatorLineComment +^\s*".*$+ contains=vimperatorTodo,@Spell
|
||||||
|
|
||||||
" NOTE: match vim.vim highlighting group names
|
" NOTE: match vim.vim highlighting group names
|
||||||
hi def link vimperatorAutoCmd vimperatorCommand
|
hi def link vimperatorAutoCmd vimperatorCommand
|
||||||
hi def link vimperatorAutoEvent Type
|
hi def link vimperatorAutoEvent Type
|
||||||
|
|||||||
Reference in New Issue
Block a user