mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:57:59 +01:00
use literalArg with :!
This commit is contained in:
@@ -340,16 +340,15 @@ function IO() //{{{
|
|||||||
"Run a command",
|
"Run a command",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
let special = args.bang;
|
let arg = args.literalArg;
|
||||||
args = args.string;
|
|
||||||
|
|
||||||
// :!! needs to be treated specially as the command parser sets the
|
// :!! needs to be treated specially as the command parser sets the
|
||||||
// special flag but removes the ! from args
|
// bang flag but removes the ! from arg
|
||||||
if (special)
|
if (args.bang)
|
||||||
args = "!" + args;
|
arg = "!" + arg;
|
||||||
|
|
||||||
// replaceable bang and no previous command?
|
// replaceable bang and no previous command?
|
||||||
if (/((^|[^\\])(\\\\)*)!/.test(args) && !lastRunCommand)
|
if (/((^|[^\\])(\\\\)*)!/.test(arg) && !lastRunCommand)
|
||||||
{
|
{
|
||||||
liberator.echoerr("E34: No previous command");
|
liberator.echoerr("E34: No previous command");
|
||||||
return;
|
return;
|
||||||
@@ -357,13 +356,13 @@ function IO() //{{{
|
|||||||
|
|
||||||
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
|
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
|
||||||
// pass through a raw bang when escaped or substitute the last command
|
// pass through a raw bang when escaped or substitute the last command
|
||||||
args = args.replace(/(\\)*!/g,
|
arg = arg.replace(/(\\)*!/g,
|
||||||
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", lastRunCommand)
|
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", lastRunCommand)
|
||||||
);
|
);
|
||||||
|
|
||||||
lastRunCommand = args;
|
lastRunCommand = arg;
|
||||||
|
|
||||||
let output = io.system(args);
|
let output = io.system(arg);
|
||||||
|
|
||||||
commandline.echo(template.commandOutput(<span highlight="CmdOutput">{output}</span>));
|
commandline.echo(template.commandOutput(<span highlight="CmdOutput">{output}</span>));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user