I use man pages all the time, but sometimes I do not know exactly what I want to open.
printf is a good example.
There is printf(1) for the shell command, printf(3) for the C library function, and depending on what is installed locally there may be even more entries around it.
I wanted something simple inside Neovim:
- list local man pages
- fuzzy search them
- see the section before opening
- open using Neovim's built-in
:Man
So I made a small plugin: man.nvim.
Source:
- GitHub: , for the Telescope version:
CODE{
'moniquelive/man.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' },
config = function()
require('man_nvim').setup()
end,
}
For the
mini.pickversion:
CODE{
'moniquelive/man.nvim',
branch = 'mini.picker',
dependencies = { 'echasnovski/mini.pick' },
config = function()
require('mini.pick').setup()
require('man_nvim').setup()
end,
}
With , for Telescope:
CODEPlug 'nvim-telescope/telescope.nvim'
Plug 'moniquelive/man.nvim'
Then somewhere after plugins load:
CODErequire('man_nvim').setup()
For
mini.pick:
CODEPlug 'echasnovski/mini.pick'
Plug 'moniquelive/man.nvim', { 'branch': 'mini.picker' }
Then:
CODErequire('mini.pick').setup()
require('man_nvim').setup()
Final thoughts
This is a small plugin, but it fits my workflow nicely.
I did not want to replace
man.
I only wanted a better way to discover local man pages from inside Neovim.
Telescope and mini.pick both work well for this. The fun part was keeping the core behavior simple, and only changing the picker layer.
If I extend this next, I may add a filesystem fallback for machines where the
aproposdatabase is missing or stale.
But for now: fuzzy search local docs, filter away noise, open with
:Man.
Profit!
↗ Original-Artikel auf dev.to lesenVollständiger Original-BerichtAusführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
SOCIAL SHARE CARD GENERATOR