mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 18:25:48 +01:00
add help for :colorscheme and move completion function to
completion.colorScheme
This commit is contained in:
@@ -813,6 +813,19 @@ function Completion() //{{{
|
||||
return [0, buildLongestCommonSubstring(items, filter)];
|
||||
},
|
||||
|
||||
colorScheme: function colorScheme(filter)
|
||||
{
|
||||
let schemes = [];
|
||||
let rtp = options["runtimepath"].split(",");
|
||||
|
||||
rtp.forEach(function (path) {
|
||||
schemes = schemes.concat([[c[0].replace(/\.vimp$/, ""), ""]
|
||||
for each (c in completion.file(path + "/colors/", true)[1])]);
|
||||
});
|
||||
|
||||
return [0, completion.filter(schemes, filter)];
|
||||
},
|
||||
|
||||
command: function command(filter)
|
||||
{
|
||||
var completions = [];
|
||||
|
||||
@@ -362,30 +362,21 @@ const highlight = storage.newObject("highlight", Highlights, false);
|
||||
|
||||
liberator.registerObserver("load_commands", function ()
|
||||
{
|
||||
// TODO: :colo default needs :hi clear
|
||||
commands.add(["colo[rscheme]"],
|
||||
"Load a color scheme",
|
||||
function (args)
|
||||
{
|
||||
let scheme = args.arguments[0];
|
||||
|
||||
if (!io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
||||
if (io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
||||
autocommands.trigger("ColorScheme", {});
|
||||
else
|
||||
liberator.echoerr("E185: Cannot find color scheme " + scheme);
|
||||
},
|
||||
{
|
||||
argCount: 1,
|
||||
completer: function (filter)
|
||||
{
|
||||
let rtp = options["runtimepath"].split(",");
|
||||
let schemes = [];
|
||||
|
||||
rtp.forEach(function (path) {
|
||||
schemes = schemes.concat(
|
||||
[[c[0].replace(/\.vimp$/, ""), ""] for each (c in completion.file(path + "/colors/", true)[1])]
|
||||
)
|
||||
});
|
||||
|
||||
return [0, completion.filter(schemes, filter)];
|
||||
}
|
||||
completer: function (filter) completion.colorScheme(filter)
|
||||
});
|
||||
|
||||
commands.add(["sty[le]"],
|
||||
|
||||
@@ -39,6 +39,7 @@ const config = { //{{{
|
||||
get visualbellWindow() getBrowser().mPanelContainer,
|
||||
|
||||
autocommands: [["BookmarkAdd", "Triggered after a page is bookmarked"],
|
||||
["ColorScheme", "Triggered after a color scheme has been loaded"],
|
||||
["DOMLoad", "Triggered when a page's DOM content has fully loaded"],
|
||||
["DownloadPost", "Triggered when a download has completed"],
|
||||
["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"],
|
||||
|
||||
Reference in New Issue
Block a user