mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-27 02:55:46 +01:00
:hi clear
This commit is contained in:
@@ -560,9 +560,17 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
]]>;
|
]]>;
|
||||||
|
let clear = args[0] == "clear";
|
||||||
|
if (clear)
|
||||||
|
args.shift();
|
||||||
|
|
||||||
let [key, css] = args;
|
let [key, css] = args;
|
||||||
if (!css && !(key && args.bang))
|
if (clear && css)
|
||||||
|
return liberator.echo("E488: Trailing characters");
|
||||||
|
|
||||||
|
if (!css && !clear)
|
||||||
{
|
{
|
||||||
|
// List matching keys
|
||||||
let str = template.tabular(["Key", "Sample", "CSS"],
|
let str = template.tabular(["Key", "Sample", "CSS"],
|
||||||
["padding: 0 1em 0 0; vertical-align: top", "text-align: center"],
|
["padding: 0 1em 0 0; vertical-align: top", "text-align: center"],
|
||||||
([h.class,
|
([h.class,
|
||||||
@@ -573,15 +581,24 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let error = highlight.set(key, css, args.bang, "-append" in args);
|
if (!key && clear)
|
||||||
|
{
|
||||||
|
for (let h in highlight)
|
||||||
|
highlight.set(h.class, null, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let error = highlight.set(key, css, clear, "-append" in args);
|
||||||
if (error)
|
if (error)
|
||||||
liberator.echoerr(error);
|
liberator.echoerr(error);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
|
||||||
// TODO: add this as a standard highlight completion function?
|
// TODO: add this as a standard highlight completion function?
|
||||||
completer: function (context, args)
|
completer: function (context, args)
|
||||||
{
|
{
|
||||||
|
// Complete a highlight group on :hi clear ...
|
||||||
|
if (args.completeArg > 0 && args[0] == "clear")
|
||||||
|
args.completeArg = args.completeArg > 1 ? -1 : 0;
|
||||||
|
|
||||||
if (args.completeArg == 0)
|
if (args.completeArg == 0)
|
||||||
context.completions = [[v.class, ""] for (v in highlight)];
|
context.completions = [[v.class, ""] for (v in highlight)];
|
||||||
else if (args.completeArg == 1)
|
else if (args.completeArg == 1)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ sourced.
|
|||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|:hi| |:highlight| +
|
|:hi| |:highlight| +
|
||||||
||:hi[light][!] [-append] {group}[{selector}] [{css}]|| +
|
||:hi[light] [-append] {group}[{selector}] [{css}]|| +
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
Highlight {group} with {css}. Normally, {css} is checked for
|
Highlight {group} with {css}. Normally, {css} is checked for
|
||||||
valid syntax before it's applied. Once you're certain it's
|
valid syntax before it's applied. Once you're certain it's
|
||||||
@@ -81,6 +81,14 @@ styles matching {group} are listed. If neither {css} nor [!] is provided, the
|
|||||||
style for {group} is reset to its default value.
|
style for {group} is reset to its default value.
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|:highlight-clear| +
|
||||||
|
||:hi[light] clear [{group}[{selector}]]|| +
|
||||||
|
________________________________________________________________________________
|
||||||
|
Reset the highlighting for {group} to its default value. If
|
||||||
|
{group} is not given, reset all highlighting groups.
|
||||||
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|:sty| |:style| +
|
|:sty| |:style| +
|
||||||
||:sty[le][!] [-name={name}] [-append] {filter} [{css}]|| +
|
||:sty[le][!] [-name={name}] [-append] {filter} [{css}]|| +
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|||||||
Reference in New Issue
Block a user