Any good tool to rapidly jump to programming documentation
Asked Answered
V

3

9

Question in bold below. This is a programming question, so do not jump to conclusions and vote to close.

I'm a C++ programmer. I use OS X / quicksilver or ubuntu / compiz / gnome do as my desktop. I try not to touch the mouse and I use multiple desktops and I use tiling both of these I drive from the keyboard. For programming I use bash and vim.

As I am a C++ programmer I need to reference documentation scattered all over the place, for example STL / Boost / CMAKE / zeromq / protocol buffers / Mongodb / rapidJson / luajit and the list goes on.

Jumping to various reference manuals is a real time sink / mental thought process disruptor. Perhaps you are not convinced that this is really a problem, but if you use multiple libraries from boost, without code completion you will appreciate that this is really an issue. How do folks manage their reference manual links and what is the quickest way to jump to reference manuals ? Standard browser bookmarks are not the answer, and whatever you suggest should be done in the fewest amount of keystrokes possible, or the lowest latency from information need synthesis to information need satisfied.

Perhaps a custom browser, or powerfull plugins I don't know off ? For directory navigation I use vim's NERDTree, perhaps something along those lines ? For example I should be able to type boost-filesystem and be able to jump directly to the code-reference page of boost-filesystem.

Villada answered 2/4, 2012 at 13:14 Comment(1)
What makes you think using VIM is still the best choice? Especially after you are already running into a problem that modern day IDE's fix for you?Dissuade
C
4

If your documentation references have well-defined URI, you can create a small program that automatically construct the correct URI given the documentation id and some entity identifier.

For instance, I wrote a small Ubiquity command that allows me to quickly open the latest documentation of any Qt entity, simply by swapping to Firefox, typing ctrl+space to popup the Ubiquity console and then typing qt QSomeClass.

Here is the complete code for the Ubiquity command (if you already have Ubiquity installed, you can subscribe to the command feed on this blank page):

CmdUtils.makeSearchCommand({
  names: ["qt"],
  author: {name: "Luc Touraille"},
  url: "http://doc.qt.nokia.com/main-snapshot/{QUERY}.html",
  icon: "http://qt.nokia.com/favicon.ico",
  description: "Searches the Qt Documentation for your word."
});

As you can see, it is very simple and can easily be adapted for other online documentation, as long as the URL are well constructed.

Edit

Here is a more general version that you can adapt to your needs (you just need to fill the templates map):

var urlTemplates = {
  "QT": "http://doc.qt.nokia.com/main-snapshot/{QUERY}.html",
  "MPL": "www.boost.org/doc/libs/release/libs/mpl/doc/refmanual/{QUERY}.html",
  ".NET": "http://msdn.microsoft.com/en-us/library/{QUERY}.aspx"
};

CmdUtils.CreateCommand({
    names: ["doc"],
    author: {name: "Luc Touraille"},

    arguments: [ {role: "object",
                  nountype: /^[0-9a-zA-Z_.-]*$/,
                  label: "entity"
                 },
                 {role: "source",
                  nountype: [source for (source in urlTemplates)],
                  label: "documentation"
                 } ],

    description: "Searches the documentation for some entity on a given documentation reference.",

    _getSearchResultUrl: function( arguments ) {
      var documentationSource = arguments.source.text;

      var urlTemplate = urlTemplates[documentationSource.toUpperCase()];

      return urlTemplate.replace("{QUERY}", arguments.object.text);
    },

    execute: function( arguments ) {
      Utils.openUrlInBrowser(this._getSearchResultUrl(arguments));
    }
});

Sample uses:

doc QMainWindow from qt
doc from mpl vector
doc system.idisposable from .net
doc this from .net // with some text selected

Of course, this is a very naive implementation, that would fail on most sites. A more evolved approach could be replacing the URL templates in the map by functions, thereby providing more control over the construction of the target URL. I'll leave this as an exercise for the reader :). Another solution could be to perform a search on the website (assuming it provides a proper REST API for searching) and to jump to the first result.

Counter answered 2/4, 2012 at 15:14 Comment(0)
K
2

Im afraid that what you want is an IDE, which Vim, however I love it, is not.

There is a plugin that gives access to the standard library documentation. However, Vim is unable by itself to make sense of your code and magically adapt to whatever library you include in your project. The Vim Wiki also has two pages that may be of interest.

Kamchatka answered 2/4, 2012 at 13:52 Comment(4)
no C++ ide, other than visual studio, parses modern c++ correctly, or fast enough. which is why I have shunned C++ IDE's. This is precisely the reason I am looking for some form of link management app / worflow that will let me jump to URL's fast. Having said that I don't mind a tool like quicksilver or gnome-do that will let me jump to links fast.Villada
I don't know much about Gnome Do but it's easy to add custom web searches to Quicksilver in Preferences > Catalog > Custom. If your libraries have a searchable documentation, it can, at least partially, solve your problem I think.Kamchatka
+1 for that. I don't develop on a map at this particular point in time. But I suppose gnome-do will have similar functionality. I will look into it.Villada
@HassanSyed Have you tried X-code (shiver I hate that thing) or Eclipse CDT?Dissuade
H
1

I type Shift+k to view C man page.

Hypochondriasis answered 2/4, 2012 at 13:19 Comment(2)
Yes that would be a good starting point =D. However most c++ libraries have online manuals these days. Furthermore, only clang can parse c++ for coding tools to predidtably extract identifiers with correct semantics so there aren't any tools for this yet. So, first I'd need to wire up clang++ with vim, then I'd need to use the man subsystem to trampoline to the web-based reference manuals :DVillada
I'd also have to normalize the identifiers to a authorotative form (such as boost::filesystem::path to boost-fileysten) so that the tools directs me to the top-level documentation. It would be faster just type "boost-filesystem" in some tool and it go to the right page.Villada

© 2022 - 2024 — McMap. All rights reserved.