From 5312e42a0993f2e460d653bb7000f3aa1bba03ea Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 3 Feb 2022 16:50:33 +0100 Subject: [PATCH] zsh:funcs:nvim-man: Use `[[` for option check "${1#-}" is not properly parsed in `((` when long options containing a `=` are passed (`bad math expression: operand expected`). --- .config/zsh/zshrc.d/40-functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 4410506..a6a5295 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -399,7 +399,7 @@ git-commit-last-msg() { nvim-man() { # Use nvim only if it exists, there was just one argument passed, that # argument is not an option (e.g. `--version`) and stdout is a terminal. - if (( $+commands[nvim] && $# == 1 && $1 == ${1#-} )) && [[ -t 1 ]]; then + if (( $+commands[nvim] && $# == 1 )) && [[ $1 == ${1#-} && -t 1 ]]; then # Check for existence of man page. command man -w "$1" >/dev/null || return