1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 09:27:58 +01:00

Replace the *.vimp file extension with config specific extensions.

This commit is contained in:
Doug Kearns
2010-10-01 02:43:02 +10:00
parent 002522c179
commit 725cf1f1f7
12 changed files with 29 additions and 18 deletions

View File

@@ -80,15 +80,21 @@ const ConfigBase = Class(ModuleBase, {
*/
features: [],
/**
* @property {string} The file extension used for command script files.
* This is the name string sans "dactyl".
*/
get fileExtension() this.name.slice(0, -6),
guioptions: {},
hasTabbrowser: false,
/**
* @property {string} The name of the application that hosts the
* “liberated” application. E.g., "Firefox" or "Xulrunner".
* extension. E.g., "Firefox" or "XULRunner".
*/
hostApplication: null,
host: null,
/**
* @property {Object} A map between key names for key events should be ignored,
@@ -109,7 +115,7 @@ const ConfigBase = Class(ModuleBase, {
modes: [],
/**
* @property {string} The name of “liberated” application.
* @property {string} The name of the extension.
* Required.
*/
name: null,

View File

@@ -721,12 +721,12 @@ const Dactyl = Module("dactyl", {
return;
}
dactyl.echomsg('Searching for "plugins/**/*.{js,vimp}" in '
dactyl.echomsg('Searching for "plugins/**/*.{js,' + config.fileExtension + '}" in '
+ [dir.path.replace(/.plugins$/, "") for ([, dir] in Iterator(dirs))]
.join(",").quote(), 2);
dirs.forEach(function (dir) {
dactyl.echomsg("Searching for " + (dir.path + "/**/*.{js,vimp}").quote(), 3);
dactyl.echomsg("Searching for " + (dir.path + "/**/*.{js," + config.fileExtension + "}").quote(), 3);
sourceDirectory(dir);
});
},
@@ -1238,7 +1238,7 @@ const Dactyl = Module("dactyl", {
options.add(["loadplugins", "lpl"],
"A regex list that defines which plugins are loaded at startup and via :loadplugins",
"regexlist", "'\\.(js|vimp)$'");
"regexlist", "'\\.(js|" + config.fileExtension + ")$'");
options.add(["titlestring"],
"Change the title of the window",

View File

@@ -86,8 +86,8 @@ const Events = Module("events", {
for (let file in dir.iterDirectory()) {
if (file.exists() && !file.isDirectory() && file.isReadable() &&
/^[\w_-]+(\.vimp)?$/i.test(file.leafName)) {
let name = file.leafName.replace(/\.vimp$/i, "");
RegExp("^[\\w_-]+(\\." + config.fileExtension + ")?$", "i").test(file.leafName)) {
let name = file.leafName.replace(RegExp("\\." + config.fileExtension + "$", "i"), "");
this._macros.set(name, {
keys: file.read().split("\n")[0],
timeRecorded: file.lastModifiedTime

View File

@@ -918,7 +918,7 @@
<tags>'noloadplugins' 'loadplugins'</tags>
<spec>'loadplugins' 'lpl'</spec>
<type>regexlist</type>
<default>\.(js|vimp)$</default>
<default>\.(js|&dactyl.fileExt;)$</default>
<description>
<p>
A regular expression list that defines which plugins are loaded at
@@ -937,7 +937,7 @@
omit in your <tt><t>&dactyl.name;rc</t></tt> using something like
the below:
</p>
<code><ex>:set loadplugins=</ex>!<str delim="'">foo|bar</str>,<str delim="'">\.(js|vimp)$</str></code>
<code><ex>:set loadplugins=</ex>!<str delim="'">foo|bar</str>,<str delim="'">\.(js|&dactyl.fileExt;)$</str></code>
<p>
That will load all plugins but <em>foo</em> and <em>bar</em>.
</p>

View File

@@ -112,9 +112,9 @@
<p>
All directories in <o>runtimepath</o> are searched for a
plugins subdirectory and all yet unloaded plugins are loaded.
For each plugins directory, all <tt>*.{js,vimp}</tt> files (including
those in further subdirectories) are sourced alphabetically. No
plugins will be sourced if,
For each plugins directory, all <tt>*.{js,&dactyl.fileExt;}</tt>
files (including those in further subdirectories) are sourced
alphabetically. No plugins will be sourced if,
</p>
<ul>

View File

@@ -25,7 +25,7 @@
<description>
<p>
Load a color scheme. <a>name</a> is found by searching the <o>runtimepath</o> for the
first file matching <tt>colors/<a>name</a>.vimp</tt>.
first file matching <tt>colors/<a>name</a>.&dactyl.fileExt;</tt>.
</p>
<p>

View File

@@ -238,7 +238,7 @@ const Highlights = Module("Highlight", {
if (scheme == "default")
highlight.clear();
else
dactyl.assert(modules.io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]),
dactyl.assert(modules.io.sourceFromRuntimePath(["colors/" + scheme + "." + modules.config.fileExtension]),
"E185: Cannot find color scheme " + scheme);
modules.autocommands.trigger("ColorScheme", { name: scheme });
},
@@ -313,13 +313,14 @@ const Highlights = Module("Highlight", {
},
completion: function (dactyl, modules) {
const completion = modules.completion;
const config = modules.config;
completion.colorScheme = function colorScheme(context) {
context.title = ["Color Scheme", "Runtime Path"];
context.keys = { text: function (f) f.leafName.replace(/\.vimp$/, ""), description: ".parent.path" };
context.keys = { text: function (f) f.leafName.replace(RegExp("\\." + config.fileExtension + "$"), ""), description: ".parent.path" };
context.completions = array.flatten(
modules.io.getRuntimeDirectories("colors").map(
function (dir) dir.readDirectory().filter(
function (file) /\.vimp$/.test(file.leafName))));
function (file) RegExp("\\." + config.fileExtension + "$").test(file.leafName))));
};

View File

@@ -18,6 +18,7 @@
- Backtracks to the first successful match after pressing
backspace.
- Supports reverse incremental search.
* Command script files now use the *.penta file extension.
* Multiple Ex commands may now be separated by |
* Command-line is now hidden by default. Added C and M to
'guioptions'.

View File

@@ -13,6 +13,7 @@
<!ENTITY dactyl.maillist "pentadactyl@googlegroups.com">
<!ENTITY dactyl.host "&brandShortName;">
<!ENTITY dactyl.hostbin "firefox">
<!ENTITY dactyl.fileExt "penta">
<!ENTITY dactyl.statusBefore "statusbar-display">
<!ENTITY dactyl.statusAfter "">

View File

@@ -8,6 +8,7 @@
<!ENTITY dactyl.appName "Teledactyl">
<!ENTITY dactyl.host "&brandShortName;">
<!ENTITY dactyl.hostbin "thunderbird">
<!ENTITY dactyl.fileExt "tele">
<!ENTITY dactyl.statusBefore "">
<!ENTITY dactyl.statusAfter "statusTextBox">

View File

@@ -24,7 +24,7 @@ const Config = Module("config", ConfigBase, {
},
/*** required options, no checks done if they really exist, so be careful ***/
name: "Xulmus",
hostApplication: "Songbird",
host: "Songbird",
/*** optional options, there are checked for existence and a fallback provided ***/
features: ["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "player"],

View File

@@ -8,6 +8,7 @@
<!ENTITY dactyl.idName "XULMUS">
<!ENTITY dactyl.host "&brandShortName;">
<!ENTITY dactyl.hostbin "songbird">
<!ENTITY dactyl.fileExt "xulmus">
<!ENTITY dactyl.statusBefore "statusbar-display">
<!ENTITY dactyl.statusAfter "">