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`).
This commit is contained in:
2022-02-03 16:50:33 +01:00
parent 3dbffbc08e
commit 5312e42a09

View File

@@ -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