Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any good tool to rapidly jump to programming documentation

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.

like image 745
Hassan Syed Avatar asked Apr 02 '12 13:04

Hassan Syed


2 Answers

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.

like image 183
Luc Touraille Avatar answered Oct 20 '22 13:10

Luc Touraille


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.

like image 36
romainl Avatar answered Oct 20 '22 12:10

romainl