diff options
author | anekos | 2010-08-01 17:56:05 +0000 |
---|---|---|
committer | anekos | 2010-08-01 17:56:05 +0000 |
commit | 48a05d35ae1b1db17e7fcb384f860b0f7ddf8560 (patch) | |
tree | 20e021dbee325911033bef8422de0442d1045a02 /twittperator.js | |
parent | a3b6b688d2d816d1121bcd79c44cb4a5fa95cfea (diff) | |
download | vimperator-plugins-48a05d35ae1b1db17e7fcb384f860b0f7ddf8560.tar.bz2 |
~/vimperator/twittperator/ ディレクトリにもプラグインを設置できるようにした。
ここに設置した場合、let g:twittperator_plugin_ 変数の設定が不要になる。
確認せずにロードされる。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38119 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'twittperator.js')
-rwxr-xr-x | twittperator.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/twittperator.js b/twittperator.js index 64c84a0..6883b24 100755 --- a/twittperator.js +++ b/twittperator.js @@ -1360,16 +1360,21 @@ function sourceScriptFile(file) { // {{{ } } // }}} function loadPlugins() { // {{{ - function getVariableName(file) - file.leafName.replace(/\..*/, "").replace(/-/g, "_"); - - io.getRuntimeDirectories("plugin/twittperator").forEach(function(dir) { - dir.readDirectory().forEach(function(file) { - let name = getVariableName(file); - if (/\.tw$/(file.path) && liberator.globalVariables["twittperator_plugin_" + name]) - sourceScriptFile(file); - }); - }); + function isEnabled(file) + let (name = file.leafName.replace(/\..*/, "").replace(/-/g, "_")) + liberator.globalVariables["twittperator_plugin_" + name]; + + function loadPluginFromDir(checkGV) { + return function(dir) { + dir.readDirectory().forEach(function(file) { + if (/\.tw$/(file.path) && (!checkGV || isEnabled(file))) + sourceScriptFile(file); + }); + } + } + + io.getRuntimeDirectories("plugin/twittperator").forEach(loadPluginFromDir(true)); + io.getRuntimeDirectories("twittperator").forEach(loadPluginFromDir(false)); } // }}} function setup() { // {{{ function commandCompelter(context, args) { |