1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 02:34:11 +01:00

allow ${VAR} environment variable expansion on Windows too

This commit is contained in:
Doug Kearns
2008-12-02 14:48:48 +00:00
parent c3deb192b8
commit 3a8817a560
2 changed files with 12 additions and 5 deletions

View File

@@ -426,12 +426,12 @@ function IO() //{{{
}
// expand any $ENV vars - this is naive but so is Vim and we like to be compatible
// TODO: Vim does not expand variables set to an empty string, nor does it recognise
// ${VAR} on WINDOWS - are we just matching bugs?
// Yes. --Kris
// TODO: Vim does not expand variables set to an empty string (and documents it).
// Kris reckons we shouldn't replicate this 'bug'. --djk
// TODO: should we be doing this for all paths?
path = path.replace(
WINDOWS ? /\$(\w+)\b|%(\w+)%/g : /\$(\w+)\b|\${(\w+)}/g,
function (m, n1, n2, i, s) environmentService.get((n1 || n2), "$1")
RegExp("\\$(\\w+)\\b|\\${(\\w+)}" + (WINDOWS ? "|%(\\w+)%" : ""), "g"),
function (m, n1, n2, n3) environmentService.get(n1 || n2 || n3) || m
);
return path.replace("\\ ", " ", "g");

View File

@@ -147,6 +147,13 @@ The same as [c]:set[c] command, but operates on global options only.
See [c]:set[c] for details.
____
|expand-environment-var| |expand-env| |:set_env| +
Environment variables are expanded for path options like 'cdpath' and
'runtimepath'. The variable notation is _$VAR_ (terminated by a non-word
character) or _$\\{VAR}_. _%VAR%_ is also supported on Windows.
section:Setting{nbsp}Firefox{nbsp}options[firefox-options]
Most Firefox options are not touched/overridden by Vimperator. In order to set