diff --git a/common/content/commands.js b/common/content/commands.js index 06b835be..32d193e6 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -127,6 +127,8 @@ const Command = Class("Command", { this.options = this.options.map(CommandOption.fromArray, CommandOption); }, + get helpTag() ":" + this.name, + /** * Execute this command. * @@ -1449,6 +1451,7 @@ const Commands = Module("commands", { dactyl.addUsageCommand({ name: ["listc[ommands]", "lc"], description: "List all Ex commands along with their short descriptions", + index: "ex-cmd", iterate: function (args) commands, format: { description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")), diff --git a/common/content/dactyl.js b/common/content/dactyl.js index b52e5077..e0440bc7 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -27,6 +27,7 @@ const Dactyl = Module("dactyl", { Object.defineProperty(window, "liberator", prop); Object.defineProperty(modules, "liberator", prop); this.commands = {}; + this.indices = {}; this.modules = modules; this.observers = {}; @@ -149,6 +150,12 @@ const Dactyl = Module("dactyl", { }, options: params.options || [] }); + if (params.index) + this.indices[params.index] = function () { + for (let obj in (params.iterateIndex || params.iterate)()) + if (obj.helpTag in services["dactyl:"].HELP_TAGS) + yield dactyl.generateHelp(obj, null, null, true); + } }, /** @@ -557,6 +564,17 @@ const Dactyl = Module("dactyl", { .toXMLString())); fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help]; + overlayMap["index"] = function () ['text/xml;charset=UTF-8', + '\n' + + '\n' + + unescape(encodeURI( // UTF-8 handling hack. + template.map(dactyl.indices, function ([name, iter]) +
{ + template.map(iter(), util.identity) + }
, <>{"\n\n"}))) + .replace('xmlns="' + XHTML + '"', "", "g") + + '\n
']; + addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML); this.helpInitialized = true; } @@ -717,49 +735,50 @@ const Dactyl = Module("dactyl", { let res =
{link(obj.name)}
{obj.description ? obj.description.replace(/\.$/, "") : ""}
; - if (!specOnly) { - res.* += <> - - {template.map(obj.names.slice().reverse(), tag, " ")} - { - spec(template.highlightRegexp((obj.specs || obj.names)[0], - /\[(.*?)\]/g, - function (m, n0) {n0})) - }{ - !obj.type ? "" : <> - {obj.type} - {obj.stringDefaultValue}} - { - obj.description ? br +

{obj.description.replace(/\.?$/, ".")}

: "" }{ - extraHelp ? br + extraHelp : "" }{ - !(extraHelp || obj.description) ? br +

Sorry, no help available.

: "" } -
-
; + if (specOnly) + return res.*; - function add(ary) { - res.item.description.* += br + - let (br = br + <> ) - <>
{ br + template.map(ary, function ([a, b]) <>
{a}
{b}
, br) } -
- ; - } + res.* += <> + + {template.map(obj.names.slice().reverse(), tag, " ")} + { + spec(template.highlightRegexp((obj.specs || obj.names)[0], + /\[(.*?)\]/g, + function (m, n0) {n0})) + }{ + !obj.type ? "" : <> + {obj.type} + {obj.stringDefaultValue}} + { + obj.description ? br +

{obj.description.replace(/\.?$/, ".")}

: "" }{ + extraHelp ? br + extraHelp : "" }{ + !(extraHelp || obj.description) ? br +

Sorry, no help available.

: "" } +
+
; - if (obj.completer) - add(completion._runCompleter(obj.completer, "", null, args).items - .map(function (i) [i.text, i.description])); - - if (obj.options && obj.options.some(function (o) o.description)) - add(obj.options.filter(function (o) o.description) - .map(function (o) [ - o.names[0], - <>{o.description}{ - o.names.length == 1 ? "" : - <> (short name: { - template.map(o.names.slice(1), function (n) {n}, <>, ) - }) - } - ])); + function add(ary) { + res.item.description.* += br + + let (br = br + <> ) + <>
{ br + template.map(ary, function ([a, b]) <>
{a}
{b}
, br) } +
+ ; } + + if (obj.completer) + add(completion._runCompleter(obj.completer, "", null, args).items + .map(function (i) [i.text, i.description])); + + if (obj.options && obj.options.some(function (o) o.description)) + add(obj.options.filter(function (o) o.description) + .map(function (o) [ + o.names[0], + <>{o.description}{ + o.names.length == 1 ? "" : + <> (short name: { + template.map(o.names.slice(1), function (n) {n}, <>, ) + }) + } + ])); return res.*.toXMLString().replace(/^ {12}|[ \t]+$/gm, "").replace(/^.*\n|\n.*$/g, "") + "\n"; }, diff --git a/common/content/options.js b/common/content/options.js index 0e2b28a5..6bb33ba0 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -77,6 +77,8 @@ const Option = Class("Option", { this.globalValue = this.defaultValue; }, + get helpTag() "'" + this.name + "'", + initValue: function () { dactyl.trapErrors(function () this.value = this.value, this); }, @@ -842,6 +844,7 @@ const Options = Module("options", { dactyl.addUsageCommand({ name: ["listo[ptions]", "lo"], description: "List all options along with their short descriptions", + index: "option", iterate: function (args) options, format: { description: function (opt) (XML.ignoreWhitespace = false, XML.prettyPrinting = false, <> diff --git a/common/locale/en-US/index.xml b/common/locale/en-US/index.xml index 26a616e7..b3512779 100644 --- a/common/locale/en-US/index.xml +++ b/common/locale/en-US/index.xml @@ -204,239 +204,8 @@ This file contains a list of all available commands, mappings and options.

Ex commands

-
-
:!
Run a command
-
:!!
Repeat last :!cmd
-
:abbreviate
Abbreviate a key sequence
-
:abclear
Remove all abbreviations
-
:addons
Manage available Extensions and Themes
-
:autocmd
Execute commands automatically on events
-
:back
Go back in the browser history
-
:bdelete
Delete current buffer
-
:bmark
Add a bookmark
-
:bmarks
List or open multiple bookmarks
-
:buffer
Switch to a buffer
-
:buffers
Show a list of all buffers
-
:cabbrev
Abbreviate a key sequence in Command-line mode
-
:cabclear
Remove all abbreviations in Command-line mode
-
:cd
Change the current directory
-
:cmap
Map a key sequence in Command-line mode
-
:cmapclear
Remove all mappings 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
-
:command
List and define commands
-
:contexts
List the completion contexts used during completion of an Ex command
-
:cookies
Change cookie permissions for sites
-
:cunabbrev
Remove an abbreviation in Command-line mode
-
:cunmap
Remove a mapping in Command-line mode
-
:delbmarks
Delete a bookmark
-
:delcommand
Delete the specified user-defined command
-
:delmacros
Delete macros
-
:delmarks
Delete the specified marks
-
:delqmarks
Delete the specified QuickMarks
-
:delstyle
Delete any matching styles
-
:dialog
Open a &dactyl.host; dialog
-
:doautoall
Apply the autocommands matching the specified URL to all buffers
-
:doautocmd
Apply the autocommands matching the specified URL to the current buffer
-
:downloads
Show progress of current downloads
-
:echo
Echo the expression
-
:echoerr
Echo the expression as an error message
-
:echomsg
Echo the expression as an informational message
-
:else
Execute commands until the next :endif only if the previous conditionals were not executed
-
:elseif
Execute commands until the next :elseif, :else, or :endif only if the argument returns true
-
:emenu
Execute the specified menu item from the command line
-
:endif
Ends a string of :if/:elseif/:else conditionals
-
:execute
Execute the argument as an Ex command
-
:extadd
Install an extension
-
:extdelete
Uninstall an extension
-
:extdisable
Disable an extension
-
:extenable
Enable an extension
-
:extensions
List all installed extensions
-
:extoptions
Open an extension's preference dialog
-
:extupdate
Update an extension
-
:feedkeys
Fake key events
-
:finish
Stop sourcing a script file
-
:forward
Go forward in the browser history
-
:frameonly
Show only the current frame's page
-
:hardcopy
Print current document
-
:help
Open the help page
-
:helpall
Open the single unchunked help page
-
:highlight
Style &dactyl.appName;
-
:history
Show recently visited URLs
-
:iabbrev
Abbreviate a key sequence in Insert mode
-
:iabclear
Remove all abbreviations in Insert mode
-
:if
Execute commands until the next :elseif, :else, or :endif only if the argument returns true
-
:imap
Map a key sequence in Insert mode
-
:imapclear
Remove all mappings in Insert mode
-
:inoremap
Map a key sequence without remapping keys in Insert mode
-
:iunabbrev
Remove an abbreviation in Insert mode
-
:iunmap
Remove a mapping in Insert mode
-
:javascript
Run a JavaScript command through eval()
-
:jumps
Show jumplist
-
:keepalt
Execute a command without changing the current alternate buffer
-
:let
Set or list a variable
-
:listcommands
List all Ex commands along with their short descriptions
-
:listkeys
List all mappings along with their short descriptions
-
:listoptions
List all options along with their short descriptions
-
:loadplugins
Immediately load all unloaded plugins
-
:macros
List all macros
-
:map
Map a key sequence
-
:mapclear
Remove all mappings
-
:mark
Mark current location within the web page
-
:marks
Show all location marks of current web page
-
:messages
Display previously given messages
-
:messclear
Clear the message history
-
:mk&dactyl.name;rc
Write current key mappings and changed options to the config file
-
:mksyntax
Generate a Vim syntax file
-
:nmap
Map a key sequence in Normal mode
-
:nmapclear
Remove all mappings in Normal mode
-
:nnoremap
Map a key sequence without remapping keys in Normal mode
-
:nohlfind
Remove the search highlighting
-
:noremap
Map a key sequence without remapping keys
-
:normal
Execute Normal mode commands
-
:nunmap
Remove a mapping in Normal mode
-
:open
Open one or more URLs in the current tab
-
:pageinfo
Show various page information
-
:pagestyle
Select the author style sheet to apply
-
:preferences
Show &dactyl.host; preferences dialog
-
:pwd
Print the current directory name
-
:qmark
Mark a URL with a letter for quick access
-
:qmarks
Show all QuickMarks
-
:quit
Quit current tab
-
:quitall
Quit &dactyl.appName;
-
:redraw
Redraw the screen
-
:reload
Reload the current web page
-
:reloadall
Reload all tab pages
-
:restart
Force the browser to restart
-
:runtime
Source the specified file from each directory in runtimepath
-
:sanitize
Clear private data
-
:saveas
Save current document to disk
-
:sbclose
Close the sidebar window
-
:scriptnames
List all sourced script names
-
:set
Set an option
-
:setglobal
Set global option
-
:setlocal
Set local option
-
:sidebar
Open the sidebar window
-
:silent
Execute a command silently
-
:source
Read Ex commands from a file
-
:stop
Stop loading the current web page
-
:stopall
Stop loading all tab pages
-
:style
Style &dactyl.appName; and web sites
-
:styledisable
Disable a user style sheet
-
:styleenable
Enable a user style sheet
-
:styletoggle
Toggle a user style sheet
-
:tab
Execute a command and tell it to output in a new tab
-
:tabattach
Attach the current tab to another window
-
:tabdetach
Detach current tab to its own window
-
:tabdo
Execute a command in each tab
-
:tabduplicate
Duplicate current tab
-
:tablast
Switch to the last tab
-
:tabmove
Move the current tab after tab N
-
:tabnext
Switch to the next or countth tab
-
:tabonly
Close all other tabs
-
:tabopen
Open one or more URLs in a new tab
-
:tabprevious
Switch to the previous tab or go count tabs back
-
:tabrewind
Switch to the first tab
-
:time
Profile a piece of code or run a command multiple times
-
:toolbarhide
Hide the named toolbar
-
:toolbarshow
Show the named toolbar
-
:toolbartoggle
Toggle the named toolbar
-
:unabbreviate
Remove an abbreviation
-
:undo
Undo closing of a tab
-
:undoall
Undo closing of all closed tabs
-
:unlet
Delete a variable
-
:unmap
Remove a mapping
-
:verbose
Execute a command with verbose set
-
:version
Show version information
-
:viewsource
View source code of current document
-
:vmap
Map a key sequence in Visual mode
-
:vmapclear
Remove all mappings in Visual mode
-
:vnoremap
Map a key sequence without remapping keys in Visual mode
-
:vunmap
Remove a mapping in Visual mode
-
:winclose
Close window
-
:window
Execute a command and tell it to output in a new window
-
:winonly
Close all other windows
-
:winopen
Open one or more URLs in a new window
-
:wqall
Save the session and quit
-
:yank
Yanks the output of the given command to the clipboard
-
:zoom
Set zoom value of current web page
-
-

Options

-
-
activate
Define when tabs are automatically activated
-
altwildmode
Define how command-line completion works when the Alt key is pressed
-
autocomplete
Automatically update the completion list on any key press
-
banghist
Replace occurrences of ! with the previous command when executing external commands
-
cdpath
List of directories searched when executing :cd
-
complete
Items which are completed at the :open prompts
-
cookieaccept
When to accept cookies
-
cookielifetime
The lifetime for which to accept cookies
-
cookies
The default mode for newly added cookie permissions
-
defsearch
Set the default search engine
-
editor
Set the external text editor
-
encoding
Changes the character encoding of the current buffer
-
errorbells
Ring the bell when an error message is displayed
-
eventignore
List of autocommand event names which should be ignored
-
exrc
Allow reading of an RC file in the current directory
-
extendedhinttags
XPath string of hintable elements activated by ;
-
fileencoding
Changes the character encoding that &dactyl.appName; uses to read and write files
-
findcase
Find case matching mode
-
followhints
Change the behaviour of in Hints mode
-
fullscreen
Show the current window fullscreen
-
guioptions
Show or hide certain GUI elements like the menu or toolbar
-
helpfile
Name of the main help file
-
hintinputs
How text input fields are hinted
-
hintkeys
The keys used to label and select hints
-
hintmatching
How links are matched
-
hinttags
XPath string of hintable elements activated by f and F
-
hinttimeout
Timeout before automatically following a non-unique numerical hint
-
history
Number of Ex commands and find patterns to store in the command-line history
-
hlfind
Highlight previous find pattern matches
-
incfind
Show where the find pattern matches as it is typed
-
insertmode
Use Insert mode as the default for text areas
-
jsdebugger
Use the JavaScript debugger service for JavaScript completion
-
laststatus
Show the status line
-
loadplugins
Load plugin scripts when starting up
-
mapleader
Defines the replacement keys for the pseudo-key
-
maxitems
Maximum number of items to display at once in a listing
-
messages
Number of messages to store in the message history
-
more
Pause the message list window when more than one screen of listings is displayed
-
newtab
Define which commands should output in a new tab by default
-
nextpattern
Patterns to use when guessing the 'next' page in a document sequence
-
online
Set the 'work offline' option
-
pageinfo
Desired info in the :pageinfo output
-
passkeys
Pass certain keys through directly for the given URLs
-
popups
Where to show requested popup windows
-
previouspattern
Patterns to use when guessing the 'previous' page in a document sequence
-
private
Set the 'private browsing' option
-
runtimepath
List of directories searched for runtime files
-
sanitizeitems
The default list of private items to sanitize
-
sanitizeshutdown
The items to sanitize automatically at shutdown
-
sanitizetimespan
The default sanitizer time span
-
scroll
Number of lines to scroll with and commands
-
shell
Shell to use for executing :! and :run commands
-
shellcmdflag
Flag passed to shell when executing :! and :run commands
-
showmode
Show the current mode in the command line
-
showstatuslinks
Show the destination of the link under the cursor in the status bar
-
showtabline
Control when to show the tab bar of opened web pages
-
strictfocus
Prevent scripts from focusing input elements without user intervention
-
suggestengines
Engine Alias which has a feature of suggest
-
titlestring
Change the title of the window
-
urlseparator
Set the separator regexp used to separate multiple URL args
-
usermode
Show current website with a minimal style sheet to make it easily accessible
-
verbose
Define which info messages are displayed
-
visualbell
Use visual bell instead of beeping on errors
-
wildanchor
Regexp list defining which contexts require matches anchored to the beginning of the result
-
wildcase
Completion case matching mode
-
wildignore
List of file patterns to ignore when completing files
-
wildmode
Define how command-line completion works
-
wildoptions
Change how command-line completion is done
-
wordseparators
How words are split for hintmatching
-
-