Manpages for C
This is a simple but convenient VS Code extension that contributes a hover provider for manual pages (i.e., "manpages" or "man pages") relating to system-level C APIs and lets the user view those manpages as cross-referenced HTML documents directly inside VS Code webviews.
When writing system-level C programs, one often has to browse through manual pages inside a terminal window in order to find the relevant documentation. This extension allows looking up and viewing those manual pages directly inside VS Code tabs as cross-referenced HTML webviews. When hovering a symbol (i.e., a "word") in a C source file, the extension will look up that symbol (using man -f) and report any matches as a list of clickable links accompanied by their corresponding description (e.g., fopen(3): stream open functions). Clicking on such a link will trigger a command that will generate and reveal the manual page as HTML in a VS Code webview. As a convenience, the extension also contributes a command called Manpages: Perform exact search that lets the user run a search from which all exact matches get presented as a list of clickable items in the command palette.
Note to Windows users: As "man pages" are mostly a UNIX concept, the target users for this VS Code extension are ones working on UNIX-like systems. But Windows users who develop through VS Code's Remote Development framework (e.g., Windows Subsystem for Linux (WSL), Docker Dev Containers, or Remote SSH) should be able to use the extension just as well, as the extension will run on the remote host where the manual pages (and the tools for interacting with them) exist.
Features
- On-the-spot generation of HTML manpages for visualization in webviews (directly as VS Code tabs).
- Hover provider (for C source code) for symbols with matching UNIX manual pages.
- Exact symbol search command (named
Manpages: Perform exact search) that lets the user look up manual pages. An optional section name can be added, preceded by a space, at the end of the symbol to narrow down the search.
- Cross-referencing between manuals is supported provided that the manuals use semantics understood by
mandoc.
Read more...
Previews
Video preview: Main functionalities

Screenshot 1: Hover provider example

Screenshot 2: HTML manual page example

Dependencies
mandoc: This extension uses mandoc to generate the HTML documents (for the manuals) that are presented as webviews. While the majority of BSD-based operating systems ship with mandoc, most Linux-based ones do not, so Linux users will have to manually install it for this extension to properly function. The binary can often easily be installed using a package management tool (e.g., sudo apt install mandoc), or can simply be built from source without even being installed system-wide (i.e., one can simply point to the binary using the appropriate manpagesForC.mandocBinaryPath setting).
man: This extension uses man to look up symbols (e.g., man -f -S 3 fopen) and to resolve the manual paths (e.g., man -w -S 3 fopen). The majority of UNIX-like systems ship with an implementation of man, such that, in most cases, no action will be required in that regard, although the extension does have a setting called manpagesForC.manBinaryPath that lets the user specify which man version on the system to use.
Extension Settings
manpagesForC.manBinaryPath: The path of the man binary on the system. If empty, will internally default to using man.
manpagesForC.mandocBinaryPath: The path of the mandoc binary on the system. If empty, will internally default to using mandoc.
manpagesForC.manSearchPath: The search path that should be used by man when searching manuals. When provided, this value will result in the $MANPATH environment variable being ignored. To provide more than one path, use the : character between them (e.g., /path/1/man:/path/2/man).
manpagesForC.hoverProviderEnabled: Whether to enable the hover provider for C source code. While the hover provider is a core feature, a user could technically decide to disable it and only use the manpagesForC.performExactSearch command.
manpagesForC.hoverProviderIgnoreLanguageKeywords: Whether to ignore, when hovering, a symbol that corresponds to an official C23 keyword or preprocessor directive.
manpagesForC.hoverProviderSymbolDenyList: A "denylist" of symbols that should not trigger a search when hovered.
manpagesForC.retainWebViewContextWhenHidden: Whether to retain a webview's context when that webview is hidden. Doing so could increase RAM usage, but will yield a better user experience, because without it the scroll position will get reset to the top of the page when coming back.
Commands
- Manpages: Perform exact search — Lets the user look up manual pages by name, optionally followed by a space and a section name. Examples:
open, open 2, fopen, crypto 7ossl.
- Manpages: Open webview — A hidden command that's used internally to look up the manual path, generate the HTML version of the manual, and open it inside a webview.
Known Issues & Limitations
- Currently, the extension only supports English, as the
LC_ALL="C" environment gets used when spawning child processes.
- So far, I tested the extension on macOS and on Ubuntu (in a dev container).
- The hover provider and the search command may feel a bit slow on macOS if you are using the default
man implementation. As far as my understanding goes, that is because of how the BSD-based man implementation has been architected (e.g., shell script wrappers, dynamic PATH heuristics, flat-file databases for whatis, etc.). GNU's man-db has been designed differently and feels way faster. So if that slowness annoys you, you could try to install man-db and configure manpagesForC.manBinaryPath with its path. Another approach that I haven't tried myself but which "could" work would be to try generating a whatis index using /usr/libexec/makewhatis in your manpages root(s), but that would require elevated privileges for Apple's Xcode framework folders, and I personally would avoid it.
- Cross-referencing of symbols inside the generated HTML documents is possible to the extent that documents use the proper semantics (e.g.,
.Xr) understood by mandoc. While macOS (and probably other BSD-based operating systems) has manual pages that use those semantics, some Linux-based operating systems don't, so cross-referencing will not work over there.
- This extension relies on
mandoc to generate the HTML versions of the manuals. While most BSD-based operating systems ship with that tool, most Linux-based ones don't, so mandoc will have to be manually installed.
- The hover provider currently only works for C documents. In the future, it could be interesting to add support for C++ documents as well, however.
- The hover provider currently will trigger searches for symbol hovering of arbitrary variables and inside comments. I have a few improvement ideas in that regard that I should be rolling out sometime in the near future.
- Keyboard navigation between webviews can sometimes feel clunky, but I think it's more of a VS Code limitation than about this very extension. Also, I have noticed that trying to close one webview using
Ctrl+w will sometimes close two adjacent ones, for similar reasons. Some more investigation is required.
- Currently we do not use the
-a flag when looking up the symbol using man -w. That means that only the first path found will be returned. In general, I don't think it's a big deal because that would be caused by conflicting manuals, which can be addresssed by providing a definitive value for the manpagesForC.manSearchPath setting. But a future version of this extension could address that and let the user know about the multiple manuals for a same symbol(section) occurrence.
Copyright
Copyright (c) 2026 François Aucoin. All rights reserved.
| |