Read manpages faster than superman!
- Manpage autocompletion
- Open manpages whose section is not just a number
- Much more intuitive behavior than the builtin manpage plugin
- Open in a split/vsplit/tabe
- Open from inside a neovim terminal!
- Jump to manpages in specific sections through the manpage links
Any plugin manager should work fine.
Plug 'nhooyr/neoman.vim' "vim-plug
The command is as follows:
Neoman[!] [{sect}] {page}[({sect})]
Several ways to use it, probably easier to explain with a few examples.
Neoman printf
Neoman 3 printf
Neoman printf(3)
Inside a manpage, press <c-]>
on a manpage link to jump to the manpage. Or you can set the following in your init.vim
/.vimrc
and use K
instead.
set keywordprg=:Neoman
By default if a neoman window is already open, it will be switched to, if you would like it to open in the current window, use the bang.
Or set g:neoman_current_window
in which case the behaviors are swapped.
Want to split/vsplit/tabe? Pretty simple.
:vsplit | Neoman! 3 printf
You can very easily make that a custom command or mapping.
You will need nvr for the super cool neovim terminal integration.
Add the following functions to your .zshrc
/.bashrc
_nman() {
if [[ "$@" == "" ]]; then
print "What manual page do you want?"
return
fi
/usr/bin/man "$@" > /dev/null 2>&1
if [[ "$?" != "0" ]]; then
print "No manual entry for $*"
return
fi
if [[ -z $NVIM_LISTEN_ADDRESS ]]; then
/usr/bin/env nvim -c $cmd
else
nvr --remote-send "<c-n>" -c $cmd
fi
}
nman() {
cmd="Neoman $*"
_nman "$@"
}
nman!() {
cmd="Neoman! $*"
_nman "$@"
}
_nman() {
if [[ "$@" == "" ]]; then
print "What manual page do you want?"
return
fi
/usr/bin/man "$@" > /dev/null 2>&1
if [[ "$?" != "0" ]]; then
print "No manual entry for $*"
return
fi
vim -c $cmd
}
nman() {
cmd="Neoman $*"
_nman "$@"
}
nman!() {
cmd="Neoman! $*"
_nman "$@"
}
compdef nman="man"
compdef nman!="man"
complete -o default -o nospace -F _man nman
complete -o default -o nospace -F _man nman!
Use nman
/nman!
to open the manpages. nman!
works the same way as :Neovim!
.
I've really only tested this with zsh, if you have any problems with bash and fix them please send a PR!
Only setting is g:neoman_current_window
. This is explained above in the command section.
- Vim docs