From 2141d475f8de55faa32affa8d0cada252e87671a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 21 Oct 2008 15:45:57 +0000 Subject: [PATCH] add 'exrc' --- NEWS | 1 + content/io.js | 8 +++++--- content/liberator.js | 13 ++++++++++++- locale/en-US/index.txt | 1 + locale/en-US/options.txt | 6 ++++++ locale/en-US/starting.txt | 2 ++ 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index df85aa5d..fa7de76c 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ special versions for the old behavior * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and VimperatorLeave respectively + * add 'exrc' * add 'errorbells' * add shell command completion for :! * add :map to prevent a mapping from being echoed diff --git a/content/io.js b/content/io.js index 7c90c4af..974f0c31 100644 --- a/content/io.js +++ b/content/io.js @@ -478,10 +478,12 @@ function IO() //{{{ return dirs; }, - getRCFile: function () + getRCFile: function (dir) { - var rcFile1 = ioManager.getFile("~/." + EXTENSION_NAME + "rc"); - var rcFile2 = ioManager.getFile("~/_" + EXTENSION_NAME + "rc"); + dir = dir || "~"; + + let rcFile1 = ioManager.getFile(joinPaths(dir, "/." + EXTENSION_NAME + "rc")); + let rcFile2 = ioManager.getFile(joinPaths(dir, "/_" + EXTENSION_NAME + "rc")); if (WINDOWS) [rcFile1, rcFile2] = [rcFile2, rcFile1]; diff --git a/content/liberator.js b/content/liberator.js index 1df057ef..571b47f8 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -63,6 +63,10 @@ const liberator = (function () //{{{ "Ring the bell when an error message is displayed", "boolean", false); + options.add(["exrc", "ex"], + "Allow reading of an RC file in the current directory", + "boolean", false); + const tabopts = [ ["n", "Tab number", null, ".hl-TabNumber"], ["N", "Tab number over icon", null, ".hl-TabIconNumber"], @@ -1168,13 +1172,20 @@ const liberator = (function () //{{{ // make sourcing asynchronous, otherwise commands that open new tabs won't work setTimeout(function () { - var rcFile = io.getRCFile(); + let rcFile = io.getRCFile("~"); if (rcFile) io.source(rcFile.path, true); else liberator.log("No user RC file found", 3); + if (options["exrc"]) + { + let localRcFile = io.getRCFile(io.getCurrentDirectory()); + if (localRcFile) + io.source(localRcFile.path, true); + } + if (options["loadplugins"]) liberator.loadPlugins(); diff --git a/locale/en-US/index.txt b/locale/en-US/index.txt index ebbd1f38..f1677a09 100644 --- a/locale/en-US/index.txt +++ b/locale/en-US/index.txt @@ -257,6 +257,7 @@ section:Options[option-index] ||'editor'|| Set the external text editor + ||'errorbells'|| Ring the bell when an error message is displayed + ||'eventignore'|| List of autocommand event names which should be ignored + +||'exrc'|| Allow reading of an RC file in the current directory + ||'extendedhinttags'|| XPath string of hintable elements activated by ';' + ||'fileencoding'|| set the charactor encoding for the current page + ||'focuscontent'|| Try to stay in normal mode after loading a web page + diff --git a/locale/en-US/options.txt b/locale/en-US/options.txt index 74442e05..a84c2d0d 100644 --- a/locale/en-US/options.txt +++ b/locale/en-US/options.txt @@ -266,6 +266,12 @@ Warning: Vimperator will not behave correctly if the editor forks its own process, such as with gvim without the -f argument. ____ +|\'noex'| |\'noexrc'| |\'ex'| |\'exrc'| +||'exrc' 'ex'|| boolean (default: off) +____ +Allow reading of an RC file in the current directory. This file is sourced in +addition to, and after, your default RC file. +____ |\'eht'| |\'extendedhinttags'| ||'extendedhinttags' 'eht'|| string diff --git a/locale/en-US/starting.txt b/locale/en-US/starting.txt index 0e7af76d..618820ba 100644 --- a/locale/en-US/starting.txt +++ b/locale/en-US/starting.txt @@ -12,6 +12,8 @@ JavaScript files found in the plugin directory. The RC file may be named * Unix and Mac: [a]\~/.vimperatorrc[a] then [a]\~/_vimperatorrc[a] * Windows - [a]\~/_vimperatorrc[a] then [a]\~/.vimperatorrc[a] +If 'exrc' is set then any RC file in the current directory is also sourced. + The plugin directory can be in any of the directories in 'runtimepath'. Using the default value of 'runtimepath' this would be: