diff --git a/NEWS b/NEWS index 83209995..954d9019 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/content/io.js b/content/io.js index 94aa9209..f429c9dd 100644 --- a/content/io.js +++ b/content/io.js @@ -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 () diff --git a/locale/en-US/index.txt b/locale/en-US/index.txt index 35afb7f9..070dd3e9 100644 --- a/locale/en-US/index.txt +++ b/locale/en-US/index.txt @@ -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 + diff --git a/locale/en-US/repeat.txt b/locale/en-US/repeat.txt index 04a233c0..91fea872 100644 --- a/locale/en-US/repeat.txt +++ b/locale/en-US/repeat.txt @@ -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]|| + ________________________________________________________________________________ diff --git a/vimperator.vim b/vimperator.vim index 0dea2575..a13ce4f1 100644 --- a/vimperator.vim +++ b/vimperator.vim @@ -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