1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 23:02:27 +01:00

add :runtime command

This commit is contained in:
Doug Kearns
2008-09-23 03:09:38 +00:00
parent ed327496ff
commit 1d139b05e8
5 changed files with 45 additions and 3 deletions

1
NEWS
View File

@@ -5,6 +5,7 @@
special versions for the old behavior
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively
* add :runtime
* add 'runtimepath'
* allow ; hints to work in the multiline output widget
* add :scriptnames

View File

@@ -267,6 +267,36 @@ liberator.IO = function () //{{{
liberator.io.writeFile(file, line);
});
liberator.commands.add(["ru[ntime]"],
"Source the specified file from each directory in 'runtimepath'",
function (args, special)
{
// TODO: support backslash escaped whitespace in filenames
// : wildcards/regexp
// : unify with startup sourcing loop
let paths = args.arguments;
let runtimeDirs = liberator.options["runtimepath"].split(",");
outer:
for (let [,runtimeDir] in Iterator(runtimeDirs))
{
for (let [,path] in Iterator(paths))
{
let file = liberator.io.getFile(joinPaths(runtimeDir, path));
if (file.exists() && file.isReadable() && !file.isDirectory()) // XXX
{
liberator.io.source(file.path, false);
if (!special)
break outer;
}
}
}
},
{ argCount: "+" }
);
liberator.commands.add(["scrip[tnames]"],
"List all sourced script names",
function ()

View File

@@ -203,6 +203,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||:reload|| Reload current page +
||:reloadall|| Reload all tab pages +
||:restart|| Force undefined to restart +
||:runtime|| Source the specified file from each directory in 'runtimepath' +
||:saveas|| Save current document to disk +
||:sbclose|| Close the sidebar window +
||:scriptnames|| List all sourced script names +

View File

@@ -80,6 +80,16 @@ printed.
________________________________________________________________________________
|:ru| |:runtime|
||:ru[ntime][!]| {file} ...|| +
________________________________________________________________________________
Source the specified file from each directory in 'runtimepath'. Example: +
[c]:runtime plugin/foobar.vimp[c] +
Only the first found file is sourced. When [!] is given, all found files are
sourced.
________________________________________________________________________________
|:scrip| |:scriptnames|
||:scrip[tnames]|| +
________________________________________________________________________________

View File

@@ -23,9 +23,9 @@ syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] b[uffer] ba[ck] bd
\ downl[oads] e[dit] ec[ho] echoe[rr] em[enu] exe[cute] exu[sage] fini[sh] files fo[rward] fw h[elp] ha[rdcopy] hist[ory] hs
\ ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iuna[bbrev] iu[nmap] javas[cript] ju[mps] js let ls macros ma[rk] map
\ mapc[lear] marks mkv[imperatorrc] no[remap] noh[lsearch] norm[al] o[pen] pa[geinfo] pagest[yle] pc[lose] pl[ay]
\ pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run sav[eas] sb[ar]
\ sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] tN[ext] t[open] tab tabde[tach]
\ tabd[uplicate] tabN[ext] tabc[lose] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen
\ pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run ru[ntime]
\ sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] tN[ext] t[open] tab
\ tabde[tach] tabd[uplicate] tabN[ext] tabc[lose] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen
\ tabp[revious] tabr[ewind] tabs time tn[ext] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et] unm[ap] ve[rsion]
\ vie[wsource] viu[sage] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wqa[ll] wq xa[ll] zo[om]
\ contained