From d9b07c2ff6dde17ad17a66d2e5772ce8a3f9ca5e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Jan 2009 18:03:04 +1100 Subject: [PATCH] Set MY_VIMPERATORRC when sourcing the RC file on startup. --- common/content/liberator.js | 11 ++++++++--- vimperator/NEWS | 2 +- vimperator/locale/en-US/starting.txt | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index dd5d396c..864472f0 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1284,11 +1284,13 @@ const liberator = (function () //{{{ // TODO: we should have some class where all this guioptions stuff fits well hideGUI(); - // finally, read a ~/.vimperatorrc and plugin/**.{vimp,js} + // finally, read the RC file and source plugins // make sourcing asynchronous, otherwise commands that open new tabs won't work setTimeout(function () { - let init = services.get("environment").get(config.name.toUpperCase() + "_INIT"); + let extensionName = config.name.toUpperCase(); + let init = services.get("environment").get(extensionName + "_INIT"); + if (init) liberator.execute(init); else @@ -1296,7 +1298,10 @@ const liberator = (function () //{{{ let rcFile = io.getRCFile("~"); if (rcFile) + { io.source(rcFile.path, true); + services.get("environment").set("MY_" + extensionName + "RC", rcFile.path); + } else liberator.log("No user RC file found", 3); } @@ -1313,7 +1318,7 @@ const liberator = (function () //{{{ // after sourcing the initialization files, this function will set // all gui options to their default values, if they have not been - // set before by any rc file + // set before by any RC file for (let option in options) { if (option.setter) diff --git a/vimperator/NEWS b/vimperator/NEWS index dc72df66..200d56e0 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -22,7 +22,7 @@ * IMPORTANT: $VIMPERATOR_HOME is no longer used. * Added ~/.vimperator/info/{profile}/, similar to viminfo - * added $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT + * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT and $MY_VIMPERATORRC * :hardcopy now supports output redirection to a file on Unix and MacUnix * add ";f" extended hint mode to focus a frame * add "r", "l", and "b" to 'guioptions' to toggle the scrollbars. diff --git a/vimperator/locale/en-US/starting.txt b/vimperator/locale/en-US/starting.txt index 0e6d060d..5bbe7b97 100644 --- a/vimperator/locale/en-US/starting.txt +++ b/vimperator/locale/en-US/starting.txt @@ -14,8 +14,9 @@ At startup, Vimperator completes the following tasks in order. .. |$VIMPERATOR_INIT| _$VIMPERATOR_INIT_ -- May contain a single ex command (e.g., "[c]:source {file}[c]"). - .. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its - contents are executed. + .. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its + contents are executed and + _$MY_VIMPERATORRC_ set to its path. .. [a]\~/.vimperatorrc[a] -- If this file exists, its contents are executed.