mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:17:59 +01:00
add :scriptnames
This commit is contained in:
1
NEWS
1
NEWS
@@ -3,6 +3,7 @@
|
||||
* version 2.0 (probably)
|
||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||
VimperatorLeave respectively
|
||||
* add :scriptnames
|
||||
* add commandline completion to 'activate', 'cpt', 'defsearch', 'pageinfo',
|
||||
'newtab' and 'popups'
|
||||
* add 'helpfile' option
|
||||
|
||||
@@ -40,6 +40,7 @@ liberator.IO = function () //{{{
|
||||
var cwd = null, oldcwd = null;
|
||||
var extname = liberator.config.name.toLowerCase(); // "vimperator" or "muttator"
|
||||
var lastRunCommand = ""; // updated whenever the users runs a command with :!
|
||||
var scriptNames = [];
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// OPTIONS ////////////////////////////////////////////////
|
||||
@@ -252,6 +253,21 @@ liberator.IO = function () //{{{
|
||||
liberator.io.writeFile(file, line);
|
||||
});
|
||||
|
||||
liberator.commands.add(["scrip[tnames]"],
|
||||
"List all sourced script names",
|
||||
function ()
|
||||
{
|
||||
var list = "<table>";
|
||||
|
||||
for (var i = 0; i < scriptNames.length; i++)
|
||||
list += "<tr><td style=\"text-align: right\">" + (i + 1) + ".</td><td>" + scriptNames[i] + "</td></tr>";
|
||||
|
||||
list += "</table>";
|
||||
|
||||
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
liberator.commands.add(["so[urce]"],
|
||||
"Read Ex commands from a file",
|
||||
function (args, special)
|
||||
@@ -676,9 +692,11 @@ lookup:
|
||||
// no need (actually forbidden) to add: js <<EOF ... EOF around those files
|
||||
source: function (filename, silent)
|
||||
{
|
||||
var file;
|
||||
|
||||
try
|
||||
{
|
||||
var file = ioManager.getFile(filename);
|
||||
file = ioManager.getFile(filename);
|
||||
|
||||
if (!file.exists() || !file.isReadable() || file.isDirectory())
|
||||
{
|
||||
@@ -693,7 +711,7 @@ lookup:
|
||||
return;
|
||||
}
|
||||
|
||||
var str = ioManager.readFile(filename);
|
||||
var str = ioManager.readFile(file);
|
||||
|
||||
// handle pure javascript files specially
|
||||
if (/\.js$/.test(filename))
|
||||
@@ -704,7 +722,6 @@ lookup:
|
||||
{
|
||||
var heredoc = "";
|
||||
var heredocEnd = null; // the string which ends the heredoc
|
||||
|
||||
var lines = str.split("\n");
|
||||
|
||||
for (let i = 0; i < lines.length; i++)
|
||||
@@ -762,13 +779,17 @@ lookup:
|
||||
liberator.eval(heredoc);
|
||||
}
|
||||
|
||||
liberator.log("Sourced: " + filename, 3);
|
||||
if (scriptNames.indexOf(file.path) == -1)
|
||||
scriptNames.push(file.path);
|
||||
|
||||
liberator.log("Sourced: " + file.path, 3);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
Components.utils.reportError("Sourcing file: " + filename + ": " + e);
|
||||
var message = "Sourcing file: " + file.path + ": " + e;
|
||||
Components.utils.reportError(message);
|
||||
if (!silent)
|
||||
liberator.echoerr("Sourcing file: " + filename + ": " + e);
|
||||
liberator.echoerr(message);
|
||||
}
|
||||
}
|
||||
}; //}}}
|
||||
|
||||
@@ -205,6 +205,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
|
||||
||:restart|| Force undefined to restart +
|
||||
||:saveas|| Save current document to disk +
|
||||
||:sbclose|| Close the sidebar window +
|
||||
||:scriptnames|| List all sourced script names +
|
||||
||:set|| Set an option +
|
||||
||:setglobal|| Set global option +
|
||||
||:setlocal|| Set local option +
|
||||
@@ -252,6 +253,7 @@ section:Options[option-index]
|
||||
||'focuscontent'|| Try to stay in normal mode after loading a web page +
|
||||
||'fullscreen'|| Show the current window fullscreen +
|
||||
||'guioptions'|| Show or hide certain GUI elements like the menu or toolbar +
|
||||
||'helpfile'|| Name of the main help file +
|
||||
||'hintmatching'|| How links are matched +
|
||||
||'hintstyle'|| CSS specification of unfocused hints +
|
||||
||'hinttags'|| XPath string of hintable elements activated by 'f' and 'F' +
|
||||
|
||||
@@ -80,6 +80,13 @@ printed.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|:scrip| |:scriptnames|
|
||||
||:scrip[tnames]|| +
|
||||
________________________________________________________________________________
|
||||
List all sourced script names, in the order they were first sourced.
|
||||
________________________________________________________________________________
|
||||
|
||||
|
||||
|:fini| |:finish|
|
||||
||:fini[sh]|| +
|
||||
________________________________________________________________________________
|
||||
|
||||
Reference in New Issue
Block a user