Nvim + Telescope showing C++ docs
Nvim + Telescope showing C++ docs

I’ve been revamping my Neovim configuration (more on that some other time).

I used to have a fuzzy searcher of Qt and C++ docs in Vim which would open the thing I searched for in a web browser or Qt Assistant (or cppman, but that is cppref only).

That was tedious for a several reasons I’m not going to go into now, so I decided to use this Neovim configuration revamp to make shell-based documentation nicer.

Enter zeal-cli

Zeal is a really nice offline documentation browser that comes with more than 200 documentation sets. And you can also create your own sets. (for Qt users, imagine Qt Assistant, but with docs about everything)

Now, Zeal doesn’t have a nice CLI API, but the docset format is simple enough for it to be used even without the Zeal application (after you use it to download docsets you want).

And that is exactly what zeal-cli does.

It is a small python script that shows Zeal docs in the Lynx console web browser. It can also clean-up the html pages from noise like navigation menus, table of contents and other things that just take valuable space before showing them in Lynx.

Usage is quite simple – you specify the docset you want to use and which page to show:

zeal-cli cpp std::string

Fuzzy searching

zeal-cli can also list all the pages available in a docset which can be used along with an application like FZF for fuzzy searching the documentation. You can just pipe the output of zeal-cli to fzf to get a similar view to the screenshot above:

zeal-cli cpp | fzf --height=50% --preview='zeal-cli --lynx-dump=true cpp {}'

Neovim integration

I’ve also made a small Fennel-based plugin for Neovim and Telescope.nvim to be able to search and show the docs inside of Neovim. This plugin in action is what the screenshot above shows.

There’s room for improvement for both zeal-cli and nvim-telescope-zeal-cli and patches are welcome.