1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 21:14:11 +01:00

add help for :colorscheme and move completion function to

completion.colorScheme
This commit is contained in:
Doug Kearns
2008-11-01 14:54:05 +00:00
parent dd7178dfc6
commit 3371398700
8 changed files with 37 additions and 19 deletions

1
NEWS
View File

@@ -12,6 +12,7 @@
special versions for the old behavior special versions for the old behavior
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively VimperatorLeave respectively
* add :colorscheme
* multibyte support for hints (thanks Xie&Tian) * multibyte support for hints (thanks Xie&Tian)
* add 'exrc' * add 'exrc'
* add 'errorbells' * add 'errorbells'

View File

@@ -813,6 +813,19 @@ function Completion() //{{{
return [0, buildLongestCommonSubstring(items, filter)]; return [0, buildLongestCommonSubstring(items, filter)];
}, },
colorScheme: function colorScheme(filter)
{
let schemes = [];
let rtp = options["runtimepath"].split(",");
rtp.forEach(function (path) {
schemes = schemes.concat([[c[0].replace(/\.vimp$/, ""), ""]
for each (c in completion.file(path + "/colors/", true)[1])]);
});
return [0, completion.filter(schemes, filter)];
},
command: function command(filter) command: function command(filter)
{ {
var completions = []; var completions = [];

View File

@@ -362,30 +362,21 @@ const highlight = storage.newObject("highlight", Highlights, false);
liberator.registerObserver("load_commands", function () liberator.registerObserver("load_commands", function ()
{ {
// TODO: :colo default needs :hi clear
commands.add(["colo[rscheme]"], commands.add(["colo[rscheme]"],
"Load a color scheme", "Load a color scheme",
function (args) function (args)
{ {
let scheme = args.arguments[0]; let scheme = args.arguments[0];
if (!io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"])) if (io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
autocommands.trigger("ColorScheme", {});
else
liberator.echoerr("E185: Cannot find color scheme " + scheme); liberator.echoerr("E185: Cannot find color scheme " + scheme);
}, },
{ {
argCount: 1, argCount: 1,
completer: function (filter) completer: function (filter) completion.colorScheme(filter)
{
let rtp = options["runtimepath"].split(",");
let schemes = [];
rtp.forEach(function (path) {
schemes = schemes.concat(
[[c[0].replace(/\.vimp$/, ""), ""] for each (c in completion.file(path + "/colors/", true)[1])]
)
});
return [0, completion.filter(schemes, filter)];
}
}); });
commands.add(["sty[le]"], commands.add(["sty[le]"],

View File

@@ -39,6 +39,7 @@ const config = { //{{{
get visualbellWindow() getBrowser().mPanelContainer, get visualbellWindow() getBrowser().mPanelContainer,
autocommands: [["BookmarkAdd", "Triggered after a page is bookmarked"], autocommands: [["BookmarkAdd", "Triggered after a page is bookmarked"],
["ColorScheme", "Triggered after a color scheme has been loaded"],
["DOMLoad", "Triggered when a page's DOM content has fully loaded"], ["DOMLoad", "Triggered when a page's DOM content has fully loaded"],
["DownloadPost", "Triggered when a download has completed"], ["DownloadPost", "Triggered when a download has completed"],
["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"], ["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"],

View File

@@ -21,6 +21,7 @@ Available {events}:
`--------------------`---------------------------------------- `--------------------`----------------------------------------
*BookmarkAdd* Triggered after a page is bookmarked *BookmarkAdd* Triggered after a page is bookmarked
*ColorScheme* Triggered after a color scheme has been loaded
*DOMLoad* Triggered when a page's DOM content has fully loaded *DOMLoad* Triggered when a page's DOM content has fully loaded
*DownloadPost* Triggered when a download has completed *DownloadPost* Triggered when a download has completed
*LocationChange* Triggered when changing tabs or when navigating to a new location *LocationChange* Triggered when changing tabs or when navigating to a new location

View File

@@ -153,6 +153,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||:cmap|| Map a key sequence in command-line mode + ||:cmap|| Map a key sequence in command-line mode +
||:cmapclear|| Remove all mappings in command-line mode + ||:cmapclear|| Remove all mappings in command-line mode +
||:cnoremap|| Map a key sequence without remapping keys in command-line mode + ||:cnoremap|| Map a key sequence without remapping keys in command-line mode +
||:colorscheme|| Load a color scheme +
||:comclear|| Delete all user-defined commands + ||:comclear|| Delete all user-defined commands +
||:command|| List and define commands + ||:command|| List and define commands +
||:cunabbrev|| Remove an abbreviation in command-line mode + ||:cunabbrev|| Remove an abbreviation in command-line mode +

View File

@@ -7,6 +7,16 @@ styling is specified via CSS. Although you may style any user interface element
via the [c]:style[c] command, most Vimperator elements can be styled with the via the [c]:style[c] command, most Vimperator elements can be styled with the
[c]:highlight[c] command, for convenience. [c]:highlight[c] command, for convenience.
|E185| |:colo| |:colorscheme| +
||:colo[rscheme] {name}|| +
________________________________________________________________________________
Load a color scheme. {name} is found by searching the 'runtimepath' for the
first file matching colors/{name}.vimp.
The ColorScheme autocommand is triggered after the color scheme has been
sourced.
________________________________________________________________________________
|:hi| |:highlight| + |:hi| |:highlight| +
||:hi[light][!] [-append] {group}[{selector}] [{css}]|| + ||:hi[light][!] [-append] {group}[{selector}] [{css}]|| +
________________________________________________________________________________ ________________________________________________________________________________

View File

@@ -19,11 +19,11 @@ unlet b:current_syntax
syn match vimperatorCommandStart "\%(^\s*:\=\)\@<=" nextgroup=vimperatorCommand,vimperatorAutoCmd syn match vimperatorCommandStart "\%(^\s*:\=\)\@<=" nextgroup=vimperatorCommand,vimperatorAutoCmd
syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] b[uffer] ba[ck] bd[elete] beep bf[irst] bl[ast] bma[rk] bmarks syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] b[uffer] ba[ck] bd[elete] beep bf[irst] bl[ast] bma[rk] bmarks
\ bn[ext] bN[ext] bp[revious] br[ewind] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cd chd[ir] cuna[bbrev] cm[ap] \ bn[ext] bN[ext] bp[revious] br[ewind] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cd chd[ir] colo[rscheme] cuna[bbrev]
\ cmapc[lear] cno[remap] comc[lear] com[mand] cu[nmap] do[autocmd] doautoa[ll] delbm[arks] delc[ommand] delmac[ros] delm[arks] \ cm[ap] cmapc[lear] cno[remap] comc[lear] com[mand] cu[nmap] do[autocmd] doautoa[ll] delbm[arks] delc[ommand] delmac[ros]
\ delqm[arks] dels[tyle] dia[log] dl downl[oads] e[dit] ec[ho] echoe[rr] echom[sg] em[enu] exe[cute] exu[sage] fini[sh] files \ delm[arks] delqm[arks] dels[tyle] dia[log] dl downl[oads] e[dit] ec[ho] echoe[rr] echom[sg] em[enu] exe[cute] exu[sage]
\ fo[rward] fw h[elp] ha[rdcopy] hi[ghlight] hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iuna[bbrev] \ fini[sh] files fo[rward] fw h[elp] ha[rdcopy] hi[ghlight] hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap]
\ iu[nmap] javas[cript] ju[mps] js let ls macros ma[rk] map mapc[lear] marks mes[sages] mkv[imperatorrc] no[remap] \ iuna[bbrev] iu[nmap] javas[cript] ju[mps] js let ls macros ma[rk] map mapc[lear] marks mes[sages] mkv[imperatorrc] no[remap]
\ noh[lsearch] norm[al] o[pen] optionu[sage] pa[geinfo] pagest[yle] pc[lose] pl[ay] pref[erences] prefs pw[d] q[uit] qa[ll] \ noh[lsearch] norm[al] o[pen] optionu[sage] 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 runt[ime] sty[le] sav[eas] sb[ar] sb[open] sbcl[ose] \ qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run runt[ime] sty[le] 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] \ scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] tN[ext] t[open] tab tabde[tach] tabd[uplicate]