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