mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 03:42:27 +01:00
add initial implementation of 'shell' and 'shellcmdflag' options
This commit is contained in:
1
NEWS
1
NEWS
@@ -15,6 +15,7 @@
|
|||||||
generous donation which made this behavior possible)
|
generous donation which made this behavior possible)
|
||||||
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
|
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
|
||||||
too unpredictable
|
too unpredictable
|
||||||
|
* add 'shell' and 'shellcmdflag' options
|
||||||
* :tabprevious, :bprevious, :tabnext, :bnext and friends now accept a prefix count
|
* :tabprevious, :bprevious, :tabnext, :bnext and friends now accept a prefix count
|
||||||
* add :comclear and :delcommand
|
* add :comclear and :delcommand
|
||||||
* add a special version to :hardcopy to skip the Print dialog
|
* add a special version to :hardcopy to skip the Print dialog
|
||||||
|
|||||||
@@ -41,6 +41,34 @@ liberator.IO = function () //{{{
|
|||||||
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 :!
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
////////////////////// OPTIONS ////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
var shell, shellcmdflag;
|
||||||
|
|
||||||
|
if (WINDOWS)
|
||||||
|
{
|
||||||
|
shell = "cmd.exe";
|
||||||
|
// TODO: does setting 'shell' to "something containing sh"
|
||||||
|
// automatically update 'shellcmdflag' on Windows in Vim?
|
||||||
|
shellcmdflag = "/c";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shell = environmentService.get("SHELL") || "sh";
|
||||||
|
shellcmdflag = "-c";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: setter should expand environment variables
|
||||||
|
liberator.options.add(["shell", "sh"],
|
||||||
|
"Shell to use for executing :! and :run commands",
|
||||||
|
"string", shell);
|
||||||
|
|
||||||
|
liberator.options.add(["shellcmdflag", "shcf"],
|
||||||
|
"Flag passed to shell when executing :! and :run commands",
|
||||||
|
"string", shellcmdflag);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
@@ -507,7 +535,6 @@ 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
|
||||||
// TODO: add shell/shellcmdflag options to replace "sh" and "-c"
|
|
||||||
system: function (str, input)
|
system: function (str, input)
|
||||||
{
|
{
|
||||||
var fileout = ioManager.createTempFile();
|
var fileout = ioManager.createTempFile();
|
||||||
@@ -527,11 +554,8 @@ lookup:
|
|||||||
command += " < \"" + filein.path.replace('"', '\\"') + "\"";
|
command += " < \"" + filein.path.replace('"', '\\"') + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
var res;
|
// FIXME: why is this return value being ignored?
|
||||||
if (WINDOWS)
|
var res = ioManager.run(liberator.options["shell"], [liberator.options["shellcmdflag"], command], true);
|
||||||
res = ioManager.run("cmd.exe", ["/C", command], true);
|
|
||||||
else
|
|
||||||
res = ioManager.run("sh", ["-c", command], true);
|
|
||||||
|
|
||||||
var output = ioManager.readFile(fileout);
|
var output = ioManager.readFile(fileout);
|
||||||
fileout.remove(false);
|
fileout.remove(false);
|
||||||
|
|||||||
@@ -528,13 +528,29 @@ value can be reset to half the window height with [c]:set scroll=0[c].
|
|||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|\'nosmd'| |\'noshowmode'| |\'smd'| |\'showmode'|
|
|\'shell'| |\'sh'|
|
||||||
||'showmode' 'smd'|| boolean (default: on)
|
||'shell' 'sh'|| string (default: on)
|
||||||
____
|
____
|
||||||
Show the current mode in the command line.
|
Show the current mode in the command line.
|
||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|
|\'shellcmdflag'| |\'shcf'|
|
||||||
|
||'shellcmdflag' 'shcf'|| string (default: $SHELL or "sh", Win32: "cmd.exe")
|
||||||
|
____
|
||||||
|
Shell to use for executing :! and :run commands.
|
||||||
|
____
|
||||||
|
|
||||||
|
|
||||||
|
|\'nosmd'| |\'noshowmode'| |\'smd'| |\'showmode'|
|
||||||
|
||'showmode' 'smd'|| boolean (default: "-c", Win32: "/c")
|
||||||
|
____
|
||||||
|
Flag passed to shell when executing :! and :run commands.
|
||||||
|
|
||||||
|
E.g. bash -c gvim
|
||||||
|
____
|
||||||
|
|
||||||
|
|
||||||
|\'ssli'| |\'showstatuslinks'|
|
|\'ssli'| |\'showstatuslinks'|
|
||||||
||'showstatuslinks' 'ssli'|| number (default: 1)
|
||'showstatuslinks' 'ssli'|| number (default: 1)
|
||||||
____
|
____
|
||||||
|
|||||||
Reference in New Issue
Block a user