From 46605c7a848f1e27410f7ca0dcdbf3d6236e0650 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 3 Feb 2022 16:34:17 +0100 Subject: [PATCH] zsh:funcs:nvim-man: Use `man` if option is passed If an option without arguments like `--version` is passed, `nvim-man` should use `command man` as well. --- .config/zsh/zshrc.d/40-functions.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 21ff9ad..01b8299 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -397,7 +397,9 @@ git-commit-last-msg() { } nvim-man() { - if (( $+commands[nvim] && $# == 1 )); then + # Use nvim only if it exists, there was just one argument passed and that + # argument is not an option (e.g. `--version`) + if (( $+commands[nvim] && $# == 1 && $1 == ${1#-} )); then # Check for existence of man page. command man -w "$1" >/dev/null || return