I'm used to do
??symbol
when I want the reference for a given symbol, then I click on the >>
arrows to open the help window.
Would it be possible to redefine the meaning of ??
in order to open the reference window directly ?
The simplest (and canonical) method is to place the keyboard cursor in the Symbol name, or select it with a double-click, and press F1 if you use Windows/Linux or Command-Shift-F if you use OS X. This will bring up the Help for that item. This also works with compound operators, e.g. /;
.
Nevertheless I like a challenge, therefore:
$PreRead =
# /. RowBox[{"??", name_String}] :>
FrontEndTokenExecute["OpenHelpLink", name] &;
Now this brings up the Help page for Fold
directly:
?? Fold
While this will search the documentation for the term "Fold":
?? "Fold"
I chose $PreRead
for this purpose so that it will not interfere with internal calls to Information
.
You can also get the original behavior by writing out Information
, e.g.:
? Plus
x+y+z represents a sum of terms. >>
Information[Plus] (* equivalent to ??Plus *)
x+y+z represents a sum of terms. >>
Attributes[Plus]={Flat,Listable,NumericFunction,OneIdentity,Orderless,Protected} Default[Plus]:=0
^
characters in 2^^10010
-- it does not work. However, selecting ^^
and pressing F1 directs you to the documentation for BaseForm
.
$\endgroup$
Commented
Feb 5, 2014 at 10:32
The typical way to search the documentation is the keyboard shortcut Mr Wizard mentioned. In general, you can find the shortcut key for a command by looking in the menu ...
If you are looking for a built-in way to open a documentation pages using a built-in command, then you are looking for Documentation`HelpLookup
.
Documentation`HelpLookup["euler"]
will open the documentation centre and do a search for "euler". It returns a reference to the notebook window containing the search result. The behaviour equivalent to typing the search term into the documentation search box.
"OpenHelpLink"
. Documentation`HelpLookup["Fold"] // Trace // LeafCount
yields 104848
while FrontEndTokenExecute["OpenHelpLink", "Fold"] // Trace // LeafCount
yields 21
. What is HelpLookup
doing and what is its benefit over "OpenHelpLink"
?
$\endgroup$
Commented
Feb 5, 2014 at 16:36
HelpLookup
returns a notebook object, which can be very useful whereas "OpenHelpLink"
returns Null
, which makes it useful only for this particular evaluation and cannot be used in other programs/applications, etc. More importantly, does the leaf count matter for OP's question? :)
$\endgroup$
HelpLookup
also returns Null
. It may not matter, but it does make me wonder about the overhead, and if given the choice between two methods that are apparently otherwise equivalent (in v7) I'll pick the one that seems to have less overhead.
$\endgroup$
Commented
Feb 5, 2014 at 17:54
F1
. $\endgroup$