-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimperatorrc
115 lines (95 loc) · 3.81 KB
/
.vimperatorrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
" vim: syntax=vimperator :
"
" プロファイル毎に runtimepath を設定したりするよ
" (for Vimperator 2.x - 3.0pre)
"
" .vimperatorrc (this file)
" vimperator/
" default/
" .vimperatorrc
" .vimperatorrc.local
" .vimperatorrc.js
" .vimperatorrc.local.js
" .vimperatorrc.after
" .vimperatorrc.after.js
" plugin/
" color/
" development/
" .vimperatorrc
" plugin/
" color/
" ....
js << EOM
if (!liberator.globalVariables.anekos_rc_loaded) {
////////////////////////////////////////////////////////////////////////////////
// Hacks For Firefxx
////////////////////////////////////////////////////////////////////////////////
liberator.modules.CompletionContext = liberator.eval('CompletionContext', modules);
liberator.modules.userContext = liberator.eval('userContext', modules);
Command = liberator.eval('Command', modules);
Editor = liberator.eval('Editor', modules);
Script = liberator.eval('Script', modules);
////////////////////////////////////////////////////////////////////////////////
// USER SETTING
////////////////////////////////////////////////////////////////////////////////
// default directory name
let defaultName = 'default';
// runtime path
let runtimepath;// = '~/.vimperator';
// rc filenames (n = normal, a = after)
let nrcs = [
'.vimperatorrc', '_vimperatorrc',
'.vimperatorrc.js', '_vimperatorrc.js',
'.vimperatorrc.local', '_vimperatorrc.local',
'.vimperatorrc.local.js', '_vimperatorrc.local.js'
];
let arcs = nrcs.map(function (it) it.replace(/\.js|$/, function (tail) ('.after' + tail)));
////////////////////////////////////////////////////////////////////////////////
// MAIN
////////////////////////////////////////////////////////////////////////////////
try {
liberator.registerObserver('enter', function () sourceFromDirs(arcs, newrps));
let joinPaths = function () Array.slice(arguments).join('/');
let sourceFromDirs = function (paths, dirs) {
for (let [,dir] in Iterator(dirs)) {
for (let [,path] in Iterator(paths)) {
let file = io.File(joinPaths(dir, path));
if (file.exists() && file.isFile() && file.isReadable())
io.source(file.path, false);
}
}
};
let profileName = (function ()
Cc['@mozilla.org/file/directory_service;1']
.getService(Ci.nsIProperties)
.get('ProfD', Ci.nsIFile)
.path
.replace(/.*[\\\/]/, '')
.replace(/.+?\./, ''))();
let option = runtimepath || options.get('runtimepath');
let rps = option.get().replace(/,$/, '').split(',');
function resolve (path, name) {
let newpath = path + '/' + name;
let entry = io.File(newpath);
if (!entry.exists())
return;
if (entry.isFile())
return resolve(path, entry.read().replace(/\W/g, '').trim());
return newpath;
}
let newrps = rps.map(function (path) (resolve(path, profileName) || (path + '/' + defaultName)));
option.set(newrps.join(','));
sourceFromDirs(nrcs, newrps);
// なおった? 2014-11-13T18:02:17
// autocommands.add('VimperatorEnter', /.*/, function () {
// window.alert('Fxxxn problem has been fixed. See and revert: ~/.vimperatorrc');
// // readitlater.js も関係している???
// // 参照: ~/.vimperator/default/plugin/my_readitlater_for_hints_ext.js
// sourceFromDirs(arcs, newrps);
// });
} catch (e) {
window.alert(e);
}
liberator.globalVariables.anekos_rc_loaded = true;
}
EOM