zsh:funcs:nvim-man: Move page existence check call

Check for the existence of the page only if `nvim` would be executed.
This commit is contained in:
2022-02-03 16:31:42 +01:00
parent 1be26adfc9
commit e55652fd44

View File

@@ -397,11 +397,10 @@ git-commit-last-msg() {
}
nvim-man() {
# Check for existence of man page. Assume that the page was specified as the
# last argument.
command man -w "${@[$#]}" >/dev/null || return
if (( $+commands[nvim] && $# == 1 )); then
# Check for existence of man page.
command man -w "$1" >/dev/null || return
if (( $+commands[nvim] )) && [[ $# -eq 1 ]]; then
# $MANPAGER does the trick too but lines are hard-wrapped.
nvim -u NORC +"runtime! plugin/man.vim | Man $1 | only | set scrolloff=999 | normal M"
else