How do I read man pages inside Neovim with syntax highlighting and tag navigation?
Answer
:Man {name}
Explanation
Neovim ships with a built-in :Man command (the man.lua ftplugin) that opens manual pages directly in a buffer. Unlike shelling out with :!man cmd, the Neovim :Man integration provides syntax highlighting, <C-]> cross-reference navigation to jump to linked man pages, and full integration with the jump list so you can navigate back with <C-o>.
How it works
:Man grepopens the grep(1) man page in a new split:Man 3 printfopens the C libraryprintfman page from section 3- Inside the man buffer,
<C-]>on a highlighted cross-reference jumps to that man page <C-t>or<C-o>navigate back through the man page historyqcloses the man page buffer
Example
:Man git-rebase
:Man 5 crontab
:Man 2 open
For the section-prefixed form, the section number comes before the name.
Tips
- Use
:vertical Man {name}to open the man page in a vertical split instead of horizontal - Set Neovim as your system-wide man pager by adding this to your shell profile:
Thenexport MANPAGER='nvim +Man!'man grepin the terminal opens directly in Neovim Kin Normal mode runs:Manon the word under the cursor (useful in shell scripts and C files)